summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 9bd3bf7d0..7d9bd09a6 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -64,6 +64,7 @@
#include "viewport_func.h"
#include "viewport_sprite_sorter.h"
#include "framerate_type.h"
+#include "industry.h"
#include "linkgraph/linkgraphschedule.h"
@@ -1310,6 +1311,13 @@ static void CheckCaches()
assert(memcmp(&v->cargo, buff, sizeof(VehicleCargoList)) == 0);
}
+ /* Backup stations_near */
+ std::vector<StationList> old_town_stations_near;
+ for (Town *t : Town::Iterate()) old_town_stations_near.push_back(t->stations_near);
+
+ std::vector<StationList> old_industry_stations_near;
+ for (Industry *ind : Industry::Iterate()) old_industry_stations_near.push_back(ind->stations_near);
+
for (Station *st : Station::Iterate()) {
for (CargoID c = 0; c < NUM_CARGO; c++) {
byte buff[sizeof(StationCargoList)];
@@ -1334,6 +1342,29 @@ static void CheckCaches()
DEBUG(desync, 2, "docking tile mismatch: tile %i", (int)tile);
}
}
+
+ /* Check industries_near */
+ IndustryList industries_near = st->industries_near;
+ st->RecomputeCatchment();
+ if (st->industries_near != industries_near) {
+ DEBUG(desync, 2, "station industries near mismatch: station %i", st->index);
+ }
+ }
+
+ /* Check stations_near */
+ i = 0;
+ for (Town *t : Town::Iterate()) {
+ if (t->stations_near != old_town_stations_near[i]) {
+ DEBUG(desync, 2, "town stations near mismatch: town %i", t->index);
+ }
+ i++;
+ }
+ i = 0;
+ for (Industry *ind : Industry::Iterate()) {
+ if (ind->stations_near != old_industry_stations_near[i]) {
+ DEBUG(desync, 2, "industry stations near mismatch: industry %i", ind->index);
+ }
+ i++;
}
}