Merge branch 'master' into jgrpp

# Conflicts:
#	src/lang/afrikaans.txt
#	src/lang/basque.txt
#	src/lang/belarusian.txt
#	src/lang/brazilian_portuguese.txt
#	src/lang/bulgarian.txt
#	src/lang/catalan.txt
#	src/lang/croatian.txt
#	src/lang/czech.txt
#	src/lang/danish.txt
#	src/lang/dutch.txt
#	src/lang/english.txt
#	src/lang/english_AU.txt
#	src/lang/english_US.txt
#	src/lang/estonian.txt
#	src/lang/finnish.txt
#	src/lang/french.txt
#	src/lang/gaelic.txt
#	src/lang/galician.txt
#	src/lang/german.txt
#	src/lang/greek.txt
#	src/lang/hebrew.txt
#	src/lang/hungarian.txt
#	src/lang/icelandic.txt
#	src/lang/indonesian.txt
#	src/lang/irish.txt
#	src/lang/italian.txt
#	src/lang/japanese.txt
#	src/lang/korean.txt
#	src/lang/latin.txt
#	src/lang/latvian.txt
#	src/lang/lithuanian.txt
#	src/lang/luxembourgish.txt
#	src/lang/norwegian_bokmal.txt
#	src/lang/norwegian_nynorsk.txt
#	src/lang/polish.txt
#	src/lang/portuguese.txt
#	src/lang/romanian.txt
#	src/lang/russian.txt
#	src/lang/serbian.txt
#	src/lang/simplified_chinese.txt
#	src/lang/slovak.txt
#	src/lang/slovenian.txt
#	src/lang/spanish.txt
#	src/lang/spanish_MX.txt
#	src/lang/swedish.txt
#	src/lang/tamil.txt
#	src/lang/thai.txt
#	src/lang/traditional_chinese.txt
#	src/lang/turkish.txt
#	src/lang/ukrainian.txt
#	src/lang/unfinished/persian.txt
#	src/lang/vietnamese.txt
#	src/lang/welsh.txt
#	src/rail_cmd.cpp
#	src/station_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2019-02-19 19:36:30 +00:00
75 changed files with 540 additions and 560 deletions

View File

@@ -721,6 +721,43 @@ static void DeleteStationIfEmpty(BaseStation *st)
UpdateStationSignCoord(st);
}
/**
* After adding/removing tiles to station, update some station-related stuff.
* @param adding True if adding tiles, false if removing them.
* @param type StationType being modified.
*/
void Station::AfterStationTileSetChange(bool adding, StationType type)
{
this->UpdateVirtCoord();
this->RecomputeIndustriesNear();
DirtyCompanyInfrastructureWindows(this->owner);
if (adding) InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
switch (type) {
case STATION_RAIL:
SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_TRAINS);
break;
case STATION_AIRPORT:
break;
case STATION_TRUCK:
case STATION_BUS:
SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_ROADVEHS);
break;
case STATION_DOCK:
SetWindowWidgetDirty(WC_STATION_VIEW, this->index, WID_SV_SHIPS);
break;
default: NOT_REACHED();
}
if (adding) {
UpdateStationAcceptance(this, false);
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
} else {
DeleteStationIfEmpty(this);
}
}
CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags);
/**
@@ -1494,14 +1531,8 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
}
st->MarkTilesDirty(false);
st->UpdateVirtCoord();
UpdateStationAcceptance(st, false);
st->RecomputeIndustriesNear();
st->AfterStationTileSetChange(true, STATION_RAIL);
ZoningMarkDirtyStationCoverageArea(st);
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
DirtyCompanyInfrastructureWindows(st->owner);
}
return cost;
@@ -1965,7 +1996,6 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
MakeRoadStop(cur_tile, st->owner, st->index, rs_type, rts, ddir);
}
Company::Get(st->owner)->infrastructure.station++;
DirtyCompanyInfrastructureWindows(st->owner);
MarkTileDirtyByTile(cur_tile);
}
@@ -1973,12 +2003,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
}
if (st != NULL) {
st->UpdateVirtCoord();
UpdateStationAcceptance(st, false);
st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_ROADVEHS);
st->AfterStationTileSetChange(true, type ? STATION_TRUCK: STATION_BUS);
}
return cost;
}
@@ -2074,7 +2099,6 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
DoClearSquare(tile);
}
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_ROADVEHS);
delete cur_stop;
/* Make sure no vehicle is going to the old roadstop */
@@ -2088,9 +2112,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
st->rect.AfterRemoveTile(st, tile);
st->UpdateVirtCoord();
st->RecomputeIndustriesNear();
DeleteStationIfEmpty(st);
st->AfterStationTileSetChange(false, is_truck ? STATION_TRUCK: STATION_BUS);
/* Update the tile area of the truck/bus stop */
if (is_truck) {
@@ -2492,15 +2514,10 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
UpdateStationSignCoord(st);
} else {
Company::Get(st->owner)->infrastructure.airport++;
DirtyCompanyInfrastructureWindows(st->owner);
st->UpdateVirtCoord();
}
UpdateStationAcceptance(st, false);
st->RecomputeIndustriesNear();
st->AfterStationTileSetChange(true, STATION_AIRPORT);
ZoningMarkDirtyStationCoverageArea(st);
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
InvalidateWindowData(WC_STATION_VIEW, st->index, -1);
if (_settings_game.economy.station_noise_level) {
@@ -2567,11 +2584,9 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
}
Company::Get(st->owner)->infrastructure.airport--;
DirtyCompanyInfrastructureWindows(st->owner);
st->UpdateVirtCoord();
st->RecomputeIndustriesNear();
DeleteStationIfEmpty(st);
st->AfterStationTileSetChange(false, STATION_AIRPORT);
DeleteNewGRFInspectWindow(GSF_AIRPORTS, st->index);
}
@@ -2723,17 +2738,11 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
Company::Get(st->owner)->infrastructure.water++;
}
Company::Get(st->owner)->infrastructure.station += 2;
DirtyCompanyInfrastructureWindows(st->owner);
MakeDock(slope_tile, st->owner, st->index, direction, wc);
st->UpdateVirtCoord();
UpdateStationAcceptance(st, false);
st->RecomputeIndustriesNear();
st->AfterStationTileSetChange(true, STATION_DOCK);
ZoningMarkDirtyStationCoverageArea(st);
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_SHIPS);
}
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_STATION_DOCK]);
@@ -2797,12 +2806,8 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
}
Company::Get(st->owner)->infrastructure.station -= 2;
DirtyCompanyInfrastructureWindows(st->owner);
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_SHIPS);
st->UpdateVirtCoord();
st->RecomputeIndustriesNear();
DeleteStationIfEmpty(st);
st->AfterStationTileSetChange(false, STATION_DOCK);
/* All ships that were going to our station, can't go to it anymore.
* Just clear the order, then automatically the next appropriate order