mirror of https://github.com/OpenTTD/OpenTTD
(svn r21409) -Codechange: limit depot name by amount of characters, not bytes
parent
9a18050646
commit
091263317e
|
@ -53,7 +53,7 @@ CommandCost CmdRenameDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
bool reset = StrEmpty(text);
|
bool reset = StrEmpty(text);
|
||||||
|
|
||||||
if (!reset) {
|
if (!reset) {
|
||||||
if (strlen(text) >= MAX_LENGTH_DEPOT_NAME_BYTES) return CMD_ERROR;
|
if (Utf8StringLength(text) >= MAX_LENGTH_DEPOT_NAME_CHARS) return CMD_ERROR;
|
||||||
if (!IsUniqueDepotName(text)) return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
|
if (!IsUniqueDepotName(text)) return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -738,7 +738,7 @@ struct DepotWindow : Window {
|
||||||
case DEPOT_WIDGET_RENAME: // Rename button
|
case DEPOT_WIDGET_RENAME: // Rename button
|
||||||
SetDParam(0, this->type);
|
SetDParam(0, this->type);
|
||||||
SetDParam(1, Depot::GetByTile((TileIndex)this->window_number)->index);
|
SetDParam(1, Depot::GetByTile((TileIndex)this->window_number)->index);
|
||||||
ShowQueryString(STR_DEPOT_NAME, STR_DEPOT_RENAME_DEPOT_CAPTION, MAX_LENGTH_DEPOT_NAME_BYTES, MAX_LENGTH_DEPOT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
|
ShowQueryString(STR_DEPOT_NAME, STR_DEPOT_RENAME_DEPOT_CAPTION, MAX_LENGTH_DEPOT_NAME_CHARS, MAX_LENGTH_DEPOT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEPOT_WIDGET_STOP_ALL:
|
case DEPOT_WIDGET_STOP_ALL:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
typedef uint16 DepotID;
|
typedef uint16 DepotID;
|
||||||
struct Depot;
|
struct Depot;
|
||||||
|
|
||||||
static const uint MAX_LENGTH_DEPOT_NAME_BYTES = 31; ///< The maximum length of a depot name in bytes including '\0'
|
static const uint MAX_LENGTH_DEPOT_NAME_CHARS = 31; ///< The maximum length of a depot name in characters including '\0'
|
||||||
static const uint MAX_LENGTH_DEPOT_NAME_PIXELS = 180; ///< The maximum length of a depot name in pixels
|
static const uint MAX_LENGTH_DEPOT_NAME_PIXELS = 180; ///< The maximum length of a depot name in pixels
|
||||||
|
|
||||||
#endif /* DEPOT_TYPE_H */
|
#endif /* DEPOT_TYPE_H */
|
||||||
|
|
Loading…
Reference in New Issue