41 #include "oldpool_func.h" |
41 #include "oldpool_func.h" |
42 |
42 |
43 #include "table/sprites.h" |
43 #include "table/sprites.h" |
44 #include "table/strings.h" |
44 #include "table/strings.h" |
45 |
45 |
|
46 |
|
47 bool RoadVehiclesAreBuilt() |
|
48 { |
|
49 const Vehicle* v; |
|
50 |
|
51 FOR_ALL_VEHICLES(v) { |
|
52 if (v->type == VEH_ROAD) return true; |
|
53 } |
|
54 return false; |
|
55 } |
|
56 |
|
57 /** |
|
58 * Change the side of the road vehicles drive on (server only). |
|
59 * @param tile unused |
|
60 * @param flags operation to perform |
|
61 * @param p1 the side of the road; 0 = left side and 1 = right side |
|
62 * @param p2 unused |
|
63 */ |
|
64 CommandCost CmdSetRoadDriveSide(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
|
65 { |
|
66 /* Check boundaries and you can only change this if NO vehicles have been built yet, |
|
67 * except in the intro-menu where of course it's always possible to do so. */ |
|
68 if (p1 > 1 || (_game_mode != GM_MENU && RoadVehiclesAreBuilt())) return CMD_ERROR; |
|
69 |
|
70 if (flags & DC_EXEC) { |
|
71 _opt_ptr->road_side = p1; |
|
72 InvalidateWindow(WC_GAME_OPTIONS, 0); |
|
73 } |
|
74 return CommandCost(); |
|
75 } |
|
76 |
46 #define M(x) (1 << (x)) |
77 #define M(x) (1 << (x)) |
47 /* Level crossings may only be built on these slopes */ |
78 /* Level crossings may only be built on these slopes */ |
48 static const uint32 VALID_LEVEL_CROSSING_SLOPES = (M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT)); |
79 static const uint32 VALID_LEVEL_CROSSING_SLOPES = (M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT)); |
49 #undef M |
80 #undef M |
50 |
81 |