summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2013-10-18 15:23:41 +0000
committerplanetmaker <planetmaker@openttd.org>2013-10-18 15:23:41 +0000
commit95b973ec6c25ecd3154b3e36295a753280e17a12 (patch)
treec259e38e6b10404472875eb07f0a6c9634a6bb0f
parent70e4074a4ccb0e6d7f7562bc4454ad616757b975 (diff)
downloadopenttd-95b973ec6c25ecd3154b3e36295a753280e17a12.tar.xz
(svn r25880) -Fix (r25875): Special rules for world generation needs be considered in one more place
-rw-r--r--src/object_cmd.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index 5d4d788c2..5ae1a1d69 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -209,11 +209,11 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (type >= NUM_OBJECTS) return CMD_ERROR;
uint8 view = GB(p2, 0, 2);
const ObjectSpec *spec = ObjectSpec::Get(type);
- if (_game_mode == GM_NORMAL && !spec->IsAvailable()) return CMD_ERROR;
- if (_game_mode == GM_EDITOR && !spec->WasEverAvailable()) return CMD_ERROR;
+ if (_game_mode == GM_NORMAL && !spec->IsAvailable() && !_generating_world) return CMD_ERROR;
+ if ((_game_mode == GM_EDITOR || _generating_world) && !spec->WasEverAvailable()) 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;
+ if ((spec->flags & OBJECT_FLAG_ONLY_IN_SCENEDIT) != 0 && ((!_generating_world && _game_mode != GM_EDITOR) || _current_company != OWNER_NONE)) return CMD_ERROR;
+ if ((spec->flags & OBJECT_FLAG_ONLY_IN_GAME) != 0 && (_generating_world || _game_mode != GM_NORMAL || _current_company > MAX_COMPANIES)) return CMD_ERROR;
if (view >= spec->views) return CMD_ERROR;
if (!Object::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_OBJECTS);