summaryrefslogtreecommitdiff
path: root/unmovable_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-09-30 08:57:12 +0000
committertron <tron@openttd.org>2005-09-30 08:57:12 +0000
commit0181327f2d84f8f3a04a450559046fb8374a0b2b (patch)
tree21fe28f93938856ac66808e61f4458c17121ba34 /unmovable_cmd.c
parentfdebfbe8d531d4f7dba2af333e82af2e6befbca7 (diff)
downloadopenttd-0181327f2d84f8f3a04a450559046fb8374a0b2b.tar.xz
(svn r2999) Do not pass if the HQ gets built for the first time or gets relocated as parameter - the command function has to check this anyway
Diffstat (limited to 'unmovable_cmd.c')
-rw-r--r--unmovable_cmd.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/unmovable_cmd.c b/unmovable_cmd.c
index 1df55d764..2a5abe3ca 100644
--- a/unmovable_cmd.c
+++ b/unmovable_cmd.c
@@ -60,7 +60,7 @@ int32 DestroyCompanyHQ(TileIndex tile, uint32 flags)
/** Build or relocate the HQ. This depends if the HQ is already built or not
* @param x,y the coordinates where the HQ will be built or relocated to
- * @param p1 relocate HQ (set to some value, usually 1 or true)
+ * @param p1 unused
* @param p2 unused
*/
extern int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, int *);
@@ -75,18 +75,10 @@ int32 CmdBuildCompanyHQ(int x, int y, uint32 flags, uint32 p1, uint32 p2)
cost = CheckFlatLandBelow(tile, 2, 2, flags, 0, NULL);
if (CmdFailed(cost)) return CMD_ERROR;
- if (p1) { /* Moving HQ */
- int32 ret;
-
- if (p->location_of_house == 0) return CMD_ERROR;
-
- ret = DestroyCompanyHQ(p->location_of_house, flags);
-
+ if (p->location_of_house != 0) { /* Moving HQ */
+ int32 ret = DestroyCompanyHQ(p->location_of_house, flags);
if (CmdFailed(ret)) return CMD_ERROR;
-
cost += ret;
- } else { /* Building new HQ */
- if (p->location_of_house != 0) return CMD_ERROR;
}
if (flags & DC_EXEC) {