本文整理汇总了C++中Ship::FleetID方法的典型用法代码示例。如果您正苦于以下问题:C++ Ship::FleetID方法的具体用法?C++ Ship::FleetID怎么用?C++ Ship::FleetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ship
的用法示例。
在下文中一共展示了Ship::FleetID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddShip
void Fleet::AddShip(int ship_id) {
if (this->Contains(ship_id)) {
Logger().debugStream() << "Fleet::AddShip this fleet '" << this->Name() << "' already contained ship '" << ship_id << "'";
return;
}
Ship* ship = GetShip(ship_id);
if (!ship) {
Logger().errorStream() << "Fleet::AddShips() : Attempted to add an id (" << ship_id << ") of a non-ship object to a fleet.";
return;
}
//Logger().debugStream() << "Fleet '" << this->Name() << "' adding ship: " << ship_id;
// remove ship from old fleet
if (Fleet* old_fleet = GetFleet(ship->FleetID()))
old_fleet->RemoveShip(ship_id);
// ensure ship is in same system as this fleet
int ship_system_id = ship->SystemID();
int this_fleet_system_id = this->SystemID();
if (ship_system_id != this_fleet_system_id)
if (System* system = GetSystem(this_fleet_system_id))
system->Insert(ship); // sets ship's system, remove from old system (if any) and moves ship to system's location (if necessary)
// add ship to this fleet, and set its internal fleet record
ship->SetFleetID(ID());
m_ships.insert(ship_id);
RecalculateFleetSpeed();
StateChangedSignal();
}
示例2: RedoPlacementsButtonClicked
void CombatSetupWnd::RedoPlacementsButtonClicked() {
const GG::Pt row_size = ListRowSize();
for (std::map<int, Ogre::SceneNode*>::iterator it = m_placed_nodes.begin();
it != m_placed_nodes.end();
++it) {
Ship* ship = *Ogre::any_cast<Ship*>(&it->second->getUserAny());
UniverseObject* o = m_combat_universe[ship->FleetID()];
Fleet* fleet = boost::polymorphic_downcast<Fleet*>(o);
ShipRow* row = new ShipRow(ship, fleet, row_size.x, row_size.y);
m_listbox->Insert(row);
m_remove_ship(it->first);
}
m_placed_nodes.clear();
}