equal
deleted
inserted
replaced
348 { |
348 { |
349 int house, rating; |
349 int house, rating; |
350 int32 cost; |
350 int32 cost; |
351 Town *t; |
351 Town *t; |
352 |
352 |
353 // safety checks |
|
354 if (!EnsureNoVehicle(tile)) return CMD_ERROR; |
|
355 if (flags&DC_AUTO && !(flags&DC_AI_BUILDING)) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED); |
353 if (flags&DC_AUTO && !(flags&DC_AI_BUILDING)) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED); |
356 |
354 |
357 house = GetHouseType(tile); |
355 house = GetHouseType(tile); |
358 cost = _price.remove_house * _housetype_remove_cost[house] >> 8; |
356 cost = _price.remove_house * _housetype_remove_cost[house] >> 8; |
359 |
357 |
728 // Try to grow the town from this point |
726 // Try to grow the town from this point |
729 GrowTownInTile(&tile,mask,block,t); |
727 GrowTownInTile(&tile,mask,block,t); |
730 |
728 |
731 // Exclude the source position from the bitmask |
729 // Exclude the source position from the bitmask |
732 // and return if no more road blocks available |
730 // and return if no more road blocks available |
733 mask = ClrBitT(mask, (block ^ 2)); |
731 ClrBitT(mask, (block ^ 2)); |
734 if (mask == 0) |
732 if (mask == 0) |
735 return _grow_town_result; |
733 return _grow_town_result; |
736 |
734 |
737 // Select a random bit from the blockmask, walk a step |
735 // Select a random bit from the blockmask, walk a step |
738 // and continue the search from there. |
736 // and continue the search from there. |
1301 |
1299 |
1302 static bool BuildTownHouse(Town *t, TileIndex tile) |
1300 static bool BuildTownHouse(Town *t, TileIndex tile) |
1303 { |
1301 { |
1304 int32 r; |
1302 int32 r; |
1305 |
1303 |
1306 // make sure it's possible |
|
1307 if (!EnsureNoVehicle(tile)) return false; |
|
1308 if (IsSteepSlope(GetTileSlope(tile, NULL))) return false; |
1304 if (IsSteepSlope(GetTileSlope(tile, NULL))) return false; |
1309 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false; |
1305 if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false; |
1310 |
1306 |
1311 r = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR); |
1307 r = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR); |
1312 if (CmdFailed(r)) return false; |
1308 if (CmdFailed(r)) return false; |