diff options
author | rubidium <rubidium@openttd.org> | 2009-03-15 21:29:07 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-03-15 21:29:07 +0000 |
commit | 64dcd8acc51fe8efd5e014772376a3978c4f7e42 (patch) | |
tree | bfaf4a103c8206096e8fd446b62226313a2de00f | |
parent | 95cff9979ce49c08357f190dab8438208c24437c (diff) | |
download | openttd-64dcd8acc51fe8efd5e014772376a3978c4f7e42.tar.xz |
(svn r15731) -Codechange: unify submarine creation
-rw-r--r-- | src/disaster_cmd.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp index e328c76e2..210840fa5 100644 --- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -875,12 +875,10 @@ static void Disaster_Big_Ufo_Init() } -/* Curious submarine #1, just floats around */ -static void Disaster_Small_Submarine_Init() +static void Disaster_Submarine_Init(DisasterSubType subtype) { if (!Vehicle::CanAllocateItem()) return; - Vehicle *v = new DisasterVehicle(); int y; Direction dir; uint32 r = Random(); @@ -893,31 +891,23 @@ static void Disaster_Small_Submarine_Init() y = TILE_SIZE / 2; dir = DIR_SE; } - InitializeDisasterVehicle(v, x, y, 0, dir, ST_Small_Submarine); + + Vehicle *v = new DisasterVehicle(); + InitializeDisasterVehicle(v, x, y, 0, dir, subtype); v->age = 0; } +/* Curious submarine #1, just floats around */ +static void Disaster_Small_Submarine_Init() +{ + Disaster_Submarine_Init(ST_Small_Submarine); +} + /* Curious submarine #2, just floats around */ static void Disaster_Big_Submarine_Init() { - if (!Vehicle::CanAllocateItem()) return; - - Vehicle *v = new DisasterVehicle(); - int y; - Direction dir; - uint32 r = Random(); - int x = TileX(r) * TILE_SIZE + TILE_SIZE / 2; - - if (HasBit(r, 31)) { - y = MapMaxX() * TILE_SIZE - TILE_SIZE / 2 - 1; - dir = DIR_NW; - } else { - y = TILE_SIZE / 2; - dir = DIR_SE; - } - InitializeDisasterVehicle(v, x, y, 0, dir, ST_Big_Submarine); - v->age = 0; + Disaster_Submarine_Init(ST_Big_Submarine); } |