|
@@ -424,13 +424,13 @@ void Station::UpdateVirtCoord()
|
|
|
if ((this->facilities & FACIL_AIRPORT) && this->airport_type == AT_OILRIG) pt.y -= 16;
|
|
|
|
|
|
SetDParam(0, this->index);
|
|
|
SetDParam(1, this->facilities);
|
|
|
this->sign.UpdatePosition(pt.x, pt.y, STR_VIEWPORT_STATION);
|
|
|
|
|
|
InvalidateWindow(WC_STATION_VIEW, this->index);
|
|
|
SetWindowDirty(WC_STATION_VIEW, this->index);
|
|
|
}
|
|
|
|
|
|
/** Update the virtual coords needed to draw the station sign for all stations. */
|
|
|
void UpdateAllStationVirtCoords()
|
|
|
{
|
|
|
BaseStation *st;
|
|
@@ -618,13 +618,13 @@ void UpdateStationAcceptance(Station *st
|
|
|
/* Show news message if there are any changes */
|
|
|
if (num_acc > 0) ShowRejectOrAcceptNews(st, num_acc, accepts, accept_msg[num_acc - 1]);
|
|
|
if (num_rej > 0) ShowRejectOrAcceptNews(st, num_rej, rejects, reject_msg[num_rej - 1]);
|
|
|
}
|
|
|
|
|
|
/* redraw the station view since acceptance changed */
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ACCEPTLIST);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ACCEPTLIST);
|
|
|
}
|
|
|
|
|
|
static void UpdateStationSignCoord(BaseStation *st)
|
|
|
{
|
|
|
const StationRect *r = &st->rect;
|
|
|
|
|
@@ -1150,13 +1150,13 @@ CommandCost CmdBuildRailStation(TileInde
|
|
|
st->MarkTilesDirty(false);
|
|
|
st->UpdateVirtCoord();
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
st->RecomputeIndustriesNear();
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
}
|
|
|
|
|
|
return cost;
|
|
|
}
|
|
|
|
|
|
static void MakeRailStationAreaSmaller(BaseStation *st)
|
|
@@ -1307,13 +1307,13 @@ CommandCost RemoveFromRailBaseStation(Ti
|
|
|
MakeRailStationAreaSmaller(st);
|
|
|
UpdateStationSignCoord(st);
|
|
|
|
|
|
/* if we deleted the whole station, delete the train facility. */
|
|
|
if (st->train_station.tile == INVALID_TILE) {
|
|
|
st->facilities &= ~FACIL_TRAIN;
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
st->UpdateVirtCoord();
|
|
|
DeleteStationIfEmpty(st);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
total_cost.AddCost(quantity * removal_cost);
|
|
@@ -1342,13 +1342,13 @@ CommandCost CmdRemoveFromRailStation(Til
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
|
/* Do all station specific functions here. */
|
|
|
for (Station **stp = affected_stations.Begin(); stp != affected_stations.End(); stp++) {
|
|
|
Station *st = *stp;
|
|
|
|
|
|
if (st->train_station.tile == INVALID_TILE) InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
st->MarkTilesDirty(false);
|
|
|
st->RecomputeIndustriesNear();
|
|
|
}
|
|
|
|
|
|
/* Now apply the rail cost to the number that we deleted */
|
|
|
return ret;
|
|
@@ -1430,13 +1430,13 @@ CommandCost RemoveRailStation(T *st, DoC
|
|
|
|
|
|
free(st->speclist);
|
|
|
st->num_specs = 0;
|
|
|
st->speclist = NULL;
|
|
|
st->cached_anim_triggers = 0;
|
|
|
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
|
|
|
st->UpdateVirtCoord();
|
|
|
DeleteStationIfEmpty(st);
|
|
|
}
|
|
|
|
|
|
return cost;
|
|
|
}
|
|
@@ -1633,13 +1633,13 @@ CommandCost CmdBuildRoadStop(TileIndex t
|
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
st->RecomputeIndustriesNear();
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
|
|
|
}
|
|
|
return cost;
|
|
|
}
|
|
|
|
|
|
|
|
|
static Vehicle *ClearRoadStopStatusEnum(Vehicle *v, void *)
|
|
@@ -1698,13 +1698,13 @@ static CommandCost RemoveRoadStop(TileIn
|
|
|
/* tell the predecessor in the list to skip this stop */
|
|
|
RoadStop *pred = *primary_stop;
|
|
|
while (pred->next != cur_stop) pred = pred->next;
|
|
|
pred->next = cur_stop->next;
|
|
|
}
|
|
|
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
|
|
|
delete cur_stop;
|
|
|
|
|
|
/* Make sure no vehicle is going to the old roadstop */
|
|
|
RoadVehicle *v;
|
|
|
FOR_ALL_ROADVEHICLES(v) {
|
|
|
if (v->First() == v && v->current_order.IsType(OT_GOTO_STATION) &&
|
|
@@ -1998,16 +1998,16 @@ CommandCost CmdBuildAirport(TileIndex ti
|
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
st->RecomputeIndustriesNear();
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES);
|
|
|
|
|
|
if (_settings_game.economy.station_noise_level) {
|
|
|
InvalidateWindow(WC_TOWN_VIEW, st->town->index);
|
|
|
SetWindowDirty(WC_TOWN_VIEW, st->town->index);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return cost;
|
|
|
}
|
|
|
|
|
@@ -2063,16 +2063,16 @@ static CommandCost RemoveAirport(TileInd
|
|
|
|
|
|
st->rect.AfterRemoveRect(st, tile, w, h);
|
|
|
|
|
|
st->airport_tile = INVALID_TILE;
|
|
|
st->facilities &= ~FACIL_AIRPORT;
|
|
|
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES);
|
|
|
|
|
|
if (_settings_game.economy.station_noise_level) {
|
|
|
InvalidateWindow(WC_TOWN_VIEW, st->town->index);
|
|
|
SetWindowDirty(WC_TOWN_VIEW, st->town->index);
|
|
|
}
|
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
st->RecomputeIndustriesNear();
|
|
|
DeleteStationIfEmpty(st);
|
|
|
}
|
|
@@ -2208,13 +2208,13 @@ CommandCost CmdBuildDock(TileIndex tile,
|
|
|
|
|
|
st->UpdateVirtCoord();
|
|
|
UpdateStationAcceptance(st, false);
|
|
|
st->RecomputeIndustriesNear();
|
|
|
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
|
|
|
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_SHIPS);
|
|
|
}
|
|
|
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price.build_dock);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2243,13 +2243,13 @@ static CommandCost RemoveDock(TileIndex
|
|
|
|
|
|
MarkTileDirtyByTile(tile2);
|
|
|
|
|
|
st->dock_tile = INVALID_TILE;
|
|
|
st->facilities &= ~FACIL_DOCK;
|
|
|
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS);
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_SHIPS);
|
|
|
st->UpdateVirtCoord();
|
|
|
st->RecomputeIndustriesNear();
|
|
|
DeleteStationIfEmpty(st);
|
|
|
}
|
|
|
|
|
|
return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_dock);
|
|
@@ -2820,15 +2820,15 @@ static void UpdateStationRating(Station
|
|
|
}
|
|
|
}
|
|
|
} while (++ge != endof(st->goods));
|
|
|
|
|
|
StationID index = st->index;
|
|
|
if (waiting_changed) {
|
|
|
InvalidateWindow(WC_STATION_VIEW, index); // update whole window
|
|
|
SetWindowDirty(WC_STATION_VIEW, index); // update whole window
|
|
|
} else {
|
|
|
InvalidateWindowWidget(WC_STATION_VIEW, index, SVW_RATINGLIST); // update only ratings list
|
|
|
SetWindowWidgetDirty(WC_STATION_VIEW, index, SVW_RATINGLIST); // update only ratings list
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* called for every station each tick */
|
|
|
static void StationHandleSmallTick(BaseStation *st)
|
|
|
{
|
|
@@ -2888,13 +2888,13 @@ static void UpdateStationWaiting(Station
|
|
|
{
|
|
|
st->goods[type].cargo.Append(new CargoPacket(st->index, amount, source_type, source_id));
|
|
|
SetBit(st->goods[type].acceptance_pickup, GoodsEntry::PICKUP);
|
|
|
|
|
|
StationAnimationTrigger(st, st->xy, STAT_ANIM_NEW_CARGO, type);
|
|
|
|
|
|
InvalidateWindow(WC_STATION_VIEW, st->index);
|
|
|
SetWindowDirty(WC_STATION_VIEW, st->index);
|
|
|
st->MarkTilesDirty(true);
|
|
|
}
|
|
|
|
|
|
static bool IsUniqueStationName(const char *name)
|
|
|
{
|
|
|
const Station *st;
|