summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/aircraft_cmd.cpp13
-rw-r--r--src/disaster_cmd.cpp25
2 files changed, 12 insertions, 26 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 3f9e6f7e2..cd1eeff15 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -460,11 +460,6 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
-static void DoDeleteAircraft(Vehicle *v)
-{
- delete v;
-}
-
/** Sell an aircraft.
* @param tile unused
* @param flags for command type
@@ -486,9 +481,7 @@ CommandCost CmdSellAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
CommandCost ret(EXPENSES_NEW_VEHICLES, -v->value);
if (flags & DC_EXEC) {
- // Invalidate depot
- InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
- DoDeleteAircraft(v);
+ delete v;
}
return ret;
@@ -1235,9 +1228,7 @@ static void HandleCrashedAircraft(Vehicle *v)
CLRBITS(st->airport_flags, RUNWAY_IN2_block); // intercontinental
}
- MarkSingleVehicleDirty(v);
-
- DoDeleteAircraft(v);
+ delete v;
}
}
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 18ffc26a6..37a2a3bb0 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -146,11 +146,6 @@ static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, Directio
MarkSingleVehicleDirty(v);
}
-static void DeleteDisasterVeh(Vehicle *v)
-{
- delete v;
-}
-
static void SetDisasterVehiclePos(Vehicle *v, int x, int y, byte z)
{
Vehicle *u;
@@ -241,7 +236,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
}
}
- if (v->y_pos >= ((int)MapSizeY() + 9) * TILE_SIZE - 1) DeleteDisasterVeh(v);
+ if (v->y_pos >= ((int)MapSizeY() + 9) * TILE_SIZE - 1) delete v;
return;
}
@@ -259,7 +254,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
}
SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos);
- DeleteDisasterVeh(v);
+ delete v;
return;
}
@@ -338,12 +333,12 @@ static void DisasterTick_Ufo(Vehicle *v)
}
}
- DeleteDisasterVeh(v);
+ delete v;
} else {
/* Target a vehicle */
u = GetVehicle(v->dest_tile);
if (u->type != VEH_ROAD || !IsRoadVehFront(u)) {
- DeleteDisasterVeh(v);
+ delete v;
return;
}
@@ -382,7 +377,7 @@ static void DisasterTick_Ufo(Vehicle *v)
if (v->age > 50) {
CreateEffectVehicleRel(v, 0, 7, 8, EV_EXPLOSION_LARGE);
SndPlayVehicleFx(SND_12_EXPLOSION, v);
- DeleteDisasterVeh(v);
+ delete v;
}
}
}
@@ -417,7 +412,7 @@ static void DisasterTick_Airplane(Vehicle *v)
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
if (gp.x < (-10 * TILE_SIZE)) {
- DeleteDisasterVeh(v);
+ delete v;
return;
}
@@ -490,7 +485,7 @@ static void DisasterTick_Helicopter(Vehicle *v)
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
if (gp.x > (int)MapSizeX() * TILE_SIZE + 9 * TILE_SIZE - 1) {
- DeleteDisasterVeh(v);
+ delete v;
return;
}
@@ -611,7 +606,7 @@ static void DisasterTick_Big_Ufo(Vehicle *v)
u = new DisasterVehicle();
if (u == NULL) {
- DeleteDisasterVeh(v);
+ delete v;
return;
}
@@ -671,7 +666,7 @@ static void DisasterTick_Big_Ufo_Destroyer(Vehicle *v)
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
if (gp.x > (int)MapSizeX() * TILE_SIZE + 9 * TILE_SIZE - 1) {
- DeleteDisasterVeh(v);
+ delete v;
return;
}
@@ -683,7 +678,7 @@ static void DisasterTick_Big_Ufo_Destroyer(Vehicle *v)
CreateEffectVehicleRel(u, 0, 7, 8, EV_EXPLOSION_LARGE);
SndPlayVehicleFx(SND_12_EXPLOSION, u);
- DeleteDisasterVeh(u);
+ delete u;
for (i = 0; i != 80; i++) {
uint32 r = Random();