mirror of https://github.com/OpenTTD/OpenTTD
(svn r23101) -Codechange: remove pointless multiplications by TILE_HEIGHT from the station/object building code
parent
1dc685aeea
commit
a8c4efcff4
|
@ -230,7 +230,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
|
|
||||||
/* So, now the surface is checked... check the slope of said surface. */
|
/* So, now the surface is checked... check the slope of said surface. */
|
||||||
int allowed_z;
|
int allowed_z;
|
||||||
if (GetTilePixelSlope(tile, (uint*)&allowed_z) != SLOPE_FLAT) allowed_z += TILE_HEIGHT;
|
if (GetTileSlope(tile, (uint*)&allowed_z) != SLOPE_FLAT) allowed_z++;
|
||||||
|
|
||||||
TILE_AREA_LOOP(t, ta) {
|
TILE_AREA_LOOP(t, ta) {
|
||||||
uint16 callback = CALLBACK_FAILED;
|
uint16 callback = CALLBACK_FAILED;
|
||||||
|
@ -643,7 +643,7 @@ void GenerateObjects()
|
||||||
TileIndex tile = RandomTile();
|
TileIndex tile = RandomTile();
|
||||||
|
|
||||||
uint h;
|
uint h;
|
||||||
if (IsTileType(tile, MP_CLEAR) && GetTilePixelSlope(tile, &h) == SLOPE_FLAT && h >= TILE_HEIGHT * 4 && !IsBridgeAbove(tile)) {
|
if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == SLOPE_FLAT && h >= 4 && !IsBridgeAbove(tile)) {
|
||||||
TileIndex t = tile;
|
TileIndex t = tile;
|
||||||
if (CircularTileSearch(&t, 9, HasTransmitter, NULL)) continue;
|
if (CircularTileSearch(&t, 9, HasTransmitter, NULL)) continue;
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ void GenerateObjects()
|
||||||
|
|
||||||
for (int j = 0; j < 19; j++) {
|
for (int j = 0; j < 19; j++) {
|
||||||
uint h;
|
uint h;
|
||||||
if (IsTileType(tile, MP_CLEAR) && GetTilePixelSlope(tile, &h) == SLOPE_FLAT && h <= TILE_HEIGHT * 2 && !IsBridgeAbove(tile)) {
|
if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == SLOPE_FLAT && h <= 2 && !IsBridgeAbove(tile)) {
|
||||||
BuildObject(OBJECT_LIGHTHOUSE, tile);
|
BuildObject(OBJECT_LIGHTHOUSE, tile);
|
||||||
IncreaseGeneratingWorldProgress(GWP_OBJECT);
|
IncreaseGeneratingWorldProgress(GWP_OBJECT);
|
||||||
lighthouses_to_build--;
|
lighthouses_to_build--;
|
||||||
|
|
|
@ -306,8 +306,8 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check elevation compared to town */
|
/* check elevation compared to town */
|
||||||
uint z = GetTilePixelZ(tile);
|
uint z = GetTileZ(tile);
|
||||||
uint z2 = GetTilePixelZ(t->xy);
|
uint z2 = GetTileZ(t->xy);
|
||||||
if (z < z2) {
|
if (z < z2) {
|
||||||
if (HasBit(free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY;
|
if (HasBit(free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY;
|
||||||
} else if (z > z2) {
|
} else if (z > z2) {
|
||||||
|
@ -665,7 +665,7 @@ CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
uint z;
|
uint z;
|
||||||
Slope tileh = GetTilePixelSlope(tile, &z);
|
Slope tileh = GetTileSlope(tile, &z);
|
||||||
|
|
||||||
/* Prohibit building if
|
/* Prohibit building if
|
||||||
* 1) The tile is "steep" (i.e. stretches two height levels).
|
* 1) The tile is "steep" (i.e. stretches two height levels).
|
||||||
|
@ -677,7 +677,7 @@ CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
int flat_z = z + GetSlopeMaxPixelZ(tileh);
|
int flat_z = z + GetSlopeMaxZ(tileh);
|
||||||
if (tileh != SLOPE_FLAT) {
|
if (tileh != SLOPE_FLAT) {
|
||||||
/* Forbid building if the tile faces a slope in a invalid direction. */
|
/* Forbid building if the tile faces a slope in a invalid direction. */
|
||||||
for (DiagDirection dir = DIAGDIR_BEGIN; dir != DIAGDIR_END; dir++) {
|
for (DiagDirection dir = DIAGDIR_BEGIN; dir != DIAGDIR_END; dir++) {
|
||||||
|
|
|
@ -1935,7 +1935,7 @@ static inline bool CheckBuildHouseSameZ(TileIndex tile, TownID town, uint z, boo
|
||||||
if (!CanBuildHouseHere(tile, town, noslope)) return false;
|
if (!CanBuildHouseHere(tile, town, noslope)) return false;
|
||||||
|
|
||||||
/* if building on slopes is allowed, there will be flattening foundation (to tile max z) */
|
/* if building on slopes is allowed, there will be flattening foundation (to tile max z) */
|
||||||
if (GetTileMaxPixelZ(tile) != z) return false;
|
if (GetTileMaxZ(tile) != z) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2139,7 +2139,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
|
||||||
houses[num++] = (HouseID)i;
|
houses[num++] = (HouseID)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint maxz = GetTileMaxPixelZ(tile);
|
uint maxz = GetTileMaxZ(tile);
|
||||||
TileIndex baseTile = tile;
|
TileIndex baseTile = tile;
|
||||||
|
|
||||||
while (probability_max > 0) {
|
while (probability_max > 0) {
|
||||||
|
|
Loading…
Reference in New Issue