From 6075dd22e24c692c976289bdcd9f8b831eeec16d Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 20 Nov 2015 23:55:02 +0000 Subject: [PATCH] Show small square if vehicle owner does not match list owner. No longer check the infrastructure sharing setting. Add a separate setting to control company colour squares (default on). --- src/lang/english.txt | 2 ++ src/settings_gui.cpp | 1 + src/settings_type.h | 1 + src/table/settings.ini | 9 +++++++++ src/vehicle_gui.cpp | 4 ++-- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index 4c8e1cc981..ce6bb713b0 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1377,6 +1377,8 @@ STR_CONFIG_SETTING_OSK_ACTIVATION_DOUBLE_CLICK :Double click STR_CONFIG_SETTING_OSK_ACTIVATION_SINGLE_CLICK_FOCUS :Single click (when focussed) STR_CONFIG_SETTING_OSK_ACTIVATION_SINGLE_CLICK :Single click (immediately) STR_CONFIG_SETTING_SHOW_VEHICLE_ROUTE_STEPS :Show the vehicle's route steps: {STRING2} +STR_CONFIG_SETTING_SHOW_VEHICLE_LIST_COMPANY_COLOUR :Mark other companies' vehicles in lists with their company colour: {STRING2} +STR_CONFIG_SETTING_SHOW_VEHICLE_LIST_COMPANY_COLOUR_HELPTEXT :Vehicles in a vehicle list window which are owned by a different company than the owner of the vehicle list are marked with a coloured square in the vehicle's company colour. STR_CONFIG_SETTING_VIEWPORT_MAP_SCAN_SURROUNDINGS :Scan surroundings (better for high zoom out levels): {STRING2} STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_SLOPES :Show slopes: {STRING2} diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 436eab9491..a8be2fa64e 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1590,6 +1590,7 @@ static SettingsContainer &GetSettingsTree() interface->Add(new SettingEntry("gui.expenses_layout")); interface->Add(new SettingEntry("gui.show_train_length_in_details")); interface->Add(new SettingEntry("gui.show_vehicle_group_in_details")); + interface->Add(new SettingEntry("gui.show_vehicle_list_company_colour")); } SettingsPage *advisors = main->Add(new SettingsPage(STR_CONFIG_SETTING_ADVISORS)); diff --git a/src/settings_type.h b/src/settings_type.h index b4d81f0e70..cf7d534594 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -170,6 +170,7 @@ struct GUISettings { bool show_vehicle_group_in_details; ///< show vehicle group in vehicle details window top widget uint8 osk_activation; ///< Mouse gesture to trigger the OSK. bool show_vehicle_route_steps; ///< when a window related to a specific vehicle is focused, show route steps + bool show_vehicle_list_company_colour; ///< show the company colour of vehicles which have an owner different to the owner of the vehicle list uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity. uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed. diff --git a/src/table/settings.ini b/src/table/settings.ini index 86e67babb1..709511a90c 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -3879,6 +3879,15 @@ strhelp = STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_IN_DETAILS_HELPTEXT proc = RedrawScreen cat = SC_BASIC +[SDTC_BOOL] +var = gui.show_vehicle_list_company_colour +flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +def = true +str = STR_CONFIG_SETTING_SHOW_VEHICLE_LIST_COMPANY_COLOUR +strhelp = STR_CONFIG_SETTING_SHOW_VEHICLE_LIST_COMPANY_COLOUR_HELPTEXT +proc = RedrawScreen +cat = SC_BASIC + ; For the dedicated build we'll enable dates in logs by default. [SDTC_BOOL] ifdef = DEDICATED diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index e60c36899a..2f53dd725c 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1453,13 +1453,13 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int DrawString(text_left, text_right, y + line_height - FONT_HEIGHT_SMALL - WD_FRAMERECT_BOTTOM - 1, STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR); /* company colour stripe along vehicle description row */ - if (_settings_game.economy.infrastructure_sharing[VEH_TRAIN] || _settings_game.economy.infrastructure_sharing[VEH_ROAD] || _settings_game.economy.infrastructure_sharing[VEH_SHIP] || _settings_game.economy.infrastructure_sharing[VEH_AIRCRAFT]) { + if (_settings_client.gui.show_vehicle_list_company_colour && v->owner != this->vli.company) { byte ccolour = 0; Company *c = Company::Get(v->owner); if (c != NULL) { ccolour = _colour_gradient[c->colour][6]; } - GfxFillRect(text_left, y, text_right, y + FONT_HEIGHT_SMALL - 2, ccolour, FILLRECT_OPAQUE); + GfxFillRect((text_right - 1) - (FONT_HEIGHT_SMALL - 2), y + 1, text_right - 1, (y + 1) + (FONT_HEIGHT_SMALL - 2), ccolour, FILLRECT_OPAQUE); } if (v->name != NULL) {