Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+35
-32
@@ -55,10 +55,10 @@ BaseStation::~BaseStation()
|
||||
{
|
||||
if (CleaningPool()) return;
|
||||
|
||||
CloseWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->index).Pack());
|
||||
CloseWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->index).Pack());
|
||||
CloseWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->index).Pack());
|
||||
CloseWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->index).Pack());
|
||||
CloseWindowById(WC_TRAINS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_TRAIN, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WC_ROADVEH_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_ROAD, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WC_SHIPS_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_SHIP, this->owner, this->index).ToWindowNumber());
|
||||
CloseWindowById(WC_AIRCRAFT_LIST, VehicleListIdentifier(VL_STATION_LIST, VEH_AIRCRAFT, this->owner, this->index).ToWindowNumber());
|
||||
|
||||
this->sign.MarkDirty();
|
||||
}
|
||||
@@ -97,7 +97,8 @@ Station::~Station()
|
||||
|
||||
if (CleaningPool()) {
|
||||
for (GoodsEntry &ge : this->goods) {
|
||||
ge.cargo.OnCleanPool();
|
||||
if (!ge.HasData()) continue;
|
||||
ge.GetData().cargo.OnCleanPool();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -108,22 +109,23 @@ Station::~Station()
|
||||
|
||||
for (Aircraft *a : Aircraft::Iterate()) {
|
||||
if (!a->IsNormalAircraft()) continue;
|
||||
if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
|
||||
if (a->targetairport == this->index) a->targetairport = StationID::Invalid();
|
||||
}
|
||||
|
||||
for (CargoID c = 0; c < NUM_CARGO; ++c) {
|
||||
LinkGraph *lg = LinkGraph::GetIfValid(this->goods[c].link_graph);
|
||||
for (CargoType cargo = 0; cargo < NUM_CARGO; ++cargo) {
|
||||
LinkGraph *lg = LinkGraph::GetIfValid(this->goods[cargo].link_graph);
|
||||
if (lg == nullptr) 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].HasEdgeTo(this->goods[c].node) && (*lg)[node][this->goods[c].node].LastUpdate() != EconomyTime::INVALID_DATE) {
|
||||
st->goods[c].flows.DeleteFlows(this->index);
|
||||
RerouteCargo(st, c, this->index, st->index);
|
||||
if (!st->goods[cargo].HasData()) continue;
|
||||
st->goods[cargo].GetData().flows.erase(this->index);
|
||||
if ((*lg)[node].HasEdgeTo(this->goods[cargo].node) && (*lg)[node][this->goods[cargo].node].LastUpdate() != EconomyTime::INVALID_DATE) {
|
||||
st->goods[cargo].GetData().flows.DeleteFlows(this->index);
|
||||
RerouteCargo(st, cargo, this->index, st->index);
|
||||
}
|
||||
}
|
||||
lg->RemoveNode(this->goods[c].node);
|
||||
lg->RemoveNode(this->goods[cargo].node);
|
||||
if (lg->Size() == 0) {
|
||||
LinkGraphSchedule::instance.Unqueue(lg);
|
||||
delete lg;
|
||||
@@ -133,10 +135,10 @@ Station::~Station()
|
||||
for (Vehicle *v : Vehicle::Iterate()) {
|
||||
/* Forget about this station if this station is removed */
|
||||
if (v->last_station_visited == this->index) {
|
||||
v->last_station_visited = INVALID_STATION;
|
||||
v->last_station_visited = StationID::Invalid();
|
||||
}
|
||||
if (v->last_loading_station == this->index) {
|
||||
v->last_loading_station = INVALID_STATION;
|
||||
v->last_loading_station = StationID::Invalid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +164,8 @@ Station::~Station()
|
||||
DeleteStationNews(this->index);
|
||||
|
||||
for (GoodsEntry &ge : this->goods) {
|
||||
ge.cargo.Truncate();
|
||||
if (!ge.HasData()) continue;
|
||||
ge.GetData().cargo.Truncate();
|
||||
}
|
||||
|
||||
CargoPacket::InvalidateAllFrom(this->index);
|
||||
@@ -217,7 +220,7 @@ void BaseStation::RemoveRoadStopTileData(TileIndex tile)
|
||||
*/
|
||||
RoadStop *Station::GetPrimaryRoadStop(const RoadVehicle *v) const
|
||||
{
|
||||
RoadStop *rs = this->GetPrimaryRoadStop(v->IsBus() ? ROADSTOP_BUS : ROADSTOP_TRUCK);
|
||||
RoadStop *rs = this->GetPrimaryRoadStop(v->IsBus() ? RoadStopType::Bus : RoadStopType::Truck);
|
||||
|
||||
for (; rs != nullptr; rs = rs->next) {
|
||||
/* The vehicle cannot go to this roadstop (different roadtype) */
|
||||
@@ -238,11 +241,11 @@ RoadStop *Station::GetPrimaryRoadStop(const RoadVehicle *v) const
|
||||
*/
|
||||
void Station::AddFacility(StationFacility new_facility_bit, TileIndex facil_xy)
|
||||
{
|
||||
if (this->facilities == FACIL_NONE) {
|
||||
if (this->facilities == StationFacilities{}) {
|
||||
this->MoveSign(facil_xy);
|
||||
this->random_bits = Random();
|
||||
}
|
||||
this->facilities |= new_facility_bit;
|
||||
this->facilities.Set(new_facility_bit);
|
||||
this->owner = _current_company;
|
||||
this->build_date = TimerGameCalendar::date;
|
||||
SetWindowClassesDirty(WC_VEHICLE_ORDERS);
|
||||
@@ -323,24 +326,24 @@ static uint GetTileCatchmentRadius(TileIndex tile, const Station *st)
|
||||
|
||||
if (_settings_game.station.modified_catchment) {
|
||||
switch (GetStationType(tile)) {
|
||||
case STATION_RAIL: return CA_TRAIN;
|
||||
case STATION_OILRIG: return CA_UNMODIFIED;
|
||||
case STATION_AIRPORT: return st->airport.GetSpec()->catchment;
|
||||
case STATION_TRUCK: return CA_TRUCK;
|
||||
case STATION_BUS: return CA_BUS;
|
||||
case STATION_DOCK: return CA_DOCK;
|
||||
case StationType::Rail: return CA_TRAIN;
|
||||
case StationType::Oilrig: return CA_UNMODIFIED;
|
||||
case StationType::Airport: return st->airport.GetSpec()->catchment;
|
||||
case StationType::Truck: return CA_TRUCK;
|
||||
case StationType::Bus: return CA_BUS;
|
||||
case StationType::Dock: return CA_DOCK;
|
||||
|
||||
default: NOT_REACHED();
|
||||
case STATION_BUOY:
|
||||
case STATION_WAYPOINT:
|
||||
case STATION_ROADWAYPOINT: return CA_NONE;
|
||||
case StationType::Buoy:
|
||||
case StationType::RailWaypoint:
|
||||
case StationType::RoadWaypoint: return CA_NONE;
|
||||
}
|
||||
} else {
|
||||
switch (GetStationType(tile)) {
|
||||
default: return CA_UNMODIFIED;
|
||||
case STATION_BUOY:
|
||||
case STATION_WAYPOINT:
|
||||
case STATION_ROADWAYPOINT: return CA_NONE;
|
||||
case StationType::Buoy:
|
||||
case StationType::RailWaypoint:
|
||||
case StationType::RoadWaypoint: return CA_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -724,7 +727,7 @@ Money AirportMaintenanceCost(Owner owner)
|
||||
Money total_cost = 0;
|
||||
|
||||
for (const Station *st : Station::Iterate()) {
|
||||
if (st->owner == owner && (st->facilities & FACIL_AIRPORT)) {
|
||||
if (st->owner == owner && st->facilities.Test(StationFacility::Airport)) {
|
||||
total_cost += _price[PR_INFRASTRUCTURE_AIRPORT] * st->airport.GetSpec()->maintenance_cost;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user