(svn r26270) -Fix-ish: If ScriptTown::FoundTown fails to generate a new random town name, don't bother sending a command, but fail immediately.

This commit is contained in:
frosch 2014-01-20 22:34:22 +00:00
parent efe6adba6a
commit f36d084db5
1 changed files with 4 additions and 1 deletions

View File

@ -298,7 +298,10 @@
EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_TOWN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
}
uint32 townnameparts;
GenerateTownName(&townnameparts);
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);
}