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

Function WriteUnit

engine/Poseidon/UI/Map/UIMapExtDisplay.cpp:1511–1557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1509 }
1510}
1511
1512static void WriteUnit(QOStream& out, RString grpName, const ArcadeUnitInfo& unit, EditorObjectType& typeUnit,
1513 AutoArray<MarkerInfo>& markerMap, AutoArray<VehicleInfo>& vehicleMap)
1514{
1515 // free soldier
1516 Arguments args;
1517
1518 RString condition = CreateCondition(unit.presenceCondition, unit.presence);
1519 args.Set("PRESENCE_CONDITION", condition);
1520 args.Set("POSITION", unit.position);
1521 args.Set("GROUP", grpName);
1522 args.Set("TYPE", unit.vehicle);
1523 for (int i = 0; i < unit.markers.Size(); i++)
1524 for (int j = 0; j < markerMap.Size(); j++)
1525 if (markerMap[j].name == unit.markers[i])
1526 {
1527 args.Set("MARKER", markerMap[j].variable);
1528 break;
1529 }
1530 args.Set("PLACEMENT", unit.placement);
1531 args.Set("SPECIAL", unit.special);
1532 args.Set("AZIMUT", unit.azimut);
1533 args.Set("NAME", unit.name);
1534 args.Set("HEALTH", unit.health);
1535 args.Set("AMMO", unit.ammo);
1536 args.Set("ID", unit.id);
1537 args.Set("AGE", unit.age);
1538 args.Set("INIT", unit.init);
1539 args.Set("RANK", unit.rank);
1540 args.Set("SKILL", unit.skill);
1541
1542 RString varName = typeUnit.NextVarName();
1543 args.Set("VARIABLE_NAME", varName);
1544
1545 if (unit.player == APPlayerCommander)
1546 args.Set("PLAYER", varName);
1547 if (unit.leader)
1548 args.Set("LEADER", grpName);
1549
1550 typeUnit.WriteToScript(out, args);
1551
1552 if (unit.id >= 0)
1553 {
1554 int index = vehicleMap.Add();
1555 vehicleMap[index].id = unit.id;
1556 vehicleMap[index].variable = varName;
1557 }
1558}
1559
1560static void WriteUnit(QOStream& out, EditorObjectType& typeUnit, RString type, RString grpName, Vector3Par position,

Callers 1

ExportMissionFunction · 0.85

Calls 8

CreateConditionFunction · 0.85
NextVarNameMethod · 0.80
WriteToScriptMethod · 0.80
FormatFunction · 0.50
RStringClass · 0.50
SetMethod · 0.45
SizeMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected