summaryrefslogtreecommitdiff
path: root/src/object_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-28 17:29:12 +0000
committerrubidium <rubidium@openttd.org>2010-08-28 17:29:12 +0000
commit34da98f2b14e63c7042f44271d0b452fcd970737 (patch)
treecb2dccaff1ff58b3a26b4d0528d29b205f472c35 /src/object_cmd.cpp
parentf1f1c71a415354b00c744573eec7e7b2ce3cf7a4 (diff)
downloadopenttd-34da98f2b14e63c7042f44271d0b452fcd970737.tar.xz
(svn r20647) -Codechange: update some of the object spec information
Diffstat (limited to 'src/object_cmd.cpp')
-rw-r--r--src/object_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
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;