summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/command.cpp4
-rw-r--r--src/command_type.h2
-rw-r--r--src/road_cmd.cpp24
-rw-r--r--src/settings.cpp13
-rw-r--r--src/settings_gui.cpp4
5 files changed, 15 insertions, 32 deletions
diff --git a/src/command.cpp b/src/command.cpp
index 73d44393b..723f7f7dc 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -144,8 +144,6 @@ DEF_COMMAND(CmdBuildTown);
DEF_COMMAND(CmdRenameTown);
DEF_COMMAND(CmdDoTownAction);
-DEF_COMMAND(CmdSetRoadDriveSide);
-
DEF_COMMAND(CmdChangePatchSetting);
DEF_COMMAND(CmdSellShip);
@@ -294,8 +292,6 @@ static const Command _command_proc_table[] = {
{CmdRenameTown, CMD_SERVER}, /* CMD_RENAME_TOWN */
{CmdDoTownAction, 0}, /* CMD_DO_TOWN_ACTION */
- {CmdSetRoadDriveSide, CMD_SERVER}, /* CMD_SET_ROAD_DRIVE_SIDE */
-
{CmdSellShip, 0}, /* CMD_SELL_SHIP */
{CmdBuildShip, 0}, /* CMD_BUILD_SHIP */
{CmdSendShipToDepot, 0}, /* CMD_SEND_SHIP_TO_DEPOT */
diff --git a/src/command_type.h b/src/command_type.h
index f64780ed7..f0f2b27a0 100644
--- a/src/command_type.h
+++ b/src/command_type.h
@@ -240,8 +240,6 @@ enum {
CMD_RENAME_TOWN, ///< rename a town
CMD_DO_TOWN_ACTION, ///< do a action from the town detail window (like advertises or bribe)
- CMD_SET_ROAD_DRIVE_SIDE, ///< set the side where the road vehicles drive
-
CMD_SELL_SHIP, ///< sell a ship
CMD_BUILD_SHIP, ///< build a new ship
CMD_SEND_SHIP_TO_DEPOT, ///< send a ship to a depot
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 44079d4a4..de2094a32 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -45,30 +45,6 @@ bool RoadVehiclesAreBuilt()
return false;
}
-/**
- * Change the side of the road vehicles drive on (server only).
- * @param tile unused
- * @param flags operation to perform
- * @param p1 the side of the road; 0 = left side and 1 = right side
- * @param p2 unused
- */
-CommandCost CmdSetRoadDriveSide(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
-{
- /* Check boundaries and you can only change this if NO vehicles have been built yet,
- * except in the intro-menu where of course it's always possible to do so. */
- if (p1 > 1 || (_game_mode != GM_MENU && RoadVehiclesAreBuilt())) return CMD_ERROR;
-
- if (flags & DC_EXEC) {
- if (_game_mode == GM_MENU) {
- _settings_newgame.vehicle.road_side = p1;
- } else {
- _settings_game.vehicle.road_side = p1;
- }
- InvalidateWindow(WC_GAME_OPTIONS, 0);
- }
- return CommandCost();
-}
-
#define M(x) (1 << (x))
/* Level crossings may only be built on these slopes */
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));
diff --git a/src/settings.cpp b/src/settings.cpp
index 1fdb76cfb..ac5811461 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1047,6 +1047,17 @@ static bool CheckTownLayout(int32 p1)
return true;
}
+/**
+ * Check whether the road side may be changed.
+ * @param p1 unused
+ * @return true if the road side may be changed.
+ */
+static bool CheckRoadSide(int p1)
+{
+ extern bool RoadVehiclesAreBuilt();
+ return _game_mode == GM_MENU || !RoadVehiclesAreBuilt();
+}
+
/** Conversion callback for _gameopt_settings_game.landscape
* It converts (or try) between old values and the new ones,
* without losing initial setting of the user
@@ -1303,7 +1314,7 @@ const SettingDesc _patch_settings[] = {
SDT_CONDOMANY(GameSettings, game_creation.town_name, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
SDT_CONDOMANY(GameSettings, game_creation.landscape, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
SDT_CONDVAR(GameSettings, game_creation.snow_line, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
- SDT_CONDOMANY(GameSettings, vehicle.road_side, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 1, 1, "left|right", STR_NULL, NULL, NULL),
+ SDT_CONDOMANY(GameSettings, vehicle.road_side, SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 1, 1, "left|right", STR_NULL, CheckRoadSide, NULL),
SDT_BOOL(GameSettings, construction.build_on_slopes, 0,NN, true, STR_CONFIG_PATCHES_BUILDONSLOPES, NULL),
SDT_CONDBOOL(GameSettings, construction.autoslope, 75, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_AUTOSLOPE, NULL),
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index e3d62622c..9cae1373f 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -275,7 +275,9 @@ struct GameOptionsWindow : Window {
case GAMEOPT_ROADSIDE_BTN: // Road side
if (this->opt->vehicle.road_side != index) { // only change if setting changed
- DoCommandP(0, index, 0, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_00B4_CAN_T_DO_THIS));
+ uint i;
+ if (GetPatchFromName("vehicle.road_side", &i) == NULL) NOT_REACHED();
+ SetPatchValue(i, index);
MarkWholeScreenDirty();
}
break;