| 1017 | } |
| 1018 | |
| 1019 | static GameValue ListCountCond(const GameState* state, GameValuePar oper1, GameValuePar oper2) |
| 1020 | { |
| 1021 | GameVarSpace local(state->GetContext()); |
| 1022 | int count = 0; |
| 1023 | state->BeginContext(&local); |
| 1024 | RString expression = oper1; |
| 1025 | const GameArrayType& array = oper2; |
| 1026 | for (int i = 0; i < array.Size(); i++) |
| 1027 | { |
| 1028 | const GameValue& val = array[i]; |
| 1029 | // set local varible - will be deleted on EndContext |
| 1030 | state->VarSetLocal("_x", val, true); |
| 1031 | if (state->EvaluateBool(expression)) |
| 1032 | { |
| 1033 | count++; |
| 1034 | } |
| 1035 | if (state->GetLastError()) |
| 1036 | { |
| 1037 | state->EndContext(); |
| 1038 | return GameValue(); |
| 1039 | } |
| 1040 | } |
| 1041 | state->EndContext(); |
| 1042 | return (float)count; |
| 1043 | } |
| 1044 | |
| 1045 | static GameValue ListForEach(const GameState* state, GameValuePar oper1, GameValuePar oper2) |
| 1046 | { |
nothing calls this directly
no test coverage detected