summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-09 10:34:32 +0000
committerrubidium <rubidium@openttd.org>2007-09-09 10:34:32 +0000
commitefea7622acb6dbf5b4a75be3e0b0c6d016e5feb1 (patch)
tree3c503e126418430925368a8acd79eb761219d6ef /src
parented3b1d398aaa6643d255eb792b8226d35eafceed (diff)
downloadopenttd-efea7622acb6dbf5b4a75be3e0b0c6d016e5feb1.tar.xz
(svn r11067) -Codechange: also make it possible to use the advanced vehicle list for other players. Patch by SmatZ.
Diffstat (limited to 'src')
-rw-r--r--src/group_gui.cpp16
-rw-r--r--src/lang/english.txt3
-rw-r--r--src/settings.cpp2
-rw-r--r--src/variables.h2
-rw-r--r--src/vehicle_gui.cpp7
5 files changed, 25 insertions, 5 deletions
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 7b994af9d..dff1f0ea0 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -329,7 +329,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
SetVScroll2Count(w, gv->l.list_length);
/* Disable all lists management button when the list is empty */
- SetWindowWidgetsDisabledState(w, gv->l.list_length == 0,
+ SetWindowWidgetsDisabledState(w, gv->l.list_length == 0 || _local_player != owner,
GRP_WIDGET_STOP_ALL,
GRP_WIDGET_START_ALL,
GRP_WIDGET_MANAGE_VEHICLES,
@@ -337,12 +337,24 @@ static void GroupWndProc(Window *w, WindowEvent *e)
WIDGET_LIST_END);
/* Disable the group specific function when we select the default group or all vehicles */
- SetWindowWidgetsDisabledState(w, IsDefaultGroupID(gv->group_sel) || IsAllGroupID(gv->group_sel),
+ SetWindowWidgetsDisabledState(w, IsDefaultGroupID(gv->group_sel) || IsAllGroupID(gv->group_sel) || _local_player != owner,
GRP_WIDGET_DELETE_GROUP,
GRP_WIDGET_RENAME_GROUP,
GRP_WIDGET_REPLACE_PROTECTION,
WIDGET_LIST_END);
+ /* Disable remaining buttons for non-local player
+ * Needed while changing _local_player, eg. by cheats
+ * All procedures (eg. move vehicle to another group)
+ * verify, whether you are the owner of the vehicle,
+ * so it doesn't have to be disabled
+ */
+ SetWindowWidgetsDisabledState(w, _local_player != owner,
+ GRP_WIDGET_CREATE_GROUP,
+ GRP_WIDGET_AVAILABLE_VEHICLES,
+ WIDGET_LIST_END);
+
+
/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
We list all vehicles or ungrouped vehicles */
if (IsDefaultGroupID(gv->group_sel) || IsAllGroupID(gv->group_sel)) {
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 3cdf33a7f..bed65615b 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1111,6 +1111,9 @@ STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU_OFF :Off
STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME :{LTBLUE}Automatically pause when starting a new game: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS :{LTBLUE}Use the advanced vehicle list: {ORANGE}{STRING1}
+STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS_OFF :Off
+STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS_OWN :Own company
+STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS_ALL :All companies
STR_CONFIG_PATCHES_LOADING_INDICATORS :{LTBLUE}Use loading indicators: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_LOADING_INDICATORS_OFF :Off
STR_CONFIG_PATCHES_LOADING_INDICATORS_OWN :Own company
diff --git a/src/settings.cpp b/src/settings.cpp
index b0a1eb33d..3aaa7941b 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1353,7 +1353,7 @@ const SettingDesc _patch_settings[] = {
SDT_VAR(Patches,right_mouse_btn_emulation,SLE_UINT8,S,MS,0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL),
#endif
SDT_BOOL(Patches, pause_on_newgame, S, 0, false, STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME, NULL),
- SDT_BOOL(Patches, advanced_vehicle_list, S, 0, true, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS, NULL),
+ SDT_VAR(Patches,advanced_vehicle_list,SLE_UINT8,S,MS, 1, 0, 2, 0, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS,NULL),
SDT_BOOL(Patches, timetable_in_ticks, S, 0, false, STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS, NULL),
SDT_VAR(Patches, loading_indicators, SLE_UINT8, S,MS, 1, 0, 2, 0, STR_CONFIG_PATCHES_LOADING_INDICATORS, RedrawScreen),
SDT_VAR(Patches, default_rail_type, SLE_UINT8, S,MS, 4, 0, 6, 0, STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE, NULL),
diff --git a/src/variables.h b/src/variables.h
index 1cc576075..58510ed98 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -129,7 +129,7 @@ struct Patches {
bool measure_tooltip; // Show a permanent tooltip when dragging tools
byte liveries; // Options for displaying company liveries, 0=none, 1=self, 2=all
bool prefer_teamchat; // Choose the chat message target with <ENTER>, true=all players, false=your team
- bool advanced_vehicle_list; // Use the "advanced" vehicle list
+ uint8 advanced_vehicle_list; // Use the "advanced" vehicle list
uint8 loading_indicators; // Show loading indicators
uint8 default_rail_type; ///< The default rail type for the rail GUI
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 7f9dac2b2..16f42465b 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1240,7 +1240,12 @@ static void ShowVehicleListWindowLocal(PlayerID player, uint16 VLW_flag, Vehicle
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type)
{
- if (player == _local_player && _patches.advanced_vehicle_list) {
+ /* If _patches.advanced_vehicle_list > 1, display the Advanced list
+ * if _patches.advanced_vehicle_list == 1, display Advanced list only for local player
+ * if _ctrl_pressed, do the opposite action (Advanced list x Normal list)
+ */
+
+ if ((_patches.advanced_vehicle_list > (player != _local_player)) != _ctrl_pressed) {
ShowPlayerGroup(player, vehicle_type);
} else {
ShowVehicleListWindowLocal(player, VLW_STANDARD, vehicle_type, 0);