mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(svn r21879) -Codechange: reset vehicle's GOINGUP/DOWN bits when it crashes
This commit is contained in:
parent
9ae2016de8
commit
a3ae023fdb
@ -86,6 +86,21 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
|
|||||||
void CargoChanged();
|
void CargoChanged();
|
||||||
int GetAcceleration() const;
|
int GetAcceleration() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common code executed for crashed ground vehicles
|
||||||
|
* @param flooded was this vehicle flooded?
|
||||||
|
* @return number of victims
|
||||||
|
*/
|
||||||
|
/* virtual */ uint Crash(bool flooded)
|
||||||
|
{
|
||||||
|
/* Crashed vehicles aren't going up or down */
|
||||||
|
for (T *v = T::From(this); v != NULL; v = v->Next()) {
|
||||||
|
ClrBit(v->gv_flags, GVF_GOINGUP_BIT);
|
||||||
|
ClrBit(v->gv_flags, GVF_GOINGDOWN_BIT);
|
||||||
|
}
|
||||||
|
return this->Vehicle::Crash(flooded);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the total slope resistance for this vehicle.
|
* Calculates the total slope resistance for this vehicle.
|
||||||
* @return Slope resistance.
|
* @return Slope resistance.
|
||||||
|
@ -460,7 +460,7 @@ static Vehicle *EnumCheckRoadVehCrashTrain(Vehicle *v, void *data)
|
|||||||
|
|
||||||
uint RoadVehicle::Crash(bool flooded)
|
uint RoadVehicle::Crash(bool flooded)
|
||||||
{
|
{
|
||||||
uint pass = Vehicle::Crash(flooded);
|
uint pass = this->GroundVehicleBase::Crash(flooded);
|
||||||
if (this->IsFrontEngine()) {
|
if (this->IsFrontEngine()) {
|
||||||
pass += 1; // driver
|
pass += 1; // driver
|
||||||
|
|
||||||
|
@ -2780,7 +2780,7 @@ uint Train::Crash(bool flooded)
|
|||||||
HideFillingPercent(&this->fill_percent_te_id);
|
HideFillingPercent(&this->fill_percent_te_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
pass += Vehicle::Crash(flooded);
|
pass += this->GroundVehicleBase::Crash(flooded);
|
||||||
|
|
||||||
this->crash_anim_pos = flooded ? 4000 : 1; // max 4440, disappear pretty fast when flooded
|
this->crash_anim_pos = flooded ? 4000 : 1; // max 4440, disappear pretty fast when flooded
|
||||||
return pass;
|
return pass;
|
||||||
|
Loading…
Reference in New Issue
Block a user