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

Function GetUnits

engine/Poseidon/Game/Commands/GameStateExtGrp.cpp:1060–1102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1058}
1059
1060static AIGroup* GetUnits(const GameState* state, GameValuePar oper1, PackedBoolArray& list)
1061{
1062 if (oper1.GetType() == GameObject)
1063 {
1064 AIUnit* unit = GetUnit(state, oper1);
1065 if (!unit)
1066 {
1067 return nullptr;
1068 }
1069 AIGroup* grp = unit->GetGroup();
1070 if (!grp)
1071 {
1072 return nullptr;
1073 }
1074 list.Set(unit->ID() - 1, true);
1075 return grp;
1076 }
1077 else
1078 {
1079 const GameArrayType& array = oper1;
1080 AIGroup* grp = nullptr;
1081 for (int i = 0; i < array.Size(); i++)
1082 {
1083 AIUnit* unit = GetUnit(state, array[i]);
1084 if (!unit)
1085 {
1086 continue;
1087 }
1088 AIGroup* g = unit->GetGroup();
1089 if (!g)
1090 {
1091 continue;
1092 }
1093 if (grp && g != grp)
1094 {
1095 continue; // different group
1096 }
1097 grp = g;
1098 list.Set(unit->ID() - 1, true);
1099 }
1100 return grp;
1101 }
1102}
1103
1104GameValue VehDone(const GameState* state, GameValuePar oper1)
1105{

Callers 7

VehDoneFunction · 0.85
VehMoveFunction · 0.85
VehFireFunction · 0.85
VehStopFunction · 0.85
VehFollowFunction · 0.85
VehWatchFunction · 0.85
VehTargetFunction · 0.85

Calls 6

GetUnitFunction · 0.85
GetTypeMethod · 0.45
GetGroupMethod · 0.45
SetMethod · 0.45
IDMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected