summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-02-02 22:01:01 +0000
committersmatz <smatz@openttd.org>2011-02-02 22:01:01 +0000
commita42c0ea88b7024172d9cf326dabdbc407acee07c (patch)
tree6b5062644cb218ab8d369035e5bbb5f7ed5d2d03 /src
parent8118f745752b893c5c6088103bb3de53260d12f5 (diff)
downloadopenttd-a42c0ea88b7024172d9cf326dabdbc407acee07c.tar.xz
(svn r21944) -Codechange: give name to one magic constant
Diffstat (limited to 'src')
-rw-r--r--src/disaster_cmd.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 50c96f005..38c366ed5 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -67,6 +67,8 @@ enum DisasterSubType {
ST_BIG_SUBMARINE,
};
+static const uint INITIAL_DISASTER_VEHICLE_ZPOS = 135; ///< Initial Z position of flying disaster vehicles.
+
static void DisasterClearSquare(TileIndex tile)
{
if (EnsureNoVehicleOnGround(tile).Failed()) return;
@@ -527,7 +529,7 @@ static bool DisasterTick_Big_Ufo(DisasterVehicle *v)
}
DisasterVehicle *u = new DisasterVehicle();
- InitializeDisasterVehicle(u, -6 * (int)TILE_SIZE, v->y_pos, 135, DIR_SW, ST_BIG_UFO_DESTROYER);
+ InitializeDisasterVehicle(u, -6 * (int)TILE_SIZE, v->y_pos, INITIAL_DISASTER_VEHICLE_ZPOS, DIR_SW, ST_BIG_UFO_DESTROYER);
u->big_ufo_destroyer_target = v->index;
DisasterVehicle *w = new DisasterVehicle();
@@ -691,7 +693,7 @@ static void Disaster_Zeppeliner_Init()
}
DisasterVehicle *v = new DisasterVehicle();
- InitializeDisasterVehicle(v, x, 0, 135, DIR_SE, ST_ZEPPELINER);
+ InitializeDisasterVehicle(v, x, 0, INITIAL_DISASTER_VEHICLE_ZPOS, DIR_SE, ST_ZEPPELINER);
/* Allocate shadow */
DisasterVehicle *u = new DisasterVehicle();
@@ -712,7 +714,7 @@ static void Disaster_Small_Ufo_Init()
DisasterVehicle *v = new DisasterVehicle();
int x = TileX(Random()) * TILE_SIZE + TILE_SIZE / 2;
- InitializeDisasterVehicle(v, x, 0, 135, DIR_SE, ST_SMALL_UFO);
+ InitializeDisasterVehicle(v, x, 0, INITIAL_DISASTER_VEHICLE_ZPOS, DIR_SE, ST_SMALL_UFO);
v->dest_tile = TileXY(MapSizeX() / 2, MapSizeY() / 2);
v->age = 0;
@@ -746,7 +748,7 @@ static void Disaster_Airplane_Init()
int x = (MapSizeX() + 9) * TILE_SIZE - 1;
int y = TileY(found->location.tile) * TILE_SIZE + 37;
- InitializeDisasterVehicle(v, x, y, 135, DIR_NE, ST_AIRPLANE);
+ InitializeDisasterVehicle(v, x, y, INITIAL_DISASTER_VEHICLE_ZPOS, DIR_NE, ST_AIRPLANE);
DisasterVehicle *u = new DisasterVehicle();
v->SetNext(u);
@@ -776,7 +778,7 @@ static void Disaster_Helicopter_Init()
int x = -16 * (int)TILE_SIZE;
int y = TileY(found->location.tile) * TILE_SIZE + 37;
- InitializeDisasterVehicle(v, x, y, 135, DIR_SW, ST_HELICOPTER);
+ InitializeDisasterVehicle(v, x, y, INITIAL_DISASTER_VEHICLE_ZPOS, DIR_SW, ST_HELICOPTER);
DisasterVehicle *u = new DisasterVehicle();
v->SetNext(u);
@@ -799,7 +801,7 @@ static void Disaster_Big_Ufo_Init()
int x = TileX(Random()) * TILE_SIZE + TILE_SIZE / 2;
int y = MapMaxX() * TILE_SIZE - 1;
- InitializeDisasterVehicle(v, x, y, 135, DIR_NW, ST_BIG_UFO);
+ InitializeDisasterVehicle(v, x, y, INITIAL_DISASTER_VEHICLE_ZPOS, DIR_NW, ST_BIG_UFO);
v->dest_tile = TileXY(MapSizeX() / 2, MapSizeY() / 2);
v->age = 0;
@@ -965,7 +967,7 @@ void ReleaseDisastersTargetingVehicle(VehicleID vehicle)
/* Revert to target-searching */
v->current_order.SetDestination(0);
v->dest_tile = RandomTile();
- v->z_pos = 135;
+ v->z_pos = INITIAL_DISASTER_VEHICLE_ZPOS;
v->age = 0;
}
}