本文整理汇总了C++中Aircraft::IsNormalAircraft方法的典型用法代码示例。如果您正苦于以下问题:C++ Aircraft::IsNormalAircraft方法的具体用法?C++ Aircraft::IsNormalAircraft怎么用?C++ Aircraft::IsNormalAircraft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aircraft
的用法示例。
在下文中一共展示了Aircraft::IsNormalAircraft方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Clean up a station by clearing vehicle orders and invalidating windows.
* Aircraft-Hangar orders need special treatment here, as the hangars are
* actually part of a station (tiletype is STATION), but the order type
* is OT_GOTO_DEPOT.
*/
Station::~Station()
{
if (CleaningPool()) {
for (CargoID c = 0; c < NUM_CARGO; c++) {
this->goods[c].cargo.OnCleanPool();
}
return;
}
while (!this->loading_vehicles.empty()) {
this->loading_vehicles.front()->LeaveStation();
}
Aircraft *a;
FOR_ALL_AIRCRAFT(a) {
if (!a->IsNormalAircraft()) continue;
if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
}
Vehicle *v;
FOR_ALL_VEHICLES(v) {
/* Forget about this station if this station is removed */
if (v->last_station_visited == this->index) {
v->last_station_visited = INVALID_STATION;
}
}
/* Clear the persistent storage. */
delete this->airport.psa;
if (this->owner == OWNER_NONE) {
/* Invalidate all in case of oil rigs. */
InvalidateWindowClassesData(WC_STATION_LIST, 0);
} else {
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
}
DeleteWindowById(WC_STATION_VIEW, index);
/* Now delete all orders that go to the station */
RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
/* Remove all news items */
DeleteStationNews(this->index);
for (CargoID c = 0; c < NUM_CARGO; c++) {
this->goods[c].cargo.Truncate(0);
}
CargoPacket::InvalidateAllFrom(this->index);
}
示例2:
/**
* Clean up a station by clearing vehicle orders and invalidating windows.
* Aircraft-Hangar orders need special treatment here, as the hangars are
* actually part of a station (tiletype is STATION), but the order type
* is OT_GOTO_DEPOT.
*/
Station::~Station()
{
if (CleaningPool()) return;
while (!this->loading_vehicles.empty()) {
this->loading_vehicles.front()->LeaveStation();
}
Aircraft *a;
FOR_ALL_AIRCRAFT(a) {
if (!a->IsNormalAircraft()) continue;
if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
}
Vehicle *v;
FOR_ALL_VEHICLES(v) {
/* Forget about this station if this station is removed */
if (v->last_station_visited == this->index) {
v->last_station_visited = INVALID_STATION;
}
}
this->sign.MarkDirty();
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
DeleteWindowById(WC_STATION_VIEW, index);
WindowNumber wno = (this->index << 16) | VLW_STATION_LIST | this->owner;
DeleteWindowById(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11));
DeleteWindowById(WC_ROADVEH_LIST, wno | (VEH_ROAD << 11));
DeleteWindowById(WC_SHIPS_LIST, wno | (VEH_SHIP << 11));
DeleteWindowById(WC_AIRCRAFT_LIST, wno | (VEH_AIRCRAFT << 11));
/* Now delete all orders that go to the station */
RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
/* Remove all news items */
DeleteStationNews(this->index);
for (CargoID c = 0; c < NUM_CARGO; c++) {
this->goods[c].cargo.Truncate(0);
}
CargoPacket::InvalidateAllFrom(this->index);
}
示例3: UpdateOldAircraft
/** need to be called to load aircraft from old version */
void UpdateOldAircraft()
{
/* set airport_flags to 0 for all airports just to be sure */
Station *st;
FOR_ALL_STATIONS(st) {
st->airport.flags = 0; // reset airport
}
Aircraft *a;
FOR_ALL_AIRCRAFT(a) {
/* airplane has another vehicle with subtype 4 (shadow), helicopter also has 3 (rotor)
* skip those */
if (a->IsNormalAircraft()) {
/* airplane in terminal stopped doesn't hurt anyone, so goto next */
if ((a->vehstatus & VS_STOPPED) && a->state == 0) {
a->state = HANGAR;
continue;
}
AircraftLeaveHangar(a, a->direction); // make airplane visible if it was in a depot for example
a->vehstatus &= ~VS_STOPPED; // make airplane moving
UpdateAircraftCache(a);
a->cur_speed = a->vcache.cached_max_speed; // so aircraft don't have zero speed while in air
if (!a->current_order.IsType(OT_GOTO_STATION) && !a->current_order.IsType(OT_GOTO_DEPOT)) {
/* reset current order so aircraft doesn't have invalid "station-only" order */
a->current_order.MakeDummy();
}
a->state = FLYING;
AircraftNextAirportPos_and_Order(a); // move it to the entry point of the airport
GetNewVehiclePosResult gp = GetNewVehiclePos(a);
a->tile = 0; // aircraft in air is tile=0
/* correct speed of helicopter-rotors */
if (a->subtype == AIR_HELICOPTER) a->Next()->Next()->cur_speed = 32;
/* set new position x,y,z */
SetAircraftPosition(a, gp.x, gp.y, GetAircraftFlyingAltitude(a));
}
}
}
示例4:
/**
* Clean up a station by clearing vehicle orders, invalidating windows and
* removing link stats.
* Aircraft-Hangar orders need special treatment here, as the hangars are
* actually part of a station (tiletype is STATION), but the order type
* is OT_GOTO_DEPOT.
*/
Station::~Station()
{
if (CleaningPool()) {
for (CargoID c = 0; c < NUM_CARGO; c++) {
this->goods[c].cargo.OnCleanPool();
}
return;
}
while (!this->loading_vehicles.empty()) {
this->loading_vehicles.front()->LeaveStation();
}
Aircraft *a;
FOR_ALL_AIRCRAFT(a) {
if (!a->IsNormalAircraft()) continue;
if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
}
for (CargoID c = 0; c < NUM_CARGO; ++c) {
LinkGraph *lg = LinkGraph::GetIfValid(this->goods[c].link_graph);
if (lg == NULL) continue;
for (NodeID node = 0; node < lg->Size(); ++node) {
Station *st = Station::Get((*lg)[node].Station());
st->goods[c].flows.erase(this->index);
if ((*lg)[node][this->goods[c].node].LastUpdate() != INVALID_DATE) {
st->goods[c].flows.DeleteFlows(this->index);
RerouteCargo(st, c, this->index, st->index);
}
}
lg->RemoveNode(this->goods[c].node);
if (lg->Size() == 0) {
LinkGraphSchedule::instance.Unqueue(lg);
delete lg;
}
}
Vehicle *v;
FOR_ALL_VEHICLES(v) {
/* Forget about this station if this station is removed */
if (v->last_station_visited == this->index) {
v->last_station_visited = INVALID_STATION;
}
if (v->last_loading_station == this->index) {
v->last_loading_station = INVALID_STATION;
}
}
/* Clear the persistent storage. */
delete this->airport.psa;
if (this->owner == OWNER_NONE) {
/* Invalidate all in case of oil rigs. */
InvalidateWindowClassesData(WC_STATION_LIST, 0);
} else {
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
}
if (Overlays::Instance()->HasStation(Station::Get(this->index))) {
Overlays::Instance()->ToggleStation(Station::Get(this->index));
};
DeleteWindowById(WC_STATION_VIEW, index);
/* Now delete all orders that go to the station */
RemoveOrderFromAllVehicles(OT_GOTO_STATION, this->index);
/* Remove all news items */
DeleteStationNews(this->index);
for (CargoID c = 0; c < NUM_CARGO; c++) {
this->goods[c].cargo.Truncate();
}
CargoPacket::InvalidateAllFrom(this->index);
}