MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / Crash

Method Crash

src/roadveh_cmd.cpp:540–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538}
539
540uint RoadVehicle::Crash(bool flooded)
541{
542 uint victims = this->GroundVehicleBase::Crash(flooded);
543 if (this->IsFrontEngine()) {
544 victims += 1; // driver
545
546 /* If we're in a drive through road stop we ought to leave it */
547 if (IsInsideMM(this->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END)) {
548 RoadStop::GetByTile(this->tile, GetRoadStopType(this->tile))->Leave(this);
549 }
550 }
551 this->crashed_ctr = flooded ? 2000 : 1; // max 2220, disappear pretty fast when flooded
552 return victims;
553}
554
555static void RoadVehCrash(RoadVehicle *v)
556{

Callers 1

RoadVehCrashFunction · 0.45

Calls 4

IsInsideMMFunction · 0.85
GetRoadStopTypeFunction · 0.85
IsFrontEngineMethod · 0.80
LeaveMethod · 0.80

Tested by

no test coverage detected