Only compile OrderList::DebugCheckSanity when WITH_ASSERT defined

wip-string
Jonathan G Rennison 5 months ago
parent be4f8b91c6
commit 9ea49d6680

@ -1981,9 +1981,11 @@ void CheckCaches(bool force_check, std::function<void(const char *)> log, CheckC
}
}
#ifdef WITH_ASSERT
for (OrderList *order_list : OrderList::Iterate()) {
order_list->DebugCheckSanity();
}
#endif
extern void ValidateVehicleTickCaches();
ValidateVehicleTickCaches();

@ -967,7 +967,9 @@ public:
void FreeChain(bool keep_orderlist = false);
#ifdef WITH_ASSERT
void DebugCheckSanity() const;
#endif
bool CheckOrderListIndexing() const;
inline std::vector<DispatchSchedule> &GetScheduledDispatchScheduleSet() { return this->dispatch_schedules; }

@ -840,6 +840,7 @@ bool OrderList::IsCompleteTimetable() const
return true;
}
#ifdef WITH_ASSERT
/**
* Checks for internal consistency of order list. Triggers assertion if something is wrong.
*/
@ -878,6 +879,7 @@ void OrderList::DebugCheckSanity() const
this->num_vehicles, this->timetable_duration, this->total_duration);
assert(this->CheckOrderListIndexing());
}
#endif
/**
* Checks whether the order goes to a station or not, i.e. whether the
@ -2822,7 +2824,7 @@ void CheckOrders(const Vehicle *v)
/* Do we only have 1 station in our order list? */
if (n_st < 2 && message == INVALID_STRING_ID) message = STR_NEWS_VEHICLE_HAS_TOO_FEW_ORDERS;
#ifndef NDEBUG
#ifdef WITH_ASSERT
if (v->orders != nullptr) v->orders->DebugCheckSanity();
#endif

@ -3972,9 +3972,11 @@ bool AfterLoadGame()
}
}
}
#ifdef WITH_ASSERT
for (OrderList *order_list : OrderList::Iterate()) {
order_list->DebugCheckSanity();
}
#endif
}
if (SlXvIsFeaturePresent(XSLFI_TRAIN_THROUGH_LOAD, 0, 1)) {

Loading…
Cancel
Save