Commands that need game engine objects and can't be evaluated standalone
| 131 | |
| 132 | // Commands that need game engine objects and can't be evaluated standalone |
| 133 | static bool needsGameObjects(const std::string& code) |
| 134 | { |
| 135 | static const char* markers[] = {"loadFile", "addEventHandler", |
| 136 | "addWaypoint", "createTrigger", |
| 137 | "setTrigger", "setWaypointStatements", |
| 138 | "onMapSingleClick", "onEachFrame", |
| 139 | "playSound", "playSoundAt", |
| 140 | "playMusic", "titleText", |
| 141 | "cutText", "titleRsc", |
| 142 | "cutRsc", "createDialog", |
| 143 | "createDisplay", "camCreate", |
| 144 | "camSetTarget", "camSetPos", |
| 145 | "camCommit", "camDestroy", |
| 146 | "setRain", "setFog", |
| 147 | "setOvercast", "setDate", |
| 148 | "enableRadio", "showCommandingMenu", |
| 149 | "showMap", "doMove", |
| 150 | "doFire", "doTarget", |
| 151 | "commandMove", "commandFire", |
| 152 | "moveInDriver", "moveInCargo", |
| 153 | "moveInGunner", "moveInCommander", |
| 154 | "addMagazine", "addWeapon", |
| 155 | "removeWeapon", "removeMagazine", |
| 156 | "setObjectTexture", "setObjectMaterial", |
| 157 | "forceAddUniform", "addVest", |
| 158 | "addBackpack", nullptr}; |
| 159 | for (int i = 0; markers[i]; i++) |
| 160 | if (code.find(markers[i]) != std::string::npos) |
| 161 | return true; |
| 162 | return false; |
| 163 | } |
| 164 | |
| 165 | static ValidationResult tryEval(const std::string& source, int index, const std::string& code, const std::string& lang, |
| 166 | EvalState& state) |