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

Function GetUnitById

engine/Poseidon/Game/Commands/GameStateExtWorld.cpp:1412–1435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1410}
1411
1412GameValue GetUnitById(const GameState* state, GameValuePar oper1)
1413{
1414 const GameArrayType& array = oper1;
1415 if (!CheckSize(state, array, 2))
1416 {
1417 return OBJECT_NULL;
1418 }
1419 if (!CheckType(state, array[0], GameString))
1420 {
1421 return OBJECT_NULL;
1422 }
1423 if (!CheckType(state, array[1], GameScalar))
1424 {
1425 return OBJECT_NULL;
1426 }
1427
1428 GameStringType name = array[0];
1429
1430 RString netId = Format("%s:%d", name.Data(), toInt((float)array[1]));
1431 ;
1432 NetworkObject* obj = NetIdToNetObj(netId);
1433 Object* ret = dynamic_cast<Object*>(obj);
1434 return GameValueExt(ret);
1435}
1436
1437static RString ConfigFullName(RString filename)
1438{

Callers

nothing calls this directly

Calls 7

CheckSizeFunction · 0.85
CheckTypeFunction · 0.85
NetIdToNetObjFunction · 0.85
GameValueExtClass · 0.85
FormatFunction · 0.50
toIntFunction · 0.50
DataMethod · 0.45

Tested by

no test coverage detected