Codechange: compile-time validate the string format of IConsolePrint (#11804)

This means we can no longer use runtime picking what string to use.
This commit is contained in:
Patric Stout
2024-01-16 22:04:35 +01:00
committed by GitHub
parent 8b4c5a6269
commit 0b7410d979
3 changed files with 23 additions and 24 deletions

View File

@@ -267,20 +267,18 @@ DEF_CONSOLE_CMD(ConZoomToLevel)
case 0:
IConsolePrint(CC_HELP, "Set the current zoom level of the main viewport.");
IConsolePrint(CC_HELP, "Usage: 'zoomto <level>'.");
IConsolePrint(
CC_HELP,
ZOOM_LVL_MIN < _settings_client.gui.zoom_min ?
"The lowest zoom-in level allowed by current client settings is {}." :
"The lowest supported zoom-in level is {}.",
std::max(ZOOM_LVL_MIN, _settings_client.gui.zoom_min)
);
IConsolePrint(
CC_HELP,
_settings_client.gui.zoom_max < ZOOM_LVL_MAX ?
"The highest zoom-out level allowed by current client settings is {}." :
"The highest supported zoom-out level is {}.",
std::min(_settings_client.gui.zoom_max, ZOOM_LVL_MAX)
);
if (ZOOM_LVL_MIN < _settings_client.gui.zoom_min) {
IConsolePrint(CC_HELP, "The lowest zoom-in level allowed by current client settings is {}.", std::max(ZOOM_LVL_MIN, _settings_client.gui.zoom_min));
} else {
IConsolePrint(CC_HELP, "The lowest supported zoom-in level is {}.", std::max(ZOOM_LVL_MIN, _settings_client.gui.zoom_min));
}
if (_settings_client.gui.zoom_max < ZOOM_LVL_MAX) {
IConsolePrint(CC_HELP, "The highest zoom-out level allowed by current client settings is {}.", std::min(_settings_client.gui.zoom_max, ZOOM_LVL_MAX));
} else {
IConsolePrint(CC_HELP, "The highest supported zoom-out level is {}.", std::min(_settings_client.gui.zoom_max, ZOOM_LVL_MAX));
}
return true;
case 2: {