Changeset - r16669:f763468370ef
[Not reviewed]
master
0 3 0
rubidium - 14 years ago 2010-12-05 22:24:20
rubidium@openttd.org
(svn r21410) -Codechange: limit engine name by amount of characters, not bytes
3 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1211,7 +1211,7 @@ struct BuildVehicleWindow : Window {
 
				if (sel_eng != INVALID_ENGINE) {
 
					this->rename_engine = sel_eng;
 
					SetDParam(0, sel_eng);
 
					ShowQueryString(STR_ENGINE_NAME, STR_QUERY_RENAME_TRAIN_TYPE_CAPTION + this->vehicle_type, MAX_LENGTH_ENGINE_NAME_BYTES, MAX_LENGTH_ENGINE_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
 
					ShowQueryString(STR_ENGINE_NAME, STR_QUERY_RENAME_TRAIN_TYPE_CAPTION + this->vehicle_type, MAX_LENGTH_ENGINE_NAME_CHARS, MAX_LENGTH_ENGINE_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
 
				}
 
				break;
 
			}
src/engine.cpp
Show inline comments
 
@@ -832,7 +832,7 @@ CommandCost CmdRenameEngine(TileIndex ti
 
	bool reset = StrEmpty(text);
 

	
 
	if (!reset) {
 
		if (strlen(text) >= MAX_LENGTH_ENGINE_NAME_BYTES) return CMD_ERROR;
 
		if (Utf8StringLength(text) >= MAX_LENGTH_ENGINE_NAME_CHARS) return CMD_ERROR;
 
		if (!IsUniqueEngineName(text)) return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
 
	}
 

	
src/engine_type.h
Show inline comments
 
@@ -146,7 +146,7 @@ enum EngineFlags {
 
};
 

	
 
static const uint NUM_VEHICLE_TYPES             =   6;
 
static const uint MAX_LENGTH_ENGINE_NAME_BYTES  =  31; ///< The maximum length of an engine name in bytes including '\0'
 
static const uint MAX_LENGTH_ENGINE_NAME_CHARS  =  31; ///< The maximum length of an engine name in characters including '\0'
 
static const uint MAX_LENGTH_ENGINE_NAME_PIXELS = 160; ///< The maximum length of an engine name in pixels
 

	
 
static const EngineID INVALID_ENGINE = 0xFFFF;
0 comments (0 inline, 0 general)