unmovable_cmd.c
changeset 3491 35d747bb5e82
parent 3427 3a512f7b7f6a
child 3636 a36cc46e754d
equal deleted inserted replaced
3490:d53bc3e794bd 3491:35d747bb5e82
    80 	MarkTileDirtyByTile(tile + TileDiffXY(1, 0));
    80 	MarkTileDirtyByTile(tile + TileDiffXY(1, 0));
    81 	MarkTileDirtyByTile(tile + TileDiffXY(1, 1));
    81 	MarkTileDirtyByTile(tile + TileDiffXY(1, 1));
    82 }
    82 }
    83 
    83 
    84 /** Build or relocate the HQ. This depends if the HQ is already built or not
    84 /** Build or relocate the HQ. This depends if the HQ is already built or not
    85  * @param x,y the coordinates where the HQ will be built or relocated to
    85  * @param tile tile where the HQ will be built or relocated to
    86  * @param p1 unused
    86  * @param p1 unused
    87  * @param p2 unused
    87  * @param p2 unused
    88  */
    88  */
    89 extern int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, int *);
    89 extern int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invalid_dirs, int *);
    90 int32 CmdBuildCompanyHQ(int x, int y, uint32 flags, uint32 p1, uint32 p2)
    90 int32 CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
    91 {
    91 {
    92 	TileIndex tile = TileVirtXY(x, y);
       
    93 	Player *p = GetPlayer(_current_player);
    92 	Player *p = GetPlayer(_current_player);
    94 	int cost;
    93 	int cost;
    95 	int32 ret;
    94 	int32 ret;
    96 
    95 
    97 	SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
    96 	SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
   217 		if (_current_player == OWNER_WATER) return DestroyCompanyHQ(tile, DC_EXEC);
   216 		if (_current_player == OWNER_WATER) return DestroyCompanyHQ(tile, DC_EXEC);
   218 		return_cmd_error(STR_5804_COMPANY_HEADQUARTERS_IN);
   217 		return_cmd_error(STR_5804_COMPANY_HEADQUARTERS_IN);
   219 	}
   218 	}
   220 
   219 
   221 	if (IsOwnedLand(tile)) {
   220 	if (IsOwnedLand(tile)) {
   222 		return DoCommandByTile(tile, 0, 0, flags, CMD_SELL_LAND_AREA);
   221 		return DoCommand(tile, 0, 0, flags, CMD_SELL_LAND_AREA);
   223 	}
   222 	}
   224 
   223 
   225 	// checks if you're allowed to remove unmovable things
   224 	// checks if you're allowed to remove unmovable things
   226 	if (_game_mode != GM_EDITOR && _current_player != OWNER_WATER && ((flags & DC_AUTO || !_cheats.magic_bulldozer.value)) )
   225 	if (_game_mode != GM_EDITOR && _current_player != OWNER_WATER && ((flags & DC_AUTO || !_cheats.magic_bulldozer.value)) )
   227 		return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);
   226 		return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);