Check vehicle prev/next pointer consistency in CheckCaches

This commit is contained in:
Jonathan G Rennison 2019-05-16 20:05:22 +01:00
parent 34d7f12a70
commit cb5a86754e

View File

@ -72,6 +72,7 @@
#include "bridge_signal_map.h"
#include "zoning.h"
#include "cargopacket.h"
#include "tbtr_template_vehicle.h"
#include "linkgraph/linkgraphschedule.h"
#include "tracerestrict.h"
@ -1498,6 +1499,16 @@ void CheckCaches(bool force_check)
extern void ValidateVehicleTickCaches();
ValidateVehicleTickCaches();
FOR_ALL_VEHICLES(v) {
if (v->Previous()) assert_msg(v->Previous()->Next() == v, "%u", v->index);
if (v->Next()) assert_msg(v->Next()->Previous() == v, "%u", v->index);
}
const TemplateVehicle *tv;
FOR_ALL_TEMPLATES(tv) {
if (tv->Prev()) assert_msg(tv->Prev()->Next() == tv, "%u", tv->index);
if (tv->Next()) assert_msg(tv->Next()->Prev() == tv, "%u", tv->index);
}
}
/**