Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 17, 2010, 9:41:17 PM (14 years ago)
Author:
dafrick
Message:

Fixing "bug", that caused crash in dedicated mode.
Script object can now specify whether the code that is executed by it needs graphics to work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/objects/Script.cc

    r7410 r7463  
    3232#include "core/CoreIncludes.h"
    3333#include "core/EventIncludes.h"
     34#include "core/GameMode.h"
    3435#include "core/LuaState.h"
    3536#include "core/XMLPort.h"
     
    5758        this->luaState_ = NULL;
    5859        this->remainingExecutions_ = Script::INF;
     60        this->mode_ = ScriptMode::normal;
     61        this->onLoad_ = true;
     62        this->times_ = Script::INF;
     63        this->needsGraphics_ = false;
    5964
    6065    }
     
    8691        XMLPortParam(Script, "onLoad", setOnLoad, isOnLoad, xmlelement, mode).defaultValues(true);
    8792        XMLPortParam(Script, "times", setTimes, getTimes, xmlelement, mode).defaultValues(Script::INF);
     93        XMLPortParam(Script, "needsGraphics", setNeedsGraphics, getNeedsGraphics, xmlelement, mode).defaultValues(false);
    8894
    8995        XMLPortEventSink(Script, BaseObject, "trigger", trigger, xmlelement, mode);
     
    127133    {
    128134        if(this->times_ != Script::INF && this->remainingExecutions_ == 0)
     135            return;
     136
     137        // If the code needs graphics to be executed but the GameMode doesn't show graphics the code isn't executed.
     138        if(this->needsGraphics_ && !GameMode::showsGraphics())
    129139            return;
    130140
Note: See TracChangeset for help on using the changeset viewer.