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

Function ListForEach

engine/Evaluator/express.cpp:1045–1065  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1043}
1044
1045static GameValue ListForEach(const GameState* state, GameValuePar oper1, GameValuePar oper2)
1046{
1047 GameVarSpace local(state->GetContext());
1048 state->BeginContext(&local);
1049 RString expression = oper1;
1050 const GameArrayType& array = oper2;
1051 for (int i = 0; i < array.Size(); i++)
1052 {
1053 const GameValue& val = array[i];
1054 // set local varible - will be deleted on EndContext
1055 state->VarSetLocal("_x", val, true);
1056 const_cast<GameState*>(state)->Execute(expression);
1057 if (state->GetLastError())
1058 {
1059 state->EndContext();
1060 return GameValue();
1061 }
1062 }
1063 state->EndContext();
1064 return NOTHING;
1065}
1066
1067static GameValue ListIsIn(const GameState* state, GameValuePar oper1, GameValuePar oper2)
1068{

Callers

nothing calls this directly

Calls 8

BeginContextMethod · 0.80
VarSetLocalMethod · 0.80
GetLastErrorMethod · 0.80
EndContextMethod · 0.80
GameValueClass · 0.70
GetContextMethod · 0.45
SizeMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected