Codechange: Replace assert_compile macro with static_assert

This commit is contained in:
Charles Pigott
2020-12-27 10:44:22 +00:00
parent 395a5d9991
commit 860c270c73
77 changed files with 133 additions and 135 deletions

View File

@@ -304,7 +304,7 @@ static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_N
static const StringID _num_inds[] = {STR_FUNDING_ONLY, STR_MINIMAL, STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, INVALID_STRING_ID};
static const StringID _variety[] = {STR_VARIETY_NONE, STR_VARIETY_VERY_LOW, STR_VARIETY_LOW, STR_VARIETY_MEDIUM, STR_VARIETY_HIGH, STR_VARIETY_VERY_HIGH, INVALID_STRING_ID};
assert_compile(lengthof(_num_inds) == ID_END + 1);
static_assert(lengthof(_num_inds) == ID_END + 1);
struct GenerateLandscapeWindow : public Window {
uint widget_id;
@@ -1166,7 +1166,7 @@ static const StringID _generation_class_table[] = {
STR_GENERATION_PREPARING_SCRIPT,
STR_GENERATION_PREPARING_GAME
};
assert_compile(lengthof(_generation_class_table) == GWP_CLASS_COUNT);
static_assert(lengthof(_generation_class_table) == GWP_CLASS_COUNT);
static void AbortGeneratingWorldCallback(Window *w, bool confirmed)
@@ -1268,7 +1268,7 @@ void ShowGenerateWorldProgress()
static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uint total)
{
static const int percent_table[] = {0, 5, 14, 17, 20, 40, 60, 65, 80, 85, 95, 99, 100 };
assert_compile(lengthof(percent_table) == GWP_CLASS_COUNT + 1);
static_assert(lengthof(percent_table) == GWP_CLASS_COUNT + 1);
assert(cls < GWP_CLASS_COUNT);
/* Do not run this function if we aren't in a thread */