Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 7, 2006, 8:47:05 PM (18 years ago)
Author:
snellen
Message:

cleaned script trigger, added member: a pointer to the required script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/lib/script_engine/script_trigger.cc

    r8208 r8211  
    77{
    88  scriptCalled = false;
    9   callScript = false;
    10   triggered = false;
     9  scriptIsOk = false;
    1110  loadParams(root);
    1211
     
    2423  {
    2524  WorldEntity ::loadParams(root);
    26  
     25
    2726   { LoadParam(root, "file", this, ScriptTrigger, setScript)
    2827        .describe("the fileName of the script, that should be triggered by this script trigger")
     
    5049    timer = delay;
    5150  }
    52  
     51
    5352}
    5453
     
    5756{
    5857  BaseObject* targetEntity = ClassList::getObject(target, CL_WORLD_ENTITY);
    59  
     58
    6059  if (targetEntity != NULL)
    6160  {
     
    7170{
    7271  BaseObject* parentEntity = ClassList::getObject(parent, CL_WORLD_ENTITY);
    73  
     72
    7473  if (parentEntity != NULL)
    7574  {
     
    105104void ScriptTrigger::executeAction()
    106105{
    107      ScriptManager* scriptManager = ScriptManager::getInstance();
    108      Script* script = scriptManager->getScriptByFile(this->scriptFile);
    109      if(script != NULL)
     106     if(scriptIsOk)
    110107     {
    111108     if(!(script->selectFunction(this->functionName,0)) )
     
    115112     }
    116113}
     114
     115
     116void ScriptTrigger::setScript(const std::string& file)
     117{
     118  ScriptManager* scriptManager = ScriptManager::getInstance();
     119  script = scriptManager->getScriptByFile(file);
     120  if(script != NULL)
     121    scriptIsOk = true;
     122
     123}
Note: See TracChangeset for help on using the changeset viewer.