Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10565 in orxonox.OLD for branches/scriptimprovements/src


Ignore:
Timestamp:
Feb 3, 2007, 12:21:51 PM (18 years ago)
Author:
snellen
Message:

script_trigger: added conclsive errormessage in case of abort

Location:
branches/scriptimprovements/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/scriptimprovements/src/world_entities/script_trigger.cc

    r10564 r10565  
    6060  scriptCalled = false;
    6161  scriptIsOk = false;
     62  executionStopped = false; // true when something goes wrong and the trigger has to be stopped
    6263  triggerRemains = true;
    6364  addToScript = false;
     
    209210void ScriptTrigger::executeAction(float timestep)
    210211{
     212  if(executionStopped && scriptIsOk) // If the script has been loaded correctly but something is wrong with the settings of the trigger
     213  {
     214   PRINT(1)("ERROR SCRTIPTTRIGGER: Something went wrong while executing %s in %s . Execution stopped! \n", functionName.c_str(), script->getFileName().c_str());
     215   return;
     216  }
     217
    211218  if(scriptIsOk)
    212219  {
     
    215222     {
    216223      PRINT(1)("ERROR SCRTIPTTRIGGER : Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
     224      executionStopped = true; //Since the triggersettings won't change on runtime, it makes no sense to call the function again.
    217225      return;
    218226     }
    219227
    220228    if (! (script->pushParam( timestep, this->functionName)) )
     229     {
     230      executionStopped = true; //Since the triggersettings won't change on runtime, it makes no sense to call the function again.
    221231      return;
    222 
     232     }
    223233    if( !(script->executeFunction()) )
    224234     {
    225235      PRINT(1)("ERROR SCRTIPTTRIGGER : Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
     236      executionStopped = true; //Since the triggersettings won't change on runtime, it makes no sense to call the function again.
    226237      return;
    227238     }
  • branches/scriptimprovements/src/world_entities/script_trigger.h

    r9869 r10565  
    6464    bool         scriptCalled;
    6565    bool         scriptIsOk;
     66    bool         executionStopped;   // true when something goes wrong and the trigger has to be stopped
    6667    bool         scriptFinished;
    6768    int          returnCount;        //TODO: set return count correctly
Note: See TracChangeset for help on using the changeset viewer.