mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Add: stations_near and industries_near cache check (#8139)
This commit is contained in:
parent
48c61c1da1
commit
d15c7dbdeb
@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user