summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-28 21:59:18 +0000
committeryexo <yexo@openttd.org>2010-01-28 21:59:18 +0000
commitda3ff51759f75ef76b896d19a5ca6b88a586e724 (patch)
treef4241dd5563ffb2db2d8e7c9f8d0f0038dfc1a53
parentd4376779f843b1310a3e0c9a527f1a23698954ab (diff)
downloadopenttd-da3ff51759f75ef76b896d19a5ca6b88a586e724.tar.xz
(svn r18940) -Feature: make the crash position of aircraft a bit random by giving aircraft a chance to crash every tick they're breaking.
Slow aircraft will crash a bit less, fast aircraft might crash a bit more
-rw-r--r--src/aircraft_cmd.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 812187f2e..d2b85ed1a 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -836,6 +836,9 @@ static byte AircraftGetEntryPoint(const Aircraft *v, const AirportFTAClass *apc)
return apc->entry_points[dir];
}
+
+static void MaybeCrashAirplane(Aircraft *v);
+
/**
* Controls the movement of an aircraft. This function actually moves the vehicle
* on the map and takes care of minor things like sound playback.
@@ -967,6 +970,11 @@ static bool AircraftController(Aircraft *v)
return false;
}
+ if (amd->flag & AMED_BRAKE && v->cur_speed > SPEED_LIMIT_TAXI * _settings_game.vehicle.plane_speed) {
+ MaybeCrashAirplane(v);
+ if ((v->vehstatus & VS_CRASHED) != 0) return false;
+ }
+
uint speed_limit = SPEED_LIMIT_TAXI;
bool hard_limit = true;
@@ -1293,7 +1301,7 @@ static void MaybeCrashAirplane(Aircraft *v)
prob = 0x10000 / 20;
}
- if (GB(Random(), 0, 16) > prob) return;
+ if (GB(Random(), 0, 22) > prob) return;
/* Crash the airplane. Remove all goods stored at the station. */
for (CargoID i = 0; i < NUM_CARGO; i++) {
@@ -1336,7 +1344,6 @@ static void AircraftLandAirplane(Aircraft *v)
if (!PlayVehicleSound(v, VSE_TOUCHDOWN)) {
SndPlayVehicleFx(SND_17_SKID_PLANE, v);
}
- MaybeCrashAirplane(v);
}