| 1509 | } |
| 1510 | } |
| 1511 | |
| 1512 | static 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 | |
| 1560 | static void WriteUnit(QOStream& out, EditorObjectType& typeUnit, RString type, RString grpName, Vector3Par position, |
no test coverage detected