branch | gamebalance |
changeset 9912 | 1ac8aac92385 |
parent 9911 | 0b8b245a2391 |
child 9913 | e79cd19772dd |
9911:0b8b245a2391 | 9912:1ac8aac92385 |
---|---|
21 #include "news.h" |
21 #include "news.h" |
22 #include "sound.h" |
22 #include "sound.h" |
23 #include "depot.h" |
23 #include "depot.h" |
24 #include "vehicle_gui.h" |
24 #include "vehicle_gui.h" |
25 #include "train.h" |
25 #include "train.h" |
26 #include "roadveh.h" |
|
26 #include "water_map.h" |
27 #include "water_map.h" |
27 #include "newgrf.h" |
28 #include "newgrf.h" |
28 #include "newgrf_canal.h" |
29 #include "newgrf_canal.h" |
29 |
30 |
30 static const SpriteID _water_shore_sprites[] = { |
31 static const SpriteID _water_shore_sprites[] = { |
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 |
723 if (TileY(tile) == MapSizeY() - 2 && IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1)) { //SE |
724 if (TileY(tile) == MapSizeY() - 2 && IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1)) { //SE |
724 TileLoopWaterHelper(tile, _tile_loop_offs_array[3]); |
725 TileLoopWaterHelper(tile, _tile_loop_offs_array[3]); |
725 } |
726 } |
726 } |
727 } |
727 |
728 |
728 static uint32 GetTileTrackStatus_Water(TileIndex tile, TransportType mode) |
729 static uint32 GetTileTrackStatus_Water(TileIndex tile, TransportType mode, uint sub_mode) |
729 { |
730 { |
730 static const byte coast_tracks[] = {0, 32, 4, 0, 16, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0}; |
731 static const byte coast_tracks[] = {0, 32, 4, 0, 16, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0}; |
731 |
732 |
732 TrackBits ts; |
733 TrackBits ts; |
733 |
734 |