summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-10-16 22:06:08 +0200
committerGitHub <noreply@github.com>2021-10-16 22:06:08 +0200
commit78eece71d9f669057c794f345ff5744145376556 (patch)
treed5cbb1e948db2fa04fedd7d6281d2969b7c49cb6 /src
parentd66dea5d832cbefd6f584848f3c0c88d99752afd (diff)
downloadopenttd-78eece71d9f669057c794f345ff5744145376556.tar.xz
Codechange: "set but not used" warning when disabling assert() (#9613)
DebugCheckSanity() is unused when asserts are disabled. While at it, use WITH_ASSERT over NDEBUG, as that means we also run this code during beta/RC.
Diffstat (limited to 'src')
-rw-r--r--src/order_cmd.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 4c94bedc0..f6e7f77a4 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -609,6 +609,7 @@ bool OrderList::IsCompleteTimetable() const
return true;
}
+#ifdef WITH_ASSERT
/**
* Checks for internal consistency of order list. Triggers assertion if something is wrong.
*/
@@ -642,6 +643,7 @@ void OrderList::DebugCheckSanity() const
(uint)this->num_orders, (uint)this->num_manual_orders,
this->num_vehicles, this->timetable_duration, this->total_duration);
}
+#endif
/**
* Checks whether the order goes to a station or not, i.e. whether the
@@ -1782,7 +1784,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.list != nullptr) v->orders.list->DebugCheckSanity();
#endif