summaryrefslogtreecommitdiff
path: root/src/saveload/afterload.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/saveload/afterload.cpp')
-rw-r--r--src/saveload/afterload.cpp49
1 files changed, 28 insertions, 21 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index bf067409d..fa772cac1 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1850,14 +1850,33 @@ bool AfterLoadGame()
i++;
}
}
+ }
+
+ if (CheckSavegameVersion(124)) {
+ /* The train station tile area was added */
+ Waypoint *wp;
+ FOR_ALL_WAYPOINTS(wp) {
+ if (wp->facilities & FACIL_TRAIN) {
+ wp->train_station.tile = wp->xy;
+ wp->train_station.w = 1;
+ wp->train_station.h = 1;
+ } else {;
+ wp->train_station.tile = INVALID_TILE;
+ wp->train_station.w = 0;
+ wp->train_station.h = 0;
+ }
+ }
+ }
+ {
/* Delete invalid subsidies possibly present in old versions (but converted to new savegame) */
Subsidy *s;
FOR_ALL_SUBSIDIES(s) {
if (s->IsAwarded()) {
/* Station -> Station */
- const Station *from = Station::GetIfValid(s->from);
- const Station *to = Station::GetIfValid(s->to);
+ const Station *from = Station::GetIfValid(s->src);
+ const Station *to = Station::GetIfValid(s->dst);
+ s->src_type = s->dst_type = ST_STATION;
if (from != NULL && to != NULL && from->owner == to->owner && Company::IsValidID(from->owner)) continue;
} else {
const CargoSpec *cs = CargoSpec::Get(s->cargo_type);
@@ -1865,16 +1884,20 @@ bool AfterLoadGame()
case TE_PASSENGERS:
case TE_MAIL:
/* Town -> Town */
- if (Town::IsValidID(s->from) && Town::IsValidID(s->to)) continue;
+ s->src_type = s->dst_type = ST_TOWN;
+ if (Town::IsValidID(s->src) && Town::IsValidID(s->dst)) continue;
break;
case TE_GOODS:
case TE_FOOD:
/* Industry -> Town */
- if (Industry::IsValidID(s->from) && Town::IsValidID(s->to)) continue;
+ s->src_type = ST_INDUSTRY;
+ s->dst_type = ST_TOWN;
+ if (Industry::IsValidID(s->src) && Town::IsValidID(s->dst)) continue;
break;
default:
/* Industry -> Industry */
- if (Industry::IsValidID(s->from) && Industry::IsValidID(s->to)) continue;
+ s->src_type = s->dst_type = ST_INDUSTRY;
+ if (Industry::IsValidID(s->src) && Industry::IsValidID(s->dst)) continue;
break;
}
}
@@ -1882,22 +1905,6 @@ bool AfterLoadGame()
}
}
- if (CheckSavegameVersion(124)) {
- /* The train station tile area was added */
- Waypoint *wp;
- FOR_ALL_WAYPOINTS(wp) {
- if (wp->facilities & FACIL_TRAIN) {
- wp->train_station.tile = wp->xy;
- wp->train_station.w = 1;
- wp->train_station.h = 1;
- } else {;
- wp->train_station.tile = INVALID_TILE;
- wp->train_station.w = 0;
- wp->train_station.h = 0;
- }
- }
- }
-
AfterLoadLabelMaps();
GamelogPrintDebug(1);