diff options
author | smatz <smatz@openttd.org> | 2009-05-18 16:21:28 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-18 16:21:28 +0000 |
commit | 8808f3beea881af5652716c883a21c8031b5e390 (patch) | |
tree | bc14c65d1e66c407b72d254fc926d105eea2f1e4 /src/console_cmds.cpp | |
parent | 5fe906e14992f7a301ae94c357e80af076ab7a63 (diff) | |
download | openttd-8808f3beea881af5652716c883a21c8031b5e390.tar.xz |
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r-- | src/console_cmds.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index cde830aa0..66fa867e9 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -716,8 +716,6 @@ DEF_CONSOLE_CMD(ConMoveClient) DEF_CONSOLE_CMD(ConResetCompany) { - CompanyID index; - if (argc == 0) { IConsoleHelp("Remove an idle company from the game. Usage: 'reset_company <company-id>'"); IConsoleHelp("For company-id's, see the list of companies from the dropdown menu. Company 1 is 1, etc."); @@ -726,16 +724,15 @@ DEF_CONSOLE_CMD(ConResetCompany) if (argc != 2) return false; - index = (CompanyID)(atoi(argv[1]) - 1); + CompanyID index = (CompanyID)(atoi(argv[1]) - 1); + const Company *c = Company::GetIfValid(index); /* Check valid range */ - if (!Company::IsValidID(index)) { + if (c == NULL) { IConsolePrintF(CC_ERROR, "Company does not exist. Company-id must be between 1 and %d.", MAX_COMPANIES); return true; } - const Company *c = Company::Get(index); - if (c->is_ai) { IConsoleError("Company is owned by an AI."); return true; |