Only compile OrderList::DebugCheckSanity when WITH_ASSERT defined

This commit is contained in:
Jonathan G Rennison
2024-01-02 14:48:57 +00:00
parent be4f8b91c6
commit 9ea49d6680
4 changed files with 9 additions and 1 deletions

View File

@@ -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