(svn r20651) -Codechange: add a function to determine whether an object is available and use it

This commit is contained in:
rubidium
2010-08-28 17:36:28 +00:00
parent 6348aa7964
commit 0a86eac2f1
3 changed files with 18 additions and 1 deletions

View File

@@ -122,7 +122,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
ObjectType type = (ObjectType)GB(p1, 0, 8);
const ObjectSpec *spec = ObjectSpec::Get(type);
if (!spec->enabled) return CMD_ERROR;
if (!spec->IsAvailable()) return CMD_ERROR;
if (spec->flags & OBJECT_FLAG_ONLY_IN_SCENEDIT && (_game_mode != GM_EDITOR || _current_company != OWNER_NONE)) return CMD_ERROR;
if (spec->flags & OBJECT_FLAG_ONLY_IN_GAME && (_game_mode != GM_NORMAL || _current_company > MAX_COMPANIES)) return CMD_ERROR;