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

Method VarGet

engine/Evaluator/express.cpp:2406–2440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2404}
2405
2406GameValue GameState::VarGet(const char* name) const
2407{
2408 // convert name to lower case
2409 RString source = name;
2410 source.Lower();
2411
2412 // first try to find local variable
2413 const GameVarSpace* space = _e->local;
2414 if (space)
2415 {
2416 GameValue ret;
2417 bool found = space->VarGet(source, ret);
2418 if (found)
2419 {
2420 return ret;
2421 }
2422 }
2423 else
2424 {
2425 if (source[0] == '_')
2426 {
2427 SetError(EvalNamespace);
2428 return GameValueNil();
2429 }
2430 }
2431
2432 const GameVariable& var = _vars[source];
2433 if (NotNull(var))
2434 {
2435 // get variable value
2436 return var._value;
2437 }
2438
2439 return GameValueNil();
2440}
2441
2442bool GameState::IsVisible(const GameVariable& var) const
2443{

Calls 2

LowerMethod · 0.80
SetErrorFunction · 0.50

Tested by

no test coverage detected