From 34da98f2b14e63c7042f44271d0b452fcd970737 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 28 Aug 2010 17:29:12 +0000 Subject: (svn r20647) -Codechange: update some of the object spec information --- src/object_cmd.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/object_cmd.cpp') diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index a8e8e5e19..564c9f9a6 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -121,9 +121,9 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 CommandCost cost(EXPENSES_PROPERTY); ObjectType type = (ObjectType)GB(p1, 0, 8); - if (type >= OBJECT_MAX) return CMD_ERROR; - const ObjectSpec *spec = ObjectSpec::Get(type); + if (!spec->enabled) 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; @@ -195,6 +195,10 @@ static void DrawTile_Object(TileInfo *ti) { ObjectType type = GetObjectType(ti->tile); const ObjectSpec *spec = ObjectSpec::Get(type); + + /* Fall back for when the object doesn't exist anymore. */ + if (!spec->enabled) type = OBJECT_TRANSMITTER; + if ((spec->flags & OBJECT_FLAG_HAS_NO_FOUNDATION) == 0) DrawFoundation(ti, GetFoundation_Object(ti->tile, ti->tileh)); const DrawTileSprites *dts = NULL; -- cgit v1.2.3-54-g00ecf