summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-01-14 16:49:29 +0000
committersmatz <smatz@openttd.org>2011-01-14 16:49:29 +0000
commitc58a910c8edc1df1925c5348be2aab55c3cd6cb4 (patch)
treea41daf26a52a231267d1a9a9a40191e56b8370f0 /src
parentfad00367aee9879e99be41647876096b7c18825c (diff)
downloadopenttd-c58a910c8edc1df1925c5348be2aab55c3cd6cb4.tar.xz
(svn r21790) -Fix [FS#4398]: TTDPatch savegames can have train waypoints encoded as buoys
Diffstat (limited to 'src')
-rw-r--r--src/saveload/station_sl.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp
index fbc9d0ac0..fd8df51ca 100644
--- a/src/saveload/station_sl.cpp
+++ b/src/saveload/station_sl.cpp
@@ -66,21 +66,25 @@ void MoveBuoysToWaypoints()
char *name = st->name;
st->name = NULL;
Date build_date = st->build_date;
+ /* TTDPatch could use "buoys with rail station" for rail waypoints */
+ bool train = st->train_station.tile != INVALID_TILE;
/* Delete the station, so we can make it a real waypoint. */
delete st;
- Waypoint *wp = new (index) Waypoint(xy);
+ Waypoint *wp = new (index) Waypoint(xy);
wp->town = town;
- wp->string_id = STR_SV_STNAME_BUOY;
+ wp->string_id = train ? STR_SV_STNAME_WAYPOINT : STR_SV_STNAME_BUOY;
wp->name = name;
wp->delete_ctr = 0; // Just reset delete counter for once.
wp->build_date = build_date;
- wp->owner = OWNER_NONE;
+ wp->owner = train ? GetTileOwner(xy) : OWNER_NONE;
if (IsInsideBS(string_id, STR_SV_STNAME_BUOY, 9)) wp->town_cn = string_id - STR_SV_STNAME_BUOY;
- if (IsBuoyTile(xy) && GetStationIndex(xy) == index) {
+ if (train) {
+ wp->facilities |= FACIL_TRAIN;
+ } else if (IsBuoyTile(xy) && GetStationIndex(xy) == index) {
wp->facilities |= FACIL_DOCK;
}