(svn r13712) -Fix: enforce the length restrictions of company and president name in the commands too.

This commit is contained in:
rubidium
2008-07-17 11:19:20 +00:00
parent 7c531c4ece
commit 03afcec36f
6 changed files with 12 additions and 5 deletions

View File

@@ -225,7 +225,7 @@ static bool IsUniqueCompanyName(const char *name)
*/
CommandCost CmdChangeCompanyName(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
if (StrEmpty(_cmd_text)) return CMD_ERROR;
if (StrEmpty(_cmd_text) || strlen(_cmd_text) > MAX_LENGTH_COMPANY_NAME) return CMD_ERROR;
if (!IsUniqueCompanyName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);
@@ -262,7 +262,7 @@ static bool IsUniquePresidentName(const char *name)
*/
CommandCost CmdChangePresidentName(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
if (StrEmpty(_cmd_text)) return CMD_ERROR;
if (StrEmpty(_cmd_text) || strlen(_cmd_text) > MAX_LENGTH_PRESIDENT_NAME) return CMD_ERROR;
if (!IsUniquePresidentName(_cmd_text)) return_cmd_error(STR_NAME_MUST_BE_UNIQUE);