summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2020-12-27 10:44:22 +0000
committerCharles Pigott <charlespigott@googlemail.com>2020-12-27 10:55:42 +0000
commit860c270c73048b4930ac8cbebcd60be746eb9782 (patch)
treea88a8acb208cf426ae8fac05dda202c57b59426a /src/saveload
parent395a5d9991b500c681ff384f8d3b4e153e687abb (diff)
downloadopenttd-860c270c73048b4930ac8cbebcd60be746eb9782.tar.xz
Codechange: Replace assert_compile macro with static_assert
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp2
-rw-r--r--src/saveload/gamelog_sl.cpp2
-rw-r--r--src/saveload/oldloader.cpp2
-rw-r--r--src/saveload/oldloader.h2
-rw-r--r--src/saveload/saveload.cpp2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 4eab99c88..329152ab2 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2182,7 +2182,7 @@ bool AfterLoadGame()
for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
/* There are always as many CargoPayments as Vehicles. We need to make the
* assert() in Pool::GetNew() happy by calling CanAllocateItem(). */
- assert_compile(CargoPaymentPool::MAX_SIZE == VehiclePool::MAX_SIZE);
+ static_assert(CargoPaymentPool::MAX_SIZE == VehiclePool::MAX_SIZE);
assert(CargoPayment::CanAllocateItem());
Vehicle *v = *iter;
if (v->cargo_payment == nullptr) v->cargo_payment = new CargoPayment(v);
diff --git a/src/saveload/gamelog_sl.cpp b/src/saveload/gamelog_sl.cpp
index 576bfa5bc..6bff1b154 100644
--- a/src/saveload/gamelog_sl.cpp
+++ b/src/saveload/gamelog_sl.cpp
@@ -100,7 +100,7 @@ static const SaveLoad * const _glog_desc[] = {
_glog_emergency_desc,
};
-assert_compile(lengthof(_glog_desc) == GLCT_END);
+static_assert(lengthof(_glog_desc) == GLCT_END);
static void Load_GLOG_common(LoggedAction *&gamelog_action, uint &gamelog_actions)
{
diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp
index 5dac33777..0c2c7f80b 100644
--- a/src/saveload/oldloader.cpp
+++ b/src/saveload/oldloader.cpp
@@ -243,7 +243,7 @@ static inline bool CheckOldSavegameType(FILE *f, char *temp, const char *last, u
static SavegameType DetermineOldSavegameType(FILE *f, char *title, const char *last)
{
- assert_compile(TTD_HEADER_SIZE >= TTO_HEADER_SIZE);
+ static_assert(TTD_HEADER_SIZE >= TTO_HEADER_SIZE);
char temp[TTD_HEADER_SIZE] = "Unknown";
SavegameType type = SGT_TTO;
diff --git a/src/saveload/oldloader.h b/src/saveload/oldloader.h
index fcc7be4be..1600a9ac2 100644
--- a/src/saveload/oldloader.h
+++ b/src/saveload/oldloader.h
@@ -93,7 +93,7 @@ struct OldChunks {
};
/* If it fails, check lines above.. */
-assert_compile(sizeof(TileIndex) == 4);
+static_assert(sizeof(TileIndex) == 4);
extern uint _bump_assert_value;
byte ReadByte(LoadgameState *ls);
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 3471a8295..bfbf1957b 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1142,7 +1142,7 @@ static size_t ReferenceToInt(const void *obj, SLRefType rt)
*/
static void *IntToReference(size_t index, SLRefType rt)
{
- assert_compile(sizeof(size_t) <= sizeof(void *));
+ static_assert(sizeof(size_t) <= sizeof(void *));
assert(_sl.action == SLA_PTRS);