Hex::Hex(int id, const MapPos& pos, int nRotation) : m_id(id), m_pos(pos), m_nRotation(nRotation), m_discovery(DiscoveryType::None), m_colour(Colour::None), m_pDef(&HexDefs::Get(id)), m_bOrbital(false), m_bMonolith(false) { VERIFY_MODEL_MSG("Invalid rotation", nRotation >= 0 && nRotation < 6); for (int i = 0; i < GetDef().GetAncients(); ++i) AddShip(ShipType::Ancient, Colour::None); InitSquares(); }
void UFlareFleet::Merge(UFlareFleet* Fleet) { FText Unused; if (!CanMerge(Fleet, Unused)) { FLOGV("Fleet Merge fail: '%s' is not mergeable", *Fleet->GetFleetName().ToString()); return; } TArray<UFlareSimulatedSpacecraft*> Ships = Fleet->GetShips(); Fleet->Disband(); for (int ShipIndex = 0; ShipIndex < Ships.Num(); ShipIndex++) { AddShip(Ships[ShipIndex]); } }
void Ships::LoadShips(std::string filename) { std::shared_ptr<Node> ship_node = SkexmlParser::Parse(filename); auto children = ship_node->GetChildren(); for(auto child : children) { std::string ship_name = child.first; std::string ship_id = child.second->GetAttribute("ID"); std::string ship_health = child.second->GetAttribute("Health"); std::string ship_shields = child.second->GetAttribute("Shields"); std::string ship_template = child.second->GetAttribute("Template"); int id = atoi(ship_id.c_str()); int health = atoi(ship_health.c_str()); int shields = atoi(ship_shields.c_str()); std::shared_ptr<Ship> ship = BuildShip(GameData::SHIP_PATH + ship_template + ".sml", id, ship_name, health, shields); AddShip(ship); } }