(svn r21412) -Codechange: limit company name by amount of characters, not bytes

This commit is contained in:
rubidium
2010-12-05 22:24:50 +00:00
parent 48101ae6a7
commit dd618051a7
8 changed files with 17 additions and 15 deletions

View File

@@ -38,7 +38,7 @@
/* static */ bool AICompany::SetName(const char *name)
{
EnforcePrecondition(false, !::StrEmpty(name));
EnforcePreconditionCustomError(false, ::strlen(name) < MAX_LENGTH_COMPANY_NAME_BYTES, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_COMPANY_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
return AIObject::DoCommand(0, 0, 0, CMD_RENAME_COMPANY, name);
}