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

Function ListSub

engine/Evaluator/express.cpp:476–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474}
475
476static GameValue ListSub(const GameState* state, GameValuePar oper1, GameValuePar oper2)
477{
478 // make return object to avoid unneccessary copy
479 GameValue retValue(new GameDataArray);
480 GameArrayType& ret = retValue;
481
482 const GameArrayType& op1 = oper1;
483 const GameArrayType& op2 = oper2;
484 ret.Realloc(op1.Size());
485
486 for (int i = 0; i < op1.Size(); i++)
487 {
488 // check if it is member of op2
489 bool isInOp2 = false;
490 for (int j = 0; j < op2.Size(); j++)
491 {
492 if (op1[i].IsEqualTo(op2[j]))
493 {
494 isInOp2 = true;
495 break;
496 }
497 }
498 if (isInOp2)
499 {
500 continue;
501 }
502 // if not, add it to returned list
503 ret.Add(op1[i]);
504 }
505 return retValue;
506}
507
508static GameValue BoolAnd(const GameState* state, GameValuePar oper1, GameValuePar oper2)
509{

Callers

nothing calls this directly

Calls 4

ReallocMethod · 0.45
SizeMethod · 0.45
IsEqualToMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected