# HG changeset patch # User MJP # Date 1392388626 -3600 # Fri Feb 14 15:37:06 2014 +0100 # Node ID 0060fe9e4fc7a977e967cc87a4e9d9816febff13 # Parent 44c7e40c16a7f70a2a86d828ae4780f34ef7cef8 ScriptTown::FoundTown() should not call GenerateTownName() when a name is provided by the GS diff -r 44c7e40c16a7 -r 0060fe9e4fc7 src/script/api/script_town.cpp --- a/src/script/api/script_town.cpp Wed Feb 12 18:45:21 2014 +0000 +++ b/src/script/api/script_town.cpp Fri Feb 14 15:37:06 2014 +0100 @@ -291,16 +291,17 @@ layout = (RoadLayout) (byte)_settings_game.economy.town_layout; } + uint32 townnameparts = 0; const char *text = NULL; if (name != NULL) { text = name->GetDecodedText(); EnforcePreconditionEncodedText(false, text); EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_TOWN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG); - } - uint32 townnameparts; - if (!GenerateTownName(&townnameparts)) { - ScriptObject::SetLastError(ScriptError::ERR_NAME_IS_NOT_UNIQUE); - return false; + } else { + if (!GenerateTownName(&townnameparts)) { + ScriptObject::SetLastError(ScriptError::ERR_NAME_IS_NOT_UNIQUE); + return false; + } } return ScriptObject::DoCommand(tile, size | (city ? 1 << 2 : 0) | layout << 3, townnameparts, CMD_FOUND_TOWN, text);