Merge remote-tracking branch 'upstream/jgrpp' into jgrpp

This commit is contained in:
Heiko August
2015-11-08 14:51:39 +01:00
14 changed files with 167 additions and 23 deletions

View File

@@ -1,2 +1,2 @@
jgrpp-0.7.0 27415 0 jgrpp-0.7.0 jgrpp-0.7.1 27428 0 jgrpp-0.7.1
788f8c0cf7000f20953ac49e57bb799b1c75c7774d9b7aeb9b188fe3e415a7c9 - 60c05dd628290c02d39e5ade377ba82f949ab1da446e83903eb95ed57ea10c1a -

View File

@@ -75,6 +75,8 @@ endif
$(Q)cp "$(ROOT_DIR)/known-bugs.txt" "$(BUNDLE_DIR)/" $(Q)cp "$(ROOT_DIR)/known-bugs.txt" "$(BUNDLE_DIR)/"
$(Q)cp "$(ROOT_DIR)/docs/multiplayer.txt" "$(BUNDLE_DIR)/docs/" $(Q)cp "$(ROOT_DIR)/docs/multiplayer.txt" "$(BUNDLE_DIR)/docs/"
$(Q)cp "$(ROOT_DIR)/changelog.txt" "$(BUNDLE_DIR)/" $(Q)cp "$(ROOT_DIR)/changelog.txt" "$(BUNDLE_DIR)/"
$(Q)cp "$(ROOT_DIR)/README.md" "$(BUNDLE_DIR)/"
$(Q)cp "$(ROOT_DIR)/jgrpp-changelog.md" "$(BUNDLE_DIR)/"
ifdef MAN_DIR ifdef MAN_DIR
$(Q)mkdir -p "$(BUNDLE_DIR)/man/" $(Q)mkdir -p "$(BUNDLE_DIR)/man/"
$(Q)cp "$(ROOT_DIR)/docs/openttd.6" "$(BUNDLE_DIR)/man/" $(Q)cp "$(ROOT_DIR)/docs/openttd.6" "$(BUNDLE_DIR)/man/"
@@ -90,7 +92,7 @@ ifdef MENU_DIR
$(Q)sed s/=openttd/=$(BINARY_NAME)/g "$(BUNDLE_DIR)/media/openttd.desktop" > "$(ROOT_DIR)/media/openttd.desktop.install" $(Q)sed s/=openttd/=$(BINARY_NAME)/g "$(BUNDLE_DIR)/media/openttd.desktop" > "$(ROOT_DIR)/media/openttd.desktop.install"
endif endif
ifeq ($(TTD), openttd.exe) ifeq ($(TTD), openttd.exe)
$(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/readme.txt" "$(BUNDLE_DIR)/COPYING" "$(BUNDLE_DIR)/changelog.txt" "$(BUNDLE_DIR)/known-bugs.txt" $(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/readme.txt" "$(BUNDLE_DIR)/COPYING" "$(BUNDLE_DIR)/changelog.txt" "$(BUNDLE_DIR)/known-bugs.txt" "$(BUNDLE_DIR)/"*.md
ifeq ($(OS), DOS) ifeq ($(OS), DOS)
$(Q)cp "$(ROOT_DIR)/os/dos/cwsdpmi/cwsdpmi.txt" "$(BUNDLE_DIR)/docs/" $(Q)cp "$(ROOT_DIR)/os/dos/cwsdpmi/cwsdpmi.txt" "$(BUNDLE_DIR)/docs/"
ifndef STRIP ifndef STRIP
@@ -161,7 +163,7 @@ bundle_dmg: bundle
bundle_exe: all bundle_exe: all
@echo '[BUNDLE] Creating $(BUNDLE_NAME).exe' @echo '[BUNDLE] Creating $(BUNDLE_NAME).exe'
$(Q)mkdir -p "$(BUNDLES_DIR)" $(Q)mkdir -p "$(BUNDLES_DIR)"
$(Q)unix2dos "$(ROOT_DIR)/docs/"*.txt "$(ROOT_DIR)/readme.txt" "$(ROOT_DIR)/COPYING" "$(ROOT_DIR)/changelog.txt" "$(ROOT_DIR)/known-bugs.txt" $(Q)unix2dos "$(ROOT_DIR)/docs/"*.txt "$(ROOT_DIR)/readme.txt" "$(ROOT_DIR)/COPYING" "$(ROOT_DIR)/changelog.txt" "$(ROOT_DIR)/known-bugs.txt" "$(ROOT_DIR)/"*.md
$(Q)cd $(ROOT_DIR)/os/windows/installer && makensis.exe //DVERSION_INCLUDE=version_$(PLATFORM).txt install.nsi $(Q)cd $(ROOT_DIR)/os/windows/installer && makensis.exe //DVERSION_INCLUDE=version_$(PLATFORM).txt install.nsi
$(Q)mv $(ROOT_DIR)/os/windows/installer/*$(PLATFORM).exe "$(BUNDLES_DIR)/$(BUNDLE_NAME).exe" $(Q)mv $(ROOT_DIR)/os/windows/installer/*$(PLATFORM).exe "$(BUNDLES_DIR)/$(BUNDLE_NAME).exe"
@@ -196,6 +198,7 @@ endif
ifndef DO_NOT_INSTALL_CHANGELOG ifndef DO_NOT_INSTALL_CHANGELOG
$(Q)install -d "$(INSTALL_DOC_DIR)" $(Q)install -d "$(INSTALL_DOC_DIR)"
$(Q)install -m 644 "$(BUNDLE_DIR)/changelog.txt" "$(INSTALL_DOC_DIR)" $(Q)install -m 644 "$(BUNDLE_DIR)/changelog.txt" "$(INSTALL_DOC_DIR)"
$(Q)install -m 644 "$(BUNDLE_DIR)/jgrpp-changelog.md" "$(INSTALL_DOC_DIR)"
endif endif
ifndef DO_NOT_INSTALL_LICENSE ifndef DO_NOT_INSTALL_LICENSE
$(Q)install -d "$(INSTALL_DOC_DIR)" $(Q)install -d "$(INSTALL_DOC_DIR)"

View File

@@ -1,4 +1,4 @@
## JGR's Patchpack version 0.7.0 ## JGR's Patchpack version 0.7.1
This is a collection of patches applied to [OpenTTD](http://www.openttd.org/) This is a collection of patches applied to [OpenTTD](http://www.openttd.org/)
@@ -39,6 +39,7 @@ See [jgrpp-changelog.md](jgrpp-changelog.md) for changelog.
* Zoning: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=33701) * Zoning: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=33701)
This is modified to remove unimplemented modes, implement station ownership checks and implement station facility checks for industries. This is modified to remove unimplemented modes, implement station ownership checks and implement station facility checks for industries.
As of v0.6.0, add a mode to show restricted signals. As of v0.6.0, add a mode to show restricted signals.
As of v0.7.1, fix adding/removing station tiles not redrawing affected surrounding tiles when in the station catchment or unserved building/industry modes.
* Departure boards: [imported](https://www.tt-forums.net/viewtopic.php?f=33&t=49956) * Departure boards: [imported](https://www.tt-forums.net/viewtopic.php?f=33&t=49956)
* Fixed departure boards with orders with timetabled 0 travel times, e.g. those with depot service orders. * Fixed departure boards with orders with timetabled 0 travel times, e.g. those with depot service orders.
@@ -51,6 +52,7 @@ See [jgrpp-changelog.md](jgrpp-changelog.md) for changelog.
* Vehicles visible in tunnels (transparency setting): [imported](http://dev.openttdcoop.org/projects/clientpatches/repository/changes/VehicelsInTunnels.diff) * Vehicles visible in tunnels (transparency setting): [imported](http://dev.openttdcoop.org/projects/clientpatches/repository/changes/VehicelsInTunnels.diff)
* Signals in tunnels and on bridges: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=41260) * Signals in tunnels and on bridges: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=41260)
As of v0.7.1, fix various issues involving redrawing, updating of adjacent signals, and vehicles emitting smoke whilst stopped at a red signal.
* Measurement tools: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=49212) * Measurement tools: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=49212)
@@ -72,12 +74,13 @@ See [jgrpp-changelog.md](jgrpp-changelog.md) for changelog.
* Auto separation: Fix handling of non-station orders (e.g. waypoints and depots). Add setting to scale vehicle lateness adjustments. No longer set vehicle lateness to 0 if separation fails, instead leave it as it was. * Auto separation: Fix handling of non-station orders (e.g. waypoints and depots). Add setting to scale vehicle lateness adjustments. No longer set vehicle lateness to 0 if separation fails, instead leave it as it was.
* Timetable GUI: Allow clearing of timetable time fields which are at 0. Allow explicitly setting timetable time fields to 0 without clearing them. * Timetable GUI: Allow clearing of timetable time fields which are at 0. Allow explicitly setting timetable time fields to 0 without clearing them.
* Add a company setting to enable automatic timetabling for new vehicles (added in v0.4.0). * Add a company setting to enable automatic timetabling for new vehicles (added in v0.4.0).
* As of v0.7.0, the setting to scale vehicle lateness adjustments is a company setting. * As of v0.7.0, the setting to scale vehicle lateness adjustments is a company setting. As of v0.7.1 the default value has been changed to 40%.
* Vehicle repair cost: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=45642) * Vehicle repair cost: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=45642)
* Enhanced viewport: [imported](https://www.tt-forums.net/viewtopic.php?f=33&t=53394) * Enhanced viewport: [imported](https://www.tt-forums.net/viewtopic.php?f=33&t=53394)
Fixed crash when looking at aqueducts in viewport map mode. Fixed crash when looking at aqueducts in viewport map mode.
As of v0.7.1, fix flicker and render errors of bridge/tunnels in viewport map mode, and rendering/clearing errors of vehicle route lines.
* Infrastructure sharing: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=42254) * Infrastructure sharing: [imported](http://www.tt-forums.net/viewtopic.php?f=33&t=42254)
Fixed various issues with additions to the settings GUI. Fixed various issues with additions to the settings GUI.
@@ -145,9 +148,12 @@ See [jgrpp-changelog.md](jgrpp-changelog.md) for changelog.
Enable stack traces on MinGW, try to demangle C++ symbol names, try to use libbfd for better symbol lookup, handle SIGSEGV while backtracing. Enable stack traces on MinGW, try to demangle C++ symbol names, try to use libbfd for better symbol lookup, handle SIGSEGV while backtracing.
* Multiplayer desync fixes/changes * Multiplayer desync fixes/changes
* Fix YAPF pathfinder desync issue involving rail track type changes which where only passable by a subset of vehicles (trunk bug). (added in v0.6.0) * Fix YAPF pathfinder desync issue involving rail track type changes which where only passable by a subset of vehicles (trunk bug). (added in v0.6.0, fixed in trunk as of v0.7.1)
* Logging: Various changes and improvements to desync-related logging and debugging, see changelog for details. * Logging: Various changes and improvements to desync-related logging and debugging, see changelog for details.
* Translations
* German (by Auge): including vehicle group info, vehicle details window, and the zoning toolbar.
#### Caveats for loading savegames from the [Spring 2013 Patch Pack](http://www.tt-forums.net/viewtopic.php?f=33&t=66892): #### Caveats for loading savegames from the [Spring 2013 Patch Pack](http://www.tt-forums.net/viewtopic.php?f=33&t=66892):
* This is not guaranteed to be bug free * This is not guaranteed to be bug free

View File

@@ -2,6 +2,22 @@
* * * * * *
### v0.7.1 (2015-11-01)
* Enhanced viewports:
* Fix flicker and render errors of bridge/tunnels in viewport map mode.
* Fix rendering, clearing and timely update issues of vehicle route lines.
* Zoning: Fix adding/removing station tiles not redrawing affected surrounding tiles when in the station catchment or unserved building/industry modes.
* Bridges on signals and tunnels:
* Fix adjacent signals around bridge/tunnels not being updated when adding/updating (on the far side) and removing (on both sides) signals from the bridge/tunnel.
* Fix middle of bridge not being redrawn when adding/updating/removing signals to bridges.
* Fix vehicles continually emitting smoke when stopped at a red signal on a bridge.
* Change the default for the auto timetable separation rate company setting to 40%. This is to improve jam-resistance by default.
* Vehicle group info: make margins around text symmetric.
* Fix compilation on some compilers/platforms
* Add the changelog and readme to the bundle/install target.
* Add German translations by Auge, including: vehicle group info, vehicle details window, and the zoning toolbar.
* Bump trunk base from r27415 to r27428
### v0.7.0 (2015-10-29) ### v0.7.0 (2015-10-29)
* Fix timetable rounding depending on the client time display mode setting, which caused desyncs in multiplayer (departure boards patch bug). * Fix timetable rounding depending on the client time display mode setting, which caused desyncs in multiplayer (departure boards patch bug).
* Add reverse at waypoint orders. * Add reverse at waypoint orders.

View File

@@ -1289,6 +1289,10 @@ STR_CONFIG_SETTING_POPULATION_IN_LABEL :Zeige die Einwo
STR_CONFIG_SETTING_POPULATION_IN_LABEL_HELPTEXT :Zeige die Einwohneranzahl neben den Städtenamen auf der Karte an STR_CONFIG_SETTING_POPULATION_IN_LABEL_HELPTEXT :Zeige die Einwohneranzahl neben den Städtenamen auf der Karte an
STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS :Linienstärke in Diagrammen: {STRING} STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS :Linienstärke in Diagrammen: {STRING}
STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS_HELPTEXT :Strichdicke der Linien in Diagrammen. Dünnere Linien sind genauer ablesbar, dickere Linien sind besser sichtbar und erlauben es, Farben leichter zu unterscheiden STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS_HELPTEXT :Strichdicke der Linien in Diagrammen. Dünnere Linien sind genauer ablesbar, dickere Linien sind besser sichtbar und erlauben es, Farben leichter zu unterscheiden
STR_CONFIG_SETTING_SHOW_TRAIN_LENGTH_IN_DETAILS :Zuglänge in den Fahrzeugdetails anzeigen: {STRING}
STR_CONFIG_SETTING_SHOW_TRAIN_LENGTH_IN_DETAILS_HELPTEXT :Zeige die Zuglänge im Fenster für die Fahrzeugdetails an
STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_IN_DETAILS :Gruppe in den Fahrzeugdetails anzeigen: {STRING}
STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_IN_DETAILS_HELPTEXT :Zeige die Fahrzeuggruppe im Fenster für die Fahrzeugdetails an
STR_CONFIG_SETTING_LANDSCAPE :Landschaftstyp: {STRING} STR_CONFIG_SETTING_LANDSCAPE :Landschaftstyp: {STRING}
STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Landschaftstype definiert grundlegende Spielscenarien in Bezug auf verfügbare Fracht und Wachstumsvoraussetzungen für Städte. NewGRFs und Spielskripte erlauben weitgehendere Kontrolle dieser Parameter STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Landschaftstype definiert grundlegende Spielscenarien in Bezug auf verfügbare Fracht und Wachstumsvoraussetzungen für Städte. NewGRFs und Spielskripte erlauben weitgehendere Kontrolle dieser Parameter
@@ -3361,6 +3365,11 @@ STR_GROUP_REMOVE_ALL_VEHICLES :Liste leeren
STR_GROUP_RENAME_CAPTION :{BLACK}Gruppe umbenennen STR_GROUP_RENAME_CAPTION :{BLACK}Gruppe umbenennen
STR_GROUP_PROFIT_THIS_YEAR :Profit in diesem Jahr:
STR_GROUP_PROFIT_LAST_YEAR :Profit im letzten Jahr:
STR_GROUP_OCCUPANCY :Momentane Auslastung:
STR_GROUP_OCCUPANCY_VALUE :{NUM}%
# Build vehicle window # Build vehicle window
STR_BUY_VEHICLE_TRAIN_RAIL_CAPTION :Neue Schienenfahrzeuge STR_BUY_VEHICLE_TRAIN_RAIL_CAPTION :Neue Schienenfahrzeuge
STR_BUY_VEHICLE_TRAIN_ELRAIL_CAPTION :Neue elektrische Schienenfahrzeuge STR_BUY_VEHICLE_TRAIN_ELRAIL_CAPTION :Neue elektrische Schienenfahrzeuge
@@ -3655,9 +3664,13 @@ STR_VEHICLE_INFO_MAX_SPEED_RANGE :{BLACK}Max. Ges
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED :{BLACK}Gewicht: {LTBLUE}{WEIGHT_SHORT} {BLACK}Leistung: {LTBLUE}{POWER}{BLACK} Max. Geschw.: {LTBLUE}{VELOCITY} STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED :{BLACK}Gewicht: {LTBLUE}{WEIGHT_SHORT} {BLACK}Leistung: {LTBLUE}{POWER}{BLACK} Max. Geschw.: {LTBLUE}{VELOCITY}
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :{BLACK}Gewicht: {LTBLUE}{WEIGHT_SHORT} {BLACK}Leistung: {LTBLUE}{POWER}{BLACK} Max. Geschw.: {LTBLUE}{VELOCITY} {BLACK}Max. Zugkraft: {LTBLUE}{FORCE} STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :{BLACK}Gewicht: {LTBLUE}{WEIGHT_SHORT} {BLACK}Leistung: {LTBLUE}{POWER}{BLACK} Max. Geschw.: {LTBLUE}{VELOCITY} {BLACK}Max. Zugkraft: {LTBLUE}{FORCE}
STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}Zuglänge: {LTBLUE}{DECIMAL} Kachel{P "" n} {STRING}
STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Gewinn dieses Jahr: {LTBLUE}{CURRENCY_LONG} (letztes Jahr: {CURRENCY_LONG}) STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Gewinn dieses Jahr: {LTBLUE}{CURRENCY_LONG} (letztes Jahr: {CURRENCY_LONG})
STR_VEHICLE_INFO_RELIABILITY_BREAKDOWNS :{BLACK}Zuverlässigkeit: {LTBLUE}{COMMA}% {BLACK}Pannen seit der letzten Wartung: {LTBLUE}{COMMA} STR_VEHICLE_INFO_RELIABILITY_BREAKDOWNS :{BLACK}Zuverlässigkeit: {LTBLUE}{COMMA}% {BLACK}Pannen seit der letzten Wartung: {LTBLUE}{COMMA}
STR_VEHICLE_INFO_GROUP :{BLACK}Gruppe: {LTBLUE}{GROUP}
STR_VEHICLE_INFO_BUILT_VALUE :{LTBLUE}{ENGINE} {BLACK}Gebaut: {LTBLUE}{NUM}{BLACK} Wert: {LTBLUE}{CURRENCY_LONG} STR_VEHICLE_INFO_BUILT_VALUE :{LTBLUE}{ENGINE} {BLACK}Gebaut: {LTBLUE}{NUM}{BLACK} Wert: {LTBLUE}{CURRENCY_LONG}
STR_VEHICLE_INFO_NO_CAPACITY :{BLACK}Kapazität: {LTBLUE}Keine{STRING} STR_VEHICLE_INFO_NO_CAPACITY :{BLACK}Kapazität: {LTBLUE}Keine{STRING}
STR_VEHICLE_INFO_CAPACITY :{BLACK}Kapazität: {LTBLUE}{CARGO_LONG}{3:STRING} STR_VEHICLE_INFO_CAPACITY :{BLACK}Kapazität: {LTBLUE}{CARGO_LONG}{3:STRING}

View File

@@ -1091,10 +1091,11 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1,
} }
} }
} }
MarkTileDirtyByTile(tile); MarkBridgeOrTunnelDirty(tile);
MarkTileDirtyByTile(tile_exit);
AddSideToSignalBuffer(tile, INVALID_DIAGDIR, GetTileOwner(tile)); AddSideToSignalBuffer(tile, INVALID_DIAGDIR, GetTileOwner(tile));
AddSideToSignalBuffer(tile_exit, INVALID_DIAGDIR, GetTileOwner(tile));
YapfNotifyTrackLayoutChange(tile, track); YapfNotifyTrackLayoutChange(tile, track);
YapfNotifyTrackLayoutChange(tile_exit, track);
} }
return cost; return cost;
} }
@@ -1545,10 +1546,11 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1
ClrBitTunnelBridgeSignal(end); ClrBitTunnelBridgeSignal(end);
_m[tile].m2 = 0; _m[tile].m2 = 0;
_m[end].m2 = 0; _m[end].m2 = 0;
MarkTileDirtyByTile(tile); MarkBridgeOrTunnelDirty(tile);
MarkTileDirtyByTile(end);
AddSideToSignalBuffer(tile, INVALID_DIAGDIR, GetTileOwner(tile)); AddSideToSignalBuffer(tile, INVALID_DIAGDIR, GetTileOwner(tile));
AddSideToSignalBuffer(end, INVALID_DIAGDIR, GetTileOwner(tile));
YapfNotifyTrackLayoutChange(tile, track); YapfNotifyTrackLayoutChange(tile, track);
YapfNotifyTrackLayoutChange(end, track);
return CommandCost(EXPENSES_CONSTRUCTION, cost); return CommandCost(EXPENSES_CONSTRUCTION, cost);
} }

View File

@@ -294,13 +294,11 @@ uint Station::GetCatchmentRadius() const
* Determines catchment rectangle of this station * Determines catchment rectangle of this station
* @return clamped catchment rectangle * @return clamped catchment rectangle
*/ */
Rect Station::GetCatchmentRect() const Rect Station::GetCatchmentRectUsingRadius(uint catchment_radius) const
{ {
assert(!this->rect.IsEmpty()); assert(!this->rect.IsEmpty());
/* Compute acceptance rectangle */ /* Compute acceptance rectangle */
int catchment_radius = this->GetCatchmentRadius();
Rect ret = { Rect ret = {
max<int>(this->rect.left - catchment_radius, 0), max<int>(this->rect.left - catchment_radius, 0),
max<int>(this->rect.top - catchment_radius, 0), max<int>(this->rect.top - catchment_radius, 0),

View File

@@ -489,7 +489,11 @@ public:
static void RecomputeIndustriesNearForAll(); static void RecomputeIndustriesNearForAll();
uint GetCatchmentRadius() const; uint GetCatchmentRadius() const;
Rect GetCatchmentRect() const; Rect GetCatchmentRectUsingRadius(uint radius) const;
inline Rect GetCatchmentRect() const
{
return GetCatchmentRectUsingRadius(this->GetCatchmentRadius());
}
/* virtual */ inline bool TileBelongsToRailStation(TileIndex tile) const /* virtual */ inline bool TileBelongsToRailStation(TileIndex tile) const
{ {

View File

@@ -53,6 +53,7 @@
#include "linkgraph/linkgraph_base.h" #include "linkgraph/linkgraph_base.h"
#include "linkgraph/refresh.h" #include "linkgraph/refresh.h"
#include "widgets/station_widget.h" #include "widgets/station_widget.h"
#include "zoning.h"
#include "table/strings.h" #include "table/strings.h"
@@ -1425,6 +1426,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
st->UpdateVirtCoord(); st->UpdateVirtCoord();
UpdateStationAcceptance(st, false); UpdateStationAcceptance(st, false);
st->RecomputeIndustriesNear(); st->RecomputeIndustriesNear();
ZoningMarkDirtyStationCoverageArea(st);
InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0); InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS); SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
@@ -1537,6 +1539,9 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
} }
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
bool already_affected = affected_stations.Include(st);
if (!already_affected) ZoningMarkDirtyStationCoverageArea(st);
/* read variables before the station tile is removed */ /* read variables before the station tile is removed */
uint specindex = GetCustomStationSpecIndex(tile); uint specindex = GetCustomStationSpecIndex(tile);
Track track = GetRailStationTrack(tile); Track track = GetRailStationTrack(tile);
@@ -1571,8 +1576,6 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
DeallocateSpecFromStation(st, specindex); DeallocateSpecFromStation(st, specindex);
affected_stations.Include(st);
if (v != NULL) { if (v != NULL) {
/* Restore station reservation. */ /* Restore station reservation. */
if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true); if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true);
@@ -1716,6 +1719,9 @@ static CommandCost RemoveRailStation(TileIndex tile, DoCommandFlag flags)
} }
Station *st = Station::GetByTile(tile); Station *st = Station::GetByTile(tile);
if (flags & DC_EXEC) ZoningMarkDirtyStationCoverageArea(st);
CommandCost cost = RemoveRailStation(st, flags, _price[PR_CLEAR_STATION_RAIL]); CommandCost cost = RemoveRailStation(st, flags, _price[PR_CLEAR_STATION_RAIL]);
if (flags & DC_EXEC) st->RecomputeIndustriesNear(); if (flags & DC_EXEC) st->RecomputeIndustriesNear();
@@ -1905,6 +1911,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
MarkTileDirtyByTile(cur_tile); MarkTileDirtyByTile(cur_tile);
} }
ZoningMarkDirtyStationCoverageArea(st);
} }
if (st != NULL) { if (st != NULL) {
@@ -1975,6 +1982,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
} }
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ZoningMarkDirtyStationCoverageArea(st);
if (*primary_stop == cur_stop) { if (*primary_stop == cur_stop) {
/* removed the first stop in the list */ /* removed the first stop in the list */
*primary_stop = cur_stop->next; *primary_stop = cur_stop->next;
@@ -2432,6 +2440,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
UpdateStationAcceptance(st, false); UpdateStationAcceptance(st, false);
st->RecomputeIndustriesNear(); st->RecomputeIndustriesNear();
ZoningMarkDirtyStationCoverageArea(st);
InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0); InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
InvalidateWindowData(WC_STATION_VIEW, st->index, -1); InvalidateWindowData(WC_STATION_VIEW, st->index, -1);
@@ -2463,6 +2472,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
if (cost.Failed()) return cost; if (cost.Failed()) return cost;
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ZoningMarkDirtyStationCoverageArea(st);
const AirportSpec *as = st->airport.GetSpec(); const AirportSpec *as = st->airport.GetSpec();
/* The noise level is the noise from the airport and reduce it to account for the distance to the town center. /* The noise level is the noise from the airport and reduce it to account for the distance to the town center.
* And as for construction, always remove it, even if the setting is not set, in order to avoid the * And as for construction, always remove it, even if the setting is not set, in order to avoid the
@@ -2654,6 +2664,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
st->UpdateVirtCoord(); st->UpdateVirtCoord();
UpdateStationAcceptance(st, false); UpdateStationAcceptance(st, false);
st->RecomputeIndustriesNear(); st->RecomputeIndustriesNear();
ZoningMarkDirtyStationCoverageArea(st);
InvalidateWindowData(WC_SELECT_STATION, 0, 0); InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0); InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_SHIPS); SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_SHIPS);
@@ -2684,6 +2695,7 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
if (ret.Failed()) return ret; if (ret.Failed()) return ret;
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ZoningMarkDirtyStationCoverageArea(st);
DoClearSquare(tile1); DoClearSquare(tile1);
MarkTileDirtyByTile(tile1); MarkTileDirtyByTile(tile1);
MakeWaterKeepingClass(tile2, st->owner); MakeWaterKeepingClass(tile2, st->owner);
@@ -4023,11 +4035,13 @@ void BuildOilRig(TileIndex tile)
st->UpdateVirtCoord(); st->UpdateVirtCoord();
UpdateStationAcceptance(st, false); UpdateStationAcceptance(st, false);
st->RecomputeIndustriesNear(); st->RecomputeIndustriesNear();
ZoningMarkDirtyStationCoverageArea(st);
} }
void DeleteOilRig(TileIndex tile) void DeleteOilRig(TileIndex tile)
{ {
Station *st = Station::GetByTile(tile); Station *st = Station::GetByTile(tile);
ZoningMarkDirtyStationCoverageArea(st);
MakeWaterKeepingClass(tile, OWNER_NONE); MakeWaterKeepingClass(tile, OWNER_NONE);

View File

@@ -16,6 +16,7 @@
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END); void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END);
void MarkBridgeDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END); void MarkBridgeDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END);
void MarkBridgeOrTunnelDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below = ZOOM_LVL_END);
/** /**
* Calculates the length of a tunnel or a bridge (without end tiles) * Calculates the length of a tunnel or a bridge (without end tiles)

View File

@@ -80,6 +80,20 @@ void MarkBridgeDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_
MarkBridgeDirty(tile, GetOtherTunnelBridgeEnd(tile), GetTunnelBridgeDirection(tile), GetBridgeHeight(tile), mark_dirty_if_zoomlevel_is_below); MarkBridgeDirty(tile, GetOtherTunnelBridgeEnd(tile), GetTunnelBridgeDirection(tile), GetBridgeHeight(tile), mark_dirty_if_zoomlevel_is_below);
} }
/**
* Mark bridge or tunnel tiles dirty.
* @param tile Bridge head or tunnel entrance.
*/
void MarkBridgeOrTunnelDirty(TileIndex tile, const ZoomLevel mark_dirty_if_zoomlevel_is_below)
{
if (IsBridge(tile)) {
MarkBridgeDirty(tile, mark_dirty_if_zoomlevel_is_below);
} else {
MarkTileDirtyByTile(tile, mark_dirty_if_zoomlevel_is_below);
MarkTileDirtyByTile(GetOtherTunnelBridgeEnd(tile), mark_dirty_if_zoomlevel_is_below);
}
}
/** Reset the data been eventually changed by the grf loaded. */ /** Reset the data been eventually changed by the grf loaded. */
void ResetBridges() void ResetBridges()
{ {

View File

@@ -1548,8 +1548,17 @@ static void ViewportMapStoreBridgeTunnel(const ViewPort * const vp, const TileIn
/* It's a new one, add it to the list */ /* It's a new one, add it to the list */
tbtm = tbtmv->Append(); tbtm = tbtmv->Append();
tbtm->from_tile = tile; TileIndex other_end = GetOtherTunnelBridgeEnd(tile);
tbtm->to_tile = GetOtherTunnelBridgeEnd(tile);
/* ensure deterministic ordering, to avoid render flicker */
if (other_end > tile) {
tbtm->from_tile = other_end;
tbtm->to_tile = tile;
} else {
tbtm->from_tile = tile;
tbtm->to_tile = other_end;
}
if (vp->map_type == VPMT_OWNER && _settings_client.gui.use_owner_colour_for_tunnelbridge && o < MAX_COMPANIES) { if (vp->map_type == VPMT_OWNER && _settings_client.gui.use_owner_colour_for_tunnelbridge && o < MAX_COMPANIES) {
const uint8 colour = _legend_land_owners[_company_to_list_pos[o]].colour; const uint8 colour = _legend_land_owners[_company_to_list_pos[o]].colour;
tbtm->colour = tile_is_tunnel ? _darken_colour[colour] : _lighten_colour[colour]; tbtm->colour = tile_is_tunnel ? _darken_colour[colour] : _lighten_colour[colour];
@@ -2086,6 +2095,31 @@ static inline uint32 ViewportMapGetColourOwner(const TileIndex tile, TileType t,
return colour; return colour;
} }
static inline void ViewportMapStoreBridgeAboveTile(const ViewPort * const vp, const TileIndex tile)
{
/* No need to bother for hidden things */
if (!_settings_client.gui.show_bridges_on_map) return;
/* Check existing stored bridges */
TunnelBridgeToMap *tbtm = _vd.tunnel_bridge_to_map.Begin();
TunnelBridgeToMap *tbtm_end = _vd.tunnel_bridge_to_map.End();
for (; tbtm != tbtm_end; ++tbtm) {
if (!IsBridge(tbtm->from_tile)) continue;
TileIndex from = tbtm->from_tile;
TileIndex to = tbtm->to_tile;
if (TileX(from) == TileX(to) && TileX(from) == TileX(tile)) {
if (TileY(from) > TileY(to)) std::swap(from, to);
if (TileY(from) <= TileY(tile) && TileY(tile) <= TileY(to)) return; /* already covered */
} else if (TileY(from) == TileY(to) && TileY(from) == TileY(tile)) {
if (TileX(from) > TileX(to)) std::swap(from, to);
if (TileX(from) <= TileX(tile) && TileX(tile) <= TileX(to)) return; /* already covered */
}
}
ViewportMapStoreBridgeTunnel(vp, GetSouthernBridgeEnd(tile));
}
static inline TileIndex ViewportMapGetMostSignificantTileType(const ViewPort * const vp, const TileIndex from_tile, TileType * const tile_type) static inline TileIndex ViewportMapGetMostSignificantTileType(const ViewPort * const vp, const TileIndex from_tile, TileType * const tile_type)
{ {
if (vp->zoom <= ZOOM_LVL_OUT_128X || !_settings_client.gui.viewport_map_scan_surroundings) { if (vp->zoom <= ZOOM_LVL_OUT_128X || !_settings_client.gui.viewport_map_scan_surroundings) {
@@ -2093,6 +2127,7 @@ static inline TileIndex ViewportMapGetMostSignificantTileType(const ViewPort * c
/* Store bridges and tunnels. */ /* Store bridges and tunnels. */
if (ttype != MP_TUNNELBRIDGE) { if (ttype != MP_TUNNELBRIDGE) {
*tile_type = ttype; *tile_type = ttype;
if (IsBridgeAbove(from_tile)) ViewportMapStoreBridgeAboveTile(vp, from_tile);
} else { } else {
ViewportMapStoreBridgeTunnel(vp, from_tile); ViewportMapStoreBridgeTunnel(vp, from_tile);
switch (GetTunnelBridgeTransportType(from_tile)) { switch (GetTunnelBridgeTransportType(from_tile)) {
@@ -2119,6 +2154,9 @@ static inline TileIndex ViewportMapGetMostSignificantTileType(const ViewPort * c
importance = tile_importance; importance = tile_importance;
result = tile; result = tile;
} }
if (ttype != MP_TUNNELBRIDGE && IsBridgeAbove(tile)) {
ViewportMapStoreBridgeAboveTile(vp, tile);
}
} }
/* Store bridges and tunnels. */ /* Store bridges and tunnels. */
@@ -2303,7 +2341,7 @@ void ViewportMapDraw(const ViewPort * const vp)
const TunnelBridgeToMap * const tbtm_end = _vd.tunnel_bridge_to_map.End(); const TunnelBridgeToMap * const tbtm_end = _vd.tunnel_bridge_to_map.End();
for (const TunnelBridgeToMap *tbtm = _vd.tunnel_bridge_to_map.Begin(); tbtm != tbtm_end; tbtm++) { // For each bridge or tunnel for (const TunnelBridgeToMap *tbtm = _vd.tunnel_bridge_to_map.Begin(); tbtm != tbtm_end; tbtm++) { // For each bridge or tunnel
TileIndex tile = tbtm->from_tile; TileIndex tile = tbtm->from_tile;
const int z = TileHeight(tile) * 4; const int z = (IsBridge(tile) ? GetBridgeHeight(tile) : GetTileZ(tile)) * TILE_HEIGHT;
TileIndexDiff delta = TileOffsByDiagDir(GetTunnelBridgeDirection(tile)); TileIndexDiff delta = TileOffsByDiagDir(GetTunnelBridgeDirection(tile));
for (; tile != tbtm->to_tile; tile += delta) { // For each tile for (; tile != tbtm->to_tile; tile += delta) { // For each tile
const Point pt = RemapCoords(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, z); const Point pt = RemapCoords(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, z);

View File

@@ -46,4 +46,7 @@ void DrawTileZoning(const TileInfo *ti);
void ShowZoningToolbar(); void ShowZoningToolbar();
void ZoningMarkDirtyStationCoverageArea(const Station *st);
inline void ZoningMarkDirtyStationCoverageArea(const Waypoint *st) { } // no-op
#endif /* ZONING_H */ #endif /* ZONING_H */

View File

@@ -348,3 +348,35 @@ void DrawTileZoning(const TileInfo *ti)
DrawZoningSprites(SPR_ZONING_INNER_HIGHLIGHT_BASE, TileZoningSpriteEvaluation(ti->tile, _local_company, _zoning.inner), ti); DrawZoningSprites(SPR_ZONING_INNER_HIGHLIGHT_BASE, TileZoningSpriteEvaluation(ti->tile, _local_company, _zoning.inner), ti);
} }
} }
static uint GetZoningModeDependantStationCoverageRadius(const Station *st, ZoningEvaluationMode ev_mode)
{
switch (ev_mode) {
case ZEM_STA_CATCH: return st->GetCatchmentRadius();
case ZEM_BUL_UNSER: return st->GetCatchmentRadius();
case ZEM_IND_UNSER: return st->GetCatchmentRadius() + 10; // this is to wholly update industries partially within the region
default: return 0;
}
}
/**
* Mark dirty the coverage area around a station if the current zoning mode depends on station coverage
*
* @param const Station *st
* The station to use
*/
void ZoningMarkDirtyStationCoverageArea(const Station *st)
{
if (st->rect.IsEmpty()) return;
uint radius = max<uint>(GetZoningModeDependantStationCoverageRadius(st, _zoning.outer), GetZoningModeDependantStationCoverageRadius(st, _zoning.inner));
if (radius > 0) {
Rect rect = st->GetCatchmentRectUsingRadius(radius);
for (int x = rect.left; x <= rect.right; x++) {
for (int y = rect.top; y <= rect.bottom; y++) {
MarkTileDirtyByTile(TileXY(x, y));
}
}
}
}