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

Function VehWatch

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

Source from the content-addressed store, hash-verified

1284DEFINE_COMMAND(Follow)
1285
1286GameValue VehWatch(const GameState* state, GameValuePar oper1, GameValuePar oper2, bool silent)
1287{
1288 PackedBoolArray list;
1289 AIGroup* grp = GetUnits(state, oper1, list);
1290 if (!grp)
1291 {
1292 return NOTHING;
1293 }
1294 Vector3 pos;
1295 Target* tgt = nullptr;
1296 Object* obj = nullptr;
1297 bool noTgt = false;
1298 if (oper2.GetType() == GameObject)
1299 {
1300 obj = GetObject(oper2);
1301 if (!obj)
1302 {
1303 noTgt = true;
1304 }
1305 else
1306 {
1307 EntityAI* veh = dyn_cast<EntityAI>(obj);
1308 if (!veh)
1309 {
1310 pos = obj->Position();
1311 }
1312 else
1313 {
1314 tgt = FindTargetReveal(grp, veh);
1315 if (!tgt)
1316 {
1317 pos = obj->Position();
1318 }
1319 }
1320 }
1321 }
1322 else if (!GetPos(state, pos, oper2))
1323 {
1324 return NOTHING;
1325 }
1326 if (noTgt)
1327 {
1328 grp->SendState(new RadioMessageWatchAuto(grp, list), silent);
1329 }
1330 else if (tgt)
1331 {
1332 grp->SendState(new RadioMessageWatchTgt(grp, list, tgt), silent);
1333 }
1334 else
1335 {
1336 grp->SendState(new RadioMessageWatchPos(grp, list, pos), silent);
1337 }
1338 return NOTHING;
1339}
1340
1341DEFINE_COMMAND(Watch)
1342

Callers

nothing calls this directly

Calls 7

GetUnitsFunction · 0.85
FindTargetRevealFunction · 0.85
GetPosFunction · 0.85
SendStateMethod · 0.80
GetObjectFunction · 0.70
GetTypeMethod · 0.45
PositionMethod · 0.45

Tested by

no test coverage detected