mirror of https://github.com/OpenTTD/OpenTTD
Fix #10059: [Script] Let custom values on a config item be up to 10 digits + 1 for sign
parent
7b1fd3e37f
commit
fde7028a95
|
@ -21,6 +21,7 @@
|
||||||
#include "game_config.hpp"
|
#include "game_config.hpp"
|
||||||
#include "game_info.hpp"
|
#include "game_info.hpp"
|
||||||
#include "../script/script_gui.h"
|
#include "../script/script_gui.h"
|
||||||
|
#include "../script_config.hpp"
|
||||||
#include "../table/strings.h"
|
#include "../table/strings.h"
|
||||||
|
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
@ -340,7 +341,7 @@ struct GSConfigWindow : public Window {
|
||||||
} else if (!bool_item && !config_item.complete_labels) {
|
} else if (!bool_item && !config_item.complete_labels) {
|
||||||
/* Display a query box so users can enter a custom value. */
|
/* Display a query box so users can enter a custom value. */
|
||||||
SetDParam(0, old_val);
|
SetDParam(0, old_val);
|
||||||
ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_NONE);
|
ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, INT32_DIGITS_WITH_SIGN_AND_TERMINATION, this, CS_NUMERAL_SIGNED, QSF_NONE);
|
||||||
}
|
}
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
#include "../textfile_gui.h"
|
#include "../textfile_gui.h"
|
||||||
#include "script_instance.hpp"
|
#include "script_instance.hpp"
|
||||||
|
|
||||||
|
/** Maximum of 10 digits for MIN / MAX_INT32, 1 for the sign and 1 for '\0'. */
|
||||||
|
static const int INT32_DIGITS_WITH_SIGN_AND_TERMINATION = 10 + 1 + 1;
|
||||||
|
|
||||||
/** Bitmask of flags for Script settings. */
|
/** Bitmask of flags for Script settings. */
|
||||||
enum ScriptConfigFlags {
|
enum ScriptConfigFlags {
|
||||||
SCRIPTCONFIG_NONE = 0x0, ///< No flags set.
|
SCRIPTCONFIG_NONE = 0x0, ///< No flags set.
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "script_gui.h"
|
#include "script_gui.h"
|
||||||
#include "script_log.hpp"
|
#include "script_log.hpp"
|
||||||
#include "script_scanner.hpp"
|
#include "script_scanner.hpp"
|
||||||
|
#include "script_config.hpp"
|
||||||
#include "../ai/ai.hpp"
|
#include "../ai/ai.hpp"
|
||||||
#include "../ai/ai_config.hpp"
|
#include "../ai/ai_config.hpp"
|
||||||
#include "../ai/ai_info.hpp"
|
#include "../ai/ai_info.hpp"
|
||||||
|
@ -497,7 +498,7 @@ struct ScriptSettingsWindow : public Window {
|
||||||
} else if (!bool_item && !config_item.complete_labels) {
|
} else if (!bool_item && !config_item.complete_labels) {
|
||||||
/* Display a query box so users can enter a custom value. */
|
/* Display a query box so users can enter a custom value. */
|
||||||
SetDParam(0, old_val);
|
SetDParam(0, old_val);
|
||||||
ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_NONE);
|
ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, INT32_DIGITS_WITH_SIGN_AND_TERMINATION, this, CS_NUMERAL_SIGNED, QSF_NONE);
|
||||||
}
|
}
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue