branch | NewGRF_ports |
changeset 6877 | 889301acc299 |
parent 6872 | 1c4a4a609f85 |
child 6878 | 7d1ff2f621c7 |
6876:2c40faeef7a5 | 6877:889301acc299 |
---|---|
30 #include "date_func.h" |
30 #include "date_func.h" |
31 #include "functions.h" |
31 #include "functions.h" |
32 #include "vehicle_func.h" |
32 #include "vehicle_func.h" |
33 #include "sound_func.h" |
33 #include "sound_func.h" |
34 #include "signal_func.h" |
34 #include "signal_func.h" |
35 #include "tunnelbridge.h" |
|
35 |
36 |
36 #include "table/sprites.h" |
37 #include "table/sprites.h" |
37 #include "table/strings.h" |
38 #include "table/strings.h" |
38 #include "table/bridge_land.h" |
39 #include "table/bridge_land.h" |
39 |
40 |
41 |
|
42 /** Describes the data that defines each bridge in the game |
|
43 * @param y year of availablity |
|
44 * @param mnl minimum length |
|
45 * @param mxl maximum length |
|
46 * @param p price |
|
47 * @param mxs maximum speed allowed |
|
48 * @param spr sprite to use in purchase GUI |
|
49 * @param plt palette for the sprite in purchase GUI |
|
50 * @param dsc description of the bridge in purchase GUI |
|
51 * @param nrl description of the rail bridge in query tool |
|
52 * @param nrd description of the road bridge in query tool |
|
53 */ |
|
54 #define MB(y, mnl, mxl, p, mxs, spr, plt, dsc, nrl, nrd) \ |
|
55 {y, mnl, mxl, p, mxs, spr, plt, dsc, nrl, nrd, NULL, 0} |
|
56 |
|
40 const Bridge orig_bridge[] = { |
57 const Bridge orig_bridge[] = { |
41 /* |
58 /* |
42 year of availablity |
59 year of availablity |
43 | minimum length |
60 | minimum length |
44 | | maximum length |
61 | | maximum length |
45 | | | price |
62 | | | price |
46 | | | | maximum speed |
63 | | | | maximum speed |
47 | | | | | sprite to use in GUI string with description |
64 | | | | | sprite to use in GUI |
48 | | | | | | | */ |
65 | | | | | | palette in GUI |
49 { 0, 0, 16, 80, 32, 0xA24, PAL_NONE , STR_5012_WOODEN , NULL, 0 }, |
66 string with description name on rail name on road |
50 { 0, 0, 2, 112, 48, 0xA26, PALETTE_TO_STRUCT_RED , STR_5013_CONCRETE , NULL, 0 }, |
67 | | | */ |
51 { 1930, 0, 5, 144, 64, 0xA25, PAL_NONE , STR_500F_GIRDER_STEEL , NULL, 0 }, |
68 MB( 0, 0, 16, 80, 32, 0xA24, PAL_NONE, |
52 { 0, 2, 10, 168, 80, 0xA22, PALETTE_TO_STRUCT_CONCRETE, STR_5011_SUSPENSION_CONCRETE, NULL, 0 }, |
69 STR_5012_WOODEN, STR_501F_WOODEN_RAIL_BRIDGE, STR_5025_WOODEN_ROAD_BRIDGE), |
53 { 1930, 3, 16, 185, 96, 0xA22, PAL_NONE , STR_500E_SUSPENSION_STEEL , NULL, 0 }, |
70 |
54 { 1930, 3, 16, 192, 112, 0xA22, PALETTE_TO_STRUCT_YELLOW , STR_500E_SUSPENSION_STEEL , NULL, 0 }, |
71 MB( 0, 0, 2, 112, 48, 0xA26, PALETTE_TO_STRUCT_RED, |
55 { 1930, 3, 7, 224, 160, 0xA23, PAL_NONE , STR_5010_CANTILEVER_STEEL , NULL, 0 }, |
72 STR_5013_CONCRETE, STR_5020_CONCRETE_RAIL_BRIDGE, STR_5026_CONCRETE_ROAD_BRIDGE), |
56 { 1930, 3, 8, 232, 208, 0xA23, PALETTE_TO_STRUCT_BROWN , STR_5010_CANTILEVER_STEEL , NULL, 0 }, |
73 |
57 { 1930, 3, 9, 248, 240, 0xA23, PALETTE_TO_STRUCT_RED , STR_5010_CANTILEVER_STEEL , NULL, 0 }, |
74 MB( 1930, 0, 5, 144, 64, 0xA25, PAL_NONE, |
58 { 1930, 0, 2, 240, 256, 0xA27, PAL_NONE , STR_500F_GIRDER_STEEL , NULL, 0 }, |
75 STR_500F_GIRDER_STEEL, STR_501C_STEEL_GIRDER_RAIL_BRIDGE, STR_5022_STEEL_GIRDER_ROAD_BRIDGE), |
59 { 1995, 2, 16, 255, 320, 0xA28, PAL_NONE , STR_5014_TUBULAR_STEEL , NULL, 0 }, |
76 |
60 { 2005, 2, 32, 380, 512, 0xA28, PALETTE_TO_STRUCT_YELLOW , STR_5014_TUBULAR_STEEL , NULL, 0 }, |
77 MB( 0, 2, 10, 168, 80, 0xA22, PALETTE_TO_STRUCT_CONCRETE, |
61 { 2010, 2, 32, 510, 608, 0xA28, PALETTE_TO_STRUCT_GREY , STR_BRIDGE_TUBULAR_SILICON , NULL, 0 } |
78 STR_5011_SUSPENSION_CONCRETE, STR_501E_REINFORCED_CONCRETE_SUSPENSION, STR_5024_REINFORCED_CONCRETE_SUSPENSION), |
79 |
|
80 MB( 1930, 3, 16, 185, 96, 0xA22, PAL_NONE, |
|
81 STR_500E_SUSPENSION_STEEL, STR_501B_STEEL_SUSPENSION_RAIL_BRIDGE, STR_5021_STEEL_SUSPENSION_ROAD_BRIDGE), |
|
82 |
|
83 MB( 1930, 3, 16, 192, 112, 0xA22, PALETTE_TO_STRUCT_YELLOW, |
|
84 STR_500E_SUSPENSION_STEEL, STR_501B_STEEL_SUSPENSION_RAIL_BRIDGE, STR_5021_STEEL_SUSPENSION_ROAD_BRIDGE), |
|
85 |
|
86 MB( 1930, 3, 7, 224, 160, 0xA23, PAL_NONE, |
|
87 STR_5010_CANTILEVER_STEEL, STR_501D_STEEL_CANTILEVER_RAIL_BRIDGE, STR_5023_STEEL_CANTILEVER_ROAD_BRIDGE), |
|
88 |
|
89 MB( 1930, 3, 8, 232, 208, 0xA23, PALETTE_TO_STRUCT_BROWN, |
|
90 STR_5010_CANTILEVER_STEEL, STR_501D_STEEL_CANTILEVER_RAIL_BRIDGE, STR_5023_STEEL_CANTILEVER_ROAD_BRIDGE), |
|
91 |
|
92 MB( 1930, 3, 9, 248, 240, 0xA23, PALETTE_TO_STRUCT_RED, |
|
93 STR_5010_CANTILEVER_STEEL, STR_501D_STEEL_CANTILEVER_RAIL_BRIDGE, STR_5023_STEEL_CANTILEVER_ROAD_BRIDGE), |
|
94 |
|
95 MB( 1930, 0, 2, 240, 256, 0xA27, PAL_NONE, |
|
96 STR_500F_GIRDER_STEEL, STR_501C_STEEL_GIRDER_RAIL_BRIDGE, STR_5022_STEEL_GIRDER_ROAD_BRIDGE), |
|
97 |
|
98 MB( 1995, 2, 16, 255, 320, 0xA28, PAL_NONE, |
|
99 STR_5014_TUBULAR_STEEL, STR_5027_TUBULAR_RAIL_BRIDGE, STR_5028_TUBULAR_ROAD_BRIDGE), |
|
100 |
|
101 MB( 2005, 2, 32, 380, 512, 0xA28, PALETTE_TO_STRUCT_YELLOW, |
|
102 STR_5014_TUBULAR_STEEL, STR_5027_TUBULAR_RAIL_BRIDGE, STR_5028_TUBULAR_ROAD_BRIDGE), |
|
103 |
|
104 MB( 2010, 2, 32, 510, 608, 0xA28, PALETTE_TO_STRUCT_GREY, |
|
105 STR_BRIDGE_TUBULAR_SILICON, STR_5027_TUBULAR_RAIL_BRIDGE, STR_5028_TUBULAR_ROAD_BRIDGE) |
|
62 }; |
106 }; |
107 |
|
108 #undef MB |
|
63 |
109 |
64 Bridge _bridge[MAX_BRIDGES]; |
110 Bridge _bridge[MAX_BRIDGES]; |
65 |
111 |
66 |
112 |
67 /** calculate the price factor for building a long bridge. |
113 /** calculate the price factor for building a long bridge. |
156 if ((*tileh != SLOPE_FLAT) && (*tileh != valid_inclined)) return CMD_ERROR; |
202 if ((*tileh != SLOPE_FLAT) && (*tileh != valid_inclined)) return CMD_ERROR; |
157 |
203 |
158 if (f == FOUNDATION_NONE) return CommandCost(); |
204 if (f == FOUNDATION_NONE) return CommandCost(); |
159 |
205 |
160 return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform); |
206 return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform); |
161 } |
|
162 |
|
163 |
|
164 uint32 GetBridgeLength(TileIndex begin, TileIndex end) |
|
165 { |
|
166 int x1 = TileX(begin); |
|
167 int y1 = TileY(begin); |
|
168 int x2 = TileX(end); |
|
169 int y2 = TileY(end); |
|
170 |
|
171 return abs(x2 + y2 - x1 - y1) - 1; |
|
172 } |
207 } |
173 |
208 |
174 bool CheckBridge_Stuff(byte bridge_type, uint bridge_len) |
209 bool CheckBridge_Stuff(byte bridge_type, uint bridge_len) |
175 { |
210 { |
176 const Bridge *b = &_bridge[bridge_type]; |
211 const Bridge *b = &_bridge[bridge_type]; |
381 } |
416 } |
382 |
417 |
383 switch (GetTileType(tile)) { |
418 switch (GetTileType(tile)) { |
384 case MP_WATER: |
419 case MP_WATER: |
385 if (!EnsureNoVehicleOnGround(tile)) return_cmd_error(STR_980E_SHIP_IN_THE_WAY); |
420 if (!EnsureNoVehicleOnGround(tile)) return_cmd_error(STR_980E_SHIP_IN_THE_WAY); |
386 if (!IsWater(tile) && !IsCoast(tile) && !IsRiver(tile)) goto not_valid_below; |
421 if (!IsWater(tile) && !IsCoast(tile)) goto not_valid_below; |
387 break; |
422 break; |
388 |
423 |
389 case MP_RAILWAY: |
424 case MP_RAILWAY: |
390 if (!IsPlainRailTile(tile)) goto not_valid_below; |
425 if (!IsPlainRailTile(tile)) goto not_valid_below; |
391 break; |
426 break; |
473 const RoadTypes rts = (RoadTypes)GB(p1, 0, 3); |
508 const RoadTypes rts = (RoadTypes)GB(p1, 0, 3); |
474 if (!AreValidRoadTypes(rts) || !HasRoadTypesAvail(_current_player, rts)) return CMD_ERROR; |
509 if (!AreValidRoadTypes(rts) || !HasRoadTypesAvail(_current_player, rts)) return CMD_ERROR; |
475 } |
510 } |
476 |
511 |
477 start_tileh = GetTileSlope(start_tile, &start_z); |
512 start_tileh = GetTileSlope(start_tile, &start_z); |
478 |
513 direction = GetInclinedSlopeDirection(start_tileh); |
479 switch (start_tileh) { |
514 if (direction == INVALID_DIAGDIR) return_cmd_error(STR_500B_SITE_UNSUITABLE_FOR_TUNNEL); |
480 case SLOPE_SW: direction = DIAGDIR_SW; break; |
515 |
481 case SLOPE_SE: direction = DIAGDIR_SE; break; |
516 if (IsWaterTile(start_tile)) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); |
482 case SLOPE_NW: direction = DIAGDIR_NW; break; |
|
483 case SLOPE_NE: direction = DIAGDIR_NE; break; |
|
484 default: return_cmd_error(STR_500B_SITE_UNSUITABLE_FOR_TUNNEL); |
|
485 } |
|
486 |
517 |
487 ret = DoCommand(start_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
518 ret = DoCommand(start_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
488 if (CmdFailed(ret)) return ret; |
519 if (CmdFailed(ret)) return ret; |
489 |
520 |
490 /* XXX - do NOT change 'ret' in the loop, as it is used as the price |
521 /* XXX - do NOT change 'ret' in the loop, as it is used as the price |
533 cost.AddCost(_price.build_tunnel); |
564 cost.AddCost(_price.build_tunnel); |
534 cost.AddCost(ret); |
565 cost.AddCost(ret); |
535 |
566 |
536 /* if the command fails from here on we want the end tile to be highlighted */ |
567 /* if the command fails from here on we want the end tile to be highlighted */ |
537 _build_tunnel_endtile = end_tile; |
568 _build_tunnel_endtile = end_tile; |
569 |
|
570 if (IsWaterTile(end_tile)) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); |
|
538 |
571 |
539 /* slope of end tile must be complementary to the slope of the start tile */ |
572 /* slope of end tile must be complementary to the slope of the start tile */ |
540 if (end_tileh != ComplementSlope(start_tileh)) { |
573 if (end_tileh != ComplementSlope(start_tileh)) { |
541 /* Check if there is a structure on the terraformed tile. Do not add the cost, that will be done by the terraforming */ |
574 /* Check if there is a structure on the terraformed tile. Do not add the cost, that will be done by the terraforming */ |
542 ret = DoCommand(end_tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR); |
575 ret = DoCommand(end_tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR); |
627 } else { |
660 } else { |
628 DoClearSquare(tile); |
661 DoClearSquare(tile); |
629 DoClearSquare(endtile); |
662 DoClearSquare(endtile); |
630 } |
663 } |
631 } |
664 } |
632 return CommandCost(EXPENSES_CONSTRUCTION, _price.clear_tunnel * (DistanceManhattan(tile, endtile) + 1)); |
665 return CommandCost(EXPENSES_CONSTRUCTION, _price.clear_tunnel * (GetTunnelBridgeLength(tile, endtile) + 2)); |
633 } |
666 } |
634 |
667 |
635 |
668 |
636 static CommandCost DoClearBridge(TileIndex tile, uint32 flags) |
669 static CommandCost DoClearBridge(TileIndex tile, uint32 flags) |
637 { |
670 { |
687 YapfNotifyTrackLayoutChange(tile, track); |
720 YapfNotifyTrackLayoutChange(tile, track); |
688 YapfNotifyTrackLayoutChange(endtile, track); |
721 YapfNotifyTrackLayoutChange(endtile, track); |
689 } |
722 } |
690 } |
723 } |
691 |
724 |
692 return CommandCost(EXPENSES_CONSTRUCTION, (DistanceManhattan(tile, endtile) + 1) * _price.clear_bridge); |
725 return CommandCost(EXPENSES_CONSTRUCTION, (GetTunnelBridgeLength(tile, endtile) + 2) * _price.clear_bridge); |
693 } |
726 } |
694 |
727 |
695 static CommandCost ClearTile_TunnelBridge(TileIndex tile, byte flags) |
728 static CommandCost ClearTile_TunnelBridge(TileIndex tile, byte flags) |
696 { |
729 { |
697 if (IsTunnel(tile)) { |
730 if (IsTunnel(tile)) { |
698 if (flags & DC_AUTO) return_cmd_error(STR_5006_MUST_DEMOLISH_TUNNEL_FIRST); |
731 if (flags & DC_AUTO) return_cmd_error(STR_5006_MUST_DEMOLISH_TUNNEL_FIRST); |
699 return DoClearTunnel(tile, flags); |
732 return DoClearTunnel(tile, flags); |
700 } else if (IsBridge(tile)) { // XXX Is this necessary? |
733 } else { // IsBridge(tile) |
701 if (flags & DC_AUTO) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); |
734 if (flags & DC_AUTO) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST); |
702 return DoClearBridge(tile, flags); |
735 return DoClearBridge(tile, flags); |
703 } |
736 } |
704 |
737 |
705 return CMD_ERROR; |
738 return CMD_ERROR; |
873 /* Add helper BB for sprite sorting, that separate the tunnel from things beside of it */ |
906 /* Add helper BB for sprite sorting, that separate the tunnel from things beside of it */ |
874 AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, ti->x , ti->y , BB_data[6], BB_data[7], TILE_HEIGHT, ti->z); |
907 AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, ti->x , ti->y , BB_data[6], BB_data[7], TILE_HEIGHT, ti->z); |
875 AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, ti->x + BB_data[4], ti->y + BB_data[5], BB_data[6], BB_data[7], TILE_HEIGHT, ti->z); |
908 AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, ti->x + BB_data[4], ti->y + BB_data[5], BB_data[6], BB_data[7], TILE_HEIGHT, ti->z); |
876 |
909 |
877 DrawBridgeMiddle(ti); |
910 DrawBridgeMiddle(ti); |
878 } else if (IsBridge(ti->tile)) { // XXX is this necessary? |
911 } else { // IsBridge(ti->tile) |
879 const PalSpriteID *psid; |
912 const PalSpriteID *psid; |
880 int base_offset; |
913 int base_offset; |
881 bool ice = HasTunnelBridgeSnowOrDesert(ti->tile); |
914 bool ice = HasTunnelBridgeSnowOrDesert(ti->tile); |
882 |
915 |
883 if (GetTunnelBridgeTransportType(ti->tile) == TRANSPORT_RAIL) { |
916 if (GetTunnelBridgeTransportType(ti->tile) == TRANSPORT_RAIL) { |
937 } else if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) { |
970 } else if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) { |
938 DrawCatenary(ti); |
971 DrawCatenary(ti); |
939 } |
972 } |
940 |
973 |
941 DrawBridgeMiddle(ti); |
974 DrawBridgeMiddle(ti); |
942 } else { |
|
943 NOT_REACHED(); |
|
944 } |
975 } |
945 } |
976 } |
946 |
977 |
947 |
978 |
948 /** Compute bridge piece. Computes the bridge piece to display depending on the position inside the bridge. |
979 /** Compute bridge piece. Computes the bridge piece to display depending on the position inside the bridge. |
1014 rampnorth = GetNorthernBridgeEnd(ti->tile); |
1045 rampnorth = GetNorthernBridgeEnd(ti->tile); |
1015 rampsouth = GetSouthernBridgeEnd(ti->tile); |
1046 rampsouth = GetSouthernBridgeEnd(ti->tile); |
1016 |
1047 |
1017 axis = GetBridgeAxis(ti->tile); |
1048 axis = GetBridgeAxis(ti->tile); |
1018 piece = CalcBridgePiece( |
1049 piece = CalcBridgePiece( |
1019 DistanceManhattan(ti->tile, rampnorth), |
1050 GetTunnelBridgeLength(ti->tile, rampnorth) + 1, |
1020 DistanceManhattan(ti->tile, rampsouth) |
1051 GetTunnelBridgeLength(ti->tile, rampsouth) + 1 |
1021 ); |
1052 ); |
1022 type = GetBridgeType(rampsouth); |
1053 type = GetBridgeType(rampsouth); |
1023 |
1054 |
1024 if (GetTunnelBridgeTransportType(rampsouth) == TRANSPORT_RAIL) { |
1055 if (GetTunnelBridgeTransportType(rampsouth) == TRANSPORT_RAIL) { |
1025 base_offset = GetRailTypeInfo(GetRailType(rampsouth))->bridge_offset; |
1056 base_offset = GetRailTypeInfo(GetRailType(rampsouth))->bridge_offset; |
1107 if (IsTunnel(tile)) { |
1138 if (IsTunnel(tile)) { |
1108 uint pos = (DiagDirToAxis(GetTunnelBridgeDirection(tile)) == AXIS_X ? y : x); |
1139 uint pos = (DiagDirToAxis(GetTunnelBridgeDirection(tile)) == AXIS_X ? y : x); |
1109 |
1140 |
1110 /* In the tunnel entrance? */ |
1141 /* In the tunnel entrance? */ |
1111 if (5 <= pos && pos <= 10) return z; |
1142 if (5 <= pos && pos <= 10) return z; |
1112 } else { |
1143 } else { // IsBridge(tile) |
1113 DiagDirection dir = GetTunnelBridgeDirection(tile); |
1144 DiagDirection dir = GetTunnelBridgeDirection(tile); |
1114 uint pos = (DiagDirToAxis(dir) == AXIS_X ? y : x); |
1145 uint pos = (DiagDirToAxis(dir) == AXIS_X ? y : x); |
1115 |
1146 |
1116 z += ApplyFoundationToSlope(GetBridgeFoundation(tileh, DiagDirToAxis(dir)), &tileh); |
1147 z += ApplyFoundationToSlope(GetBridgeFoundation(tileh, DiagDirToAxis(dir)), &tileh); |
1117 |
1148 |
1144 static void GetAcceptedCargo_TunnelBridge(TileIndex tile, AcceptedCargo ac) |
1175 static void GetAcceptedCargo_TunnelBridge(TileIndex tile, AcceptedCargo ac) |
1145 { |
1176 { |
1146 /* not used */ |
1177 /* not used */ |
1147 } |
1178 } |
1148 |
1179 |
1149 static const StringID _bridge_tile_str[(MAX_BRIDGES + 3) + (MAX_BRIDGES + 3)] = { |
|
1150 STR_501F_WOODEN_RAIL_BRIDGE, |
|
1151 STR_5020_CONCRETE_RAIL_BRIDGE, |
|
1152 STR_501C_STEEL_GIRDER_RAIL_BRIDGE, |
|
1153 STR_501E_REINFORCED_CONCRETE_SUSPENSION, |
|
1154 STR_501B_STEEL_SUSPENSION_RAIL_BRIDGE, |
|
1155 STR_501B_STEEL_SUSPENSION_RAIL_BRIDGE, |
|
1156 STR_501D_STEEL_CANTILEVER_RAIL_BRIDGE, |
|
1157 STR_501D_STEEL_CANTILEVER_RAIL_BRIDGE, |
|
1158 STR_501D_STEEL_CANTILEVER_RAIL_BRIDGE, |
|
1159 STR_501C_STEEL_GIRDER_RAIL_BRIDGE, |
|
1160 STR_5027_TUBULAR_RAIL_BRIDGE, |
|
1161 STR_5027_TUBULAR_RAIL_BRIDGE, |
|
1162 STR_5027_TUBULAR_RAIL_BRIDGE, |
|
1163 0, 0, 0, |
|
1164 |
|
1165 STR_5025_WOODEN_ROAD_BRIDGE, |
|
1166 STR_5026_CONCRETE_ROAD_BRIDGE, |
|
1167 STR_5022_STEEL_GIRDER_ROAD_BRIDGE, |
|
1168 STR_5024_REINFORCED_CONCRETE_SUSPENSION, |
|
1169 STR_5021_STEEL_SUSPENSION_ROAD_BRIDGE, |
|
1170 STR_5021_STEEL_SUSPENSION_ROAD_BRIDGE, |
|
1171 STR_5023_STEEL_CANTILEVER_ROAD_BRIDGE, |
|
1172 STR_5023_STEEL_CANTILEVER_ROAD_BRIDGE, |
|
1173 STR_5023_STEEL_CANTILEVER_ROAD_BRIDGE, |
|
1174 STR_5022_STEEL_GIRDER_ROAD_BRIDGE, |
|
1175 STR_5028_TUBULAR_ROAD_BRIDGE, |
|
1176 STR_5028_TUBULAR_ROAD_BRIDGE, |
|
1177 STR_5028_TUBULAR_ROAD_BRIDGE, |
|
1178 0, 0, 0, |
|
1179 }; |
|
1180 |
|
1181 static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td) |
1180 static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td) |
1182 { |
1181 { |
1183 if (IsTunnel(tile)) { |
1182 if (IsTunnel(tile)) { |
1184 td->str = (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) ? |
1183 td->str = (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) ? |
1185 STR_5017_RAILROAD_TUNNEL : STR_5018_ROAD_TUNNEL; |
1184 STR_5017_RAILROAD_TUNNEL : STR_5018_ROAD_TUNNEL; |
1186 } else { |
1185 } else { //so it must be a bridge |
1187 td->str = _bridge_tile_str[GetTunnelBridgeTransportType(tile) << 4 | GetBridgeType(tile)]; |
1186 int brtype = GetBridgeType(tile); |
1187 td->str = GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL ? _bridge[brtype].name_rail : _bridge[brtype].name_road; |
|
1188 } |
1188 } |
1189 td->owner = GetTileOwner(tile); |
1189 td->owner = GetTileOwner(tile); |
1190 } |
1190 } |
1191 |
1191 |
1192 |
1192 |
1335 v->u.road.frame = _road_exit_tunnel_frame[dir]; |
1335 v->u.road.frame = _road_exit_tunnel_frame[dir]; |
1336 v->vehstatus &= ~VS_HIDDEN; |
1336 v->vehstatus &= ~VS_HIDDEN; |
1337 return VETSB_ENTERED_WORMHOLE; |
1337 return VETSB_ENTERED_WORMHOLE; |
1338 } |
1338 } |
1339 } |
1339 } |
1340 } else if (IsBridge(tile)) { // XXX is this necessary? |
1340 } else { // IsBridge(tile) |
1341 DiagDirection dir; |
1341 DiagDirection dir; |
1342 |
1342 |
1343 if (v->IsPrimaryVehicle()) { |
1343 if (v->IsPrimaryVehicle()) { |
1344 /* modify speed of vehicle */ |
1344 /* modify speed of vehicle */ |
1345 uint16 spd = _bridge[GetBridgeType(tile)].speed; |
1345 uint16 spd = _bridge[GetBridgeType(tile)].speed; |