diff options
author | Guillaume Renoult <guillaume.renoult@gmail.com> | 2021-11-08 05:54:50 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-07 19:54:50 +0100 |
commit | c38af729787f25e56cb19fce90d89eebf3067c66 (patch) | |
tree | 333efbcf0f4af633871abc7b1b005c62cc26b66a /src | |
parent | b4bd7b367e3b2ab0e82319e04adb9f302a9f222f (diff) | |
download | openttd-c38af729787f25e56cb19fce90d89eebf3067c66.tar.xz |
Update: add setting to hide news about competitors vehicle crash (#9653)
Diffstat (limited to 'src')
-rw-r--r-- | src/aircraft_cmd.cpp | 7 | ||||
-rw-r--r-- | src/lang/english.txt | 3 | ||||
-rw-r--r-- | src/news_gui.cpp | 1 | ||||
-rw-r--r-- | src/news_type.h | 1 | ||||
-rw-r--r-- | src/roadveh_cmd.cpp | 8 | ||||
-rw-r--r-- | src/settings_gui.cpp | 1 | ||||
-rw-r--r-- | src/settings_type.h | 1 | ||||
-rw-r--r-- | src/table/settings/news_display_settings.ini | 11 |
8 files changed, 31 insertions, 2 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 52c966e81..4c4ed5a46 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1341,7 +1341,12 @@ static void CrashAirplane(Aircraft *v) AI::NewEvent(v->owner, new ScriptEventVehicleCrashed(v->index, vt, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING)); Game::NewEvent(new ScriptEventVehicleCrashed(v->index, vt, st == nullptr ? ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT : ScriptEventVehicleCrashed::CRASH_PLANE_LANDING)); - AddTileNewsItem(newsitem, NT_ACCIDENT, vt, nullptr, st != nullptr ? st->index : INVALID_STATION); + NewsType newstype = NT_ACCIDENT; + if (v->owner != _local_company) { + newstype = NT_ACCIDENT_OTHER; + } + + AddTileNewsItem(newsitem, newstype, vt, nullptr, st != nullptr ? st->index : INVALID_STATION); ModifyStationRatingAround(vt, v->owner, -160, 30); if (_settings_client.sound.disaster) SndPlayVehicleFx(SND_12_EXPLOSION, v); diff --git a/src/lang/english.txt b/src/lang/english.txt index 49497a00c..becf8d35c 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1743,6 +1743,9 @@ STR_CONFIG_SETTING_NEWS_ARRIVAL_FIRST_VEHICLE_OTHER_HELPTEXT :Display a newsp STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS :Accidents / disasters: {STRING2} STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS_HELPTEXT :Display a newspaper when accidents or disasters occur +STR_CONFIG_SETTING_NEWS_ACCIDENT_OTHER :Accidents of competitor's vehicles: {STRING2} +STR_CONFIG_SETTING_NEWS_ACCIDENT_OTHER_HELPTEXT :Display a newspaper about crashed vehicles for competitors + STR_CONFIG_SETTING_NEWS_COMPANY_INFORMATION :Company information: {STRING2} STR_CONFIG_SETTING_NEWS_COMPANY_INFORMATION_HELPTEXT :Display a newspaper when a new company starts, or when companies are risking to bankrupt diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 4bd4bcecb..10a49b62e 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -231,6 +231,7 @@ static NewsTypeData _news_type_data[] = { NewsTypeData("news_display.arrival_player", 60, SND_1D_APPLAUSE ), ///< NT_ARRIVAL_COMPANY NewsTypeData("news_display.arrival_other", 60, SND_1D_APPLAUSE ), ///< NT_ARRIVAL_OTHER NewsTypeData("news_display.accident", 90, SND_BEGIN ), ///< NT_ACCIDENT + NewsTypeData("news_display.accident_other", 90, SND_BEGIN ), ///< NT_ACCIDENT_OTHER NewsTypeData("news_display.company_info", 60, SND_BEGIN ), ///< NT_COMPANY_INFO NewsTypeData("news_display.open", 90, SND_BEGIN ), ///< NT_INDUSTRY_OPEN NewsTypeData("news_display.close", 90, SND_BEGIN ), ///< NT_INDUSTRY_CLOSE diff --git a/src/news_type.h b/src/news_type.h index 4dea8c46f..188305b52 100644 --- a/src/news_type.h +++ b/src/news_type.h @@ -22,6 +22,7 @@ enum NewsType { NT_ARRIVAL_COMPANY, ///< First vehicle arrived for company NT_ARRIVAL_OTHER, ///< First vehicle arrived for competitor NT_ACCIDENT, ///< An accident or disaster has occurred + NT_ACCIDENT_OTHER, ///< An accident or disaster has occurred NT_COMPANY_INFO, ///< Company info (new companies, bankruptcy messages) NT_INDUSTRY_OPEN, ///< Opening of industries NT_INDUSTRY_CLOSE, ///< Closing of industries diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 86c2de78e..9c444d1d3 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -553,7 +553,13 @@ static void RoadVehCrash(RoadVehicle *v) SetDParam(0, pass); StringID newsitem = (pass == 1) ? STR_NEWS_ROAD_VEHICLE_CRASH_DRIVER : STR_NEWS_ROAD_VEHICLE_CRASH; - AddTileNewsItem(newsitem, NT_ACCIDENT, v->tile); + NewsType newstype = NT_ACCIDENT; + + if (v->owner != _local_company) { + newstype = NT_ACCIDENT_OTHER; + } + + AddTileNewsItem(newsitem, newstype, v->tile); ModifyStationRatingAround(v->tile, v->owner, -160, 22); if (_settings_client.sound.disaster) SndPlayVehicleFx(SND_12_EXPLOSION, v); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 3e7a0fbb1..f99ef8f3e 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1648,6 +1648,7 @@ static SettingsContainer &GetSettingsTree() advisors->Add(new SettingEntry("news_display.general")); advisors->Add(new SettingEntry("news_display.new_vehicles")); advisors->Add(new SettingEntry("news_display.accident")); + advisors->Add(new SettingEntry("news_display.accident_other")); advisors->Add(new SettingEntry("news_display.company_info")); advisors->Add(new SettingEntry("news_display.acceptance")); advisors->Add(new SettingEntry("news_display.arrival_player")); diff --git a/src/settings_type.h b/src/settings_type.h index 3c2f2be7b..9da2655d6 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -242,6 +242,7 @@ struct NewsSettings { uint8 arrival_player; ///< NewsDisplay of vehicles arriving at new stations of current player uint8 arrival_other; ///< NewsDisplay of vehicles arriving at new stations of other players uint8 accident; ///< NewsDisplay of accidents that occur + uint8 accident_other; ///< NewsDisplay if a vehicle from another company is involved in an accident uint8 company_info; ///< NewsDisplay of general company information uint8 open; ///< NewsDisplay on new industry constructions uint8 close; ///< NewsDisplay about closing industries diff --git a/src/table/settings/news_display_settings.ini b/src/table/settings/news_display_settings.ini index 81a739fba..edbb8783b 100644 --- a/src/table/settings/news_display_settings.ini +++ b/src/table/settings/news_display_settings.ini @@ -68,6 +68,17 @@ strhelp = STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS_HELPTEXT strval = STR_CONFIG_SETTING_NEWS_MESSAGES_OFF [SDTC_OMANY] +var = news_display.accident_other +type = SLE_UINT8 +flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_DROPDOWN +def = 2 +max = 2 +full = _news_display +str = STR_CONFIG_SETTING_NEWS_ACCIDENT_OTHER +strhelp = STR_CONFIG_SETTING_NEWS_ACCIDENT_OTHER_HELPTEXT +strval = STR_CONFIG_SETTING_NEWS_MESSAGES_OFF + +[SDTC_OMANY] var = news_display.company_info type = SLE_UINT8 flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_DROPDOWN |