MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / needsGameObjects

Function needsGameObjects

engine/Evaluator/Validate.cpp:133–163  ·  view source on GitHub ↗

Commands that need game engine objects and can't be evaluated standalone

Source from the content-addressed store, hash-verified

131
132// Commands that need game engine objects and can't be evaluated standalone
133static 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
165static ValidationResult tryEval(const std::string& source, int index, const std::string& code, const std::string& lang,
166 EvalState& state)

Callers 1

tryEvalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected