Bug from mhen'ga

Discussion in 'Fixed' started by geekmann, Feb 10, 2018.

Thread Status:
Not open for further replies.
  1. geekmann

    geekmann Member

    Joined:
    Oct 20, 2016
    was playing the free public release and got this error while in the deep jungle.
     

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Jacques00

    Jacques00 Well-Known Member
    Moderator

    Joined:
    Aug 26, 2015
    Can you post a copy of your .tits save file for testing?
     
  3. geekmann

    geekmann Member

    Joined:
    Oct 20, 2016
    how do i do that?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. geekmann

    geekmann Member

    Joined:
    Oct 20, 2016
    wait think i see what your looking for.
     

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Jacques00

    Jacques00 Well-Known Member
    Moderator

    Joined:
    Aug 26, 2015
    Is this still an issue for you? I can't seem to replicate the bug.
     
  6. adev

    adev Well-Known Member

    Joined:
    Apr 27, 2017
    i have the feeling this is the cause:

    else addDisabledButton(9999,"Drain","Drain","You need to be bipedal (or at least non-tauric) in order to do this... or have a pussy for her to mount.");
     
  7. Jacques00

    Jacques00 Well-Known Member
    Moderator

    Joined:
    Aug 26, 2015
    If that is the case, it should be fixed for the next public release (the latest release has it already fixed if I'm not mistaken).
     
  8. adev

    adev Well-Known Member

    Joined:
    Apr 27, 2017
    Now that we do the right thing with uncaught errors we should start adding error handling so that not every hiccup ends up as a fatal bug.

    I came up with this bit of code which reports errors like before, but does not stop the game unnecessarily and should prevent inconsistent game states if used correctly.

    Code:
    --- classes/GUI.as   Mon Feb 05 22:54:00 2018
    +++ classes/GUI.as   Wed Feb 14 04:54:19 2018
    @@ -1083,14 +1083,28 @@
             public function addButton(slot:int, cap:String = "", func:Function = undefined, arg:* = undefined, ttHeader:String = null, ttBody:String = null):void
             {
    -           //APRIL FOOLS!
    -           //cap = kGAMECLASS.parser.recursiveParser(cap);
    -           _buttonTray.addButton(slot, cap, func, arg, ttHeader, ttBody);
    +           try
    +           {
    +               //APRIL FOOLS!
    +               //cap = kGAMECLASS.parser.recursiveParser(cap);
    +               _buttonTray.addButton(slot, cap, func, arg, ttHeader, ttBody);
    +           }
    +           catch (e:*)
    +           {
    +               if (kGAMECLASS.reportError(e)) throw e;
    +           }
             }
             
             public function addItemButton(slot:int, cap:String = "", quantity:int = 0, func:Function = undefined, arg:* = undefined, ttHeader:String = null, ttBody:String = null, ttCompare:String = null):void
             {
    -           _buttonTray.addItemButton(slot, cap, quantity, func, arg, ttHeader, ttBody, ttCompare);
    +           try
    +           {
    +               _buttonTray.addItemButton(slot, cap, quantity, func, arg, ttHeader, ttBody, ttCompare);
    +           }
    +           catch (e:*)
    +           {
    +               if (kGAMECLASS.reportError(e)) throw e;
    +           }
             }
             
             public function setButtonBlue(slot:int):void
    @@ -1126,18 +1140,39 @@
             
             public function addDisabledButton(slot:int, cap:String = "", ttHeader:String = null, ttBody:String = null):void
             {
    -           _buttonTray.addDisabledButton(slot, cap, ttHeader, ttBody);
    +           try
    +           {
    +               _buttonTray.addDisabledButton(slot, cap, ttHeader, ttBody);
    +           }
    +           catch (e:*)
    +           {
    +               if (kGAMECLASS.reportError(e)) throw e;
    +           }
             }
             
             //Ghost button - used for menu buttons that overlay the normal buttons.
             public function addGhostButton(slot:int, cap:String = "", func:Function = undefined, arg:* = undefined, ttHeader:String = null, ttBody:String = null):void
             {
    -           _buttonTray.addGhostButton(slot, cap, func, arg, ttHeader, ttBody);
    +           try
    +           {
    +               _buttonTray.addGhostButton(slot, cap, func, arg, ttHeader, ttBody);
    +           }
    +           catch (e:*)
    +           {
    +               if (kGAMECLASS.reportError(e)) throw e;
    +           }
             }
             
             public function addDisabledGhostButton(slot:int, cap:String = "", ttHeader:String = null, ttBody:String = null):void
             {
    -           _buttonTray.addDisabledGhostButton(slot, cap, ttHeader, ttBody);
    +           try
    +           {
    +               _buttonTray.addDisabledGhostButton(slot, cap, ttHeader, ttBody);
    +           }
    +           catch (e:*)
    +           {
    +               if (kGAMECLASS.reportError(e)) throw e;
    +           }
             }
             public function pushToBuffer():void
    --- classes/TiTS.as   Mon Feb 05 22:54:02 2018
    +++ classes/TiTS.as   Wed Feb 14 04:31:09 2018
    @@ -618,6 +618,76 @@
                 addEventListener(Event.FRAME_CONSTRUCTED, finishInit);
             }
             
    +       /* Try to safely report errors to the user
    +        * Usage:
    +        *
    +           try
    +           {
    +               <code>
    +           }
    +           catch (e:*)
    +           {
    +               if (kGAMECLASS.reportError(e)) throw e;
    +           }
    +        *
    +        * <code> can be a little thing or something big as displaying the complete appearance/stat/log output
    +        * but to work as intended interrupting the code block at any point should never leave the game state broken
    +        *
    +        * returns true if error reporting failed - just rethrow the exception
    +        */
    +       public function reportError(arg:*):Boolean
    +       {
    +           var text:String;
    +           
    +           // Step 1: generate an error message based on the argument type passed in
    +           if (arg is Error)
    +           {
    +               var ee:Error = arg as Error;
    +               text = ("\n\n<b>Something bad happened!</b>\n\n<b>Please report this message, and include any prior scene text or a description of what you did before seeing this message:</b>\n\n");
    +               //output("Version: " + version + "\n\n");
    +               text += ("Flash Player:  " + Capabilities.playerType + " - " + Capabilities.os + "\n");
    +               text += ("Flash Version: " + Capabilities.version + "\n");
    +               text += ("Game Version: " + version + "\n\n");
    +               text += ("Error Name: " + ee.name + "\n");
    +               text += ("Error Mesg: " + ee.message + "\n");
    +               text += (ee.getStackTrace());
    +           }
    +           
    +           // Step 2: Try to display the error text without disrupting the control flow
    +           // Goal is that -apart from the failed action- the game continues as smooth as possible
    +           if ( text )
    +           {
    +               var module:ContentModule = userInterface.activeModule;
    +               
    +               // during startup - little we can do but try to resume default error handling
    +               if (!module) return true;
    +
    +               switch ( module.moduleName )
    +               {
    +                   case "PrimaryOutput":
    +                       output( text, false, false );
    +                       
    +                       return false;
    +
    +                   case "SecondaryOutput":
    +                       output2( text.replace( /\[/g, '\\[' ), false ); // work around missing parse arg
    +                       
    +                       return false;
    +
    +                   case "CodexDisplay":
    +                       outputCodex( text.replace( /\[/g, '\\[' ), false ); // work around missing parse arg
    +                       userInterface.outputCodex();
    +                       
    +                       return false;
    +
    +                   // email needs a public method to print text so errors during mail display aren't fatal anymore
    +               }
    +           }
    +           
    +           // We either could not handle the argument type or display the message
    +           // let the calling method handle it if it can
    +           return true;
    +       }
             private function uncaughtErrorHandler(e:UncaughtErrorEvent):void
             {
                 if(stage.contains(userInterface.textInput)) removeInput();
    --- classes/InputManager.as   Mon Feb 05 22:54:00 2018
    +++ classes/InputManager.as   Wed Feb 14 04:43:26 2018
    @@ -228,6 +228,9 @@
                     this.ExecuteKeyCode(e.keyCode);
                 }
                 // Otherwise, we're listening in a mode where we just want to ignore keypresses (we're likely waiting for text entry or sommat)
    +           
    +           // enable the following line to test the error reporting code
    +           kGAMECLASS.addDisabledButton(9999,"Drain","Drain","You need to be bipedal (or at least non-tauric) in order to do this... or have a pussy for her to mount.");
             }
             
             /**
    
    

    In this patch I have enabled the proposed error reporting for the addButton functions and the above error would have been reported but since failure to display a disabled button is not game breaking would allow the game to continue.
     
  9. Jacques00

    Jacques00 Well-Known Member
    Moderator

    Joined:
    Aug 26, 2015
    Okay, added--hopefully shows up in the next release.
     
Thread Status:
Not open for further replies.