639 static void FloodVehicle(Vehicle *v) |
640 static void FloodVehicle(Vehicle *v) |
640 { |
641 { |
641 if (!(v->vehstatus & VS_CRASHED)) { |
642 if (!(v->vehstatus & VS_CRASHED)) { |
642 uint16 pass = 0; |
643 uint16 pass = 0; |
643 |
644 |
644 if (v->type == VEH_ROAD) { // flood bus/truck |
645 if (v->type == VEH_TRAIN || v->type == VEH_ROAD) { |
645 pass = 1; // driver |
|
646 if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) pass += v->cargo_count; |
|
647 |
|
648 v->vehstatus |= VS_CRASHED; |
|
649 v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast |
|
650 RebuildVehicleLists(); |
|
651 } else if (v->type == VEH_TRAIN) { |
|
652 Vehicle *u; |
646 Vehicle *u; |
653 |
647 |
654 v = GetFirstVehicleInChain(v); |
648 v = GetFirstVehicleInChain(v); |
655 u = v; |
649 u = v; |
656 if (IsFrontEngine(v)) pass = 4; // driver |
650 |
657 |
651 /* crash all wagons, and count passengers */ |
658 /* crash all wagons, and count passangers */ |
|
659 BEGIN_ENUM_WAGONS(v) |
652 BEGIN_ENUM_WAGONS(v) |
660 if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) pass += v->cargo_count; |
653 if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) pass += v->cargo_count; |
661 v->vehstatus |= VS_CRASHED; |
654 v->vehstatus |= VS_CRASHED; |
662 MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1); |
655 MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1); |
663 END_ENUM_WAGONS(v) |
656 END_ENUM_WAGONS(v) |
664 |
657 |
665 v = u; |
658 v = u; |
666 v->u.rail.crash_anim_pos = 4000; // max 4440, disappear pretty fast |
659 |
|
660 if (v->type == VEH_TRAIN) { |
|
661 if (IsFrontEngine(v)) pass += 4; // driver |
|
662 v->u.rail.crash_anim_pos = 4000; // max 4440, disappear pretty fast |
|
663 } else { |
|
664 if (IsRoadVehFront(v)) pass += 1; // driver |
|
665 v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast |
|
666 } |
|
667 |
667 RebuildVehicleLists(); |
668 RebuildVehicleLists(); |
668 } else { |
669 } else { |
669 return; |
670 return; |
670 } |
671 } |
671 |
672 |