diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 4e4b9412bf..0b273e6519 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1424,7 +1424,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/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 370757442b..8f6efd70d7 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -578,6 +578,16 @@ public: size_t engine_count = this->engines[click_side].size(); EngineID e = engine_count > i ? this->engines[click_side][i] : INVALID_ENGINE; + + /* If Ctrl is pressed on the left side and we don't have any engines of the selected type, stop autoreplacing. + * This is most common when we have finished autoreplacing the engine and want to remove it from the list. */ + if (click_side == 0 && _ctrl_pressed && e != INVALID_ENGINE && + (GetGroupNumEngines(_local_company, sel_group, e) == 0 || GetGroupNumEngines(_local_company, ALL_GROUP, e) == 0)) { + EngineID veh_from = e; + DoCommandP(0, this->sel_group << 16, veh_from + (INVALID_ENGINE << 16), CMD_SET_AUTOREPLACE); + break; + } + if (e == this->sel_engine[click_side]) break; // we clicked the one we already selected this->sel_engine[click_side] = e; if (click_side == 0) { diff --git a/src/lang/english.txt b/src/lang/english.txt index e4e91af759..bf51d8c44e 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1994,6 +1994,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/lang/english_AU.txt b/src/lang/english_AU.txt index 97ce74d08c..769c6da6ab 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -1343,7 +1343,7 @@ STR_CONFIG_SETTING_ERRMSG_DURATION_VALUE :{COMMA} second{ STR_CONFIG_SETTING_HOVER_DELAY :Show tooltips: {STRING} STR_CONFIG_SETTING_HOVER_DELAY_HELPTEXT :Delay before tooltips are displayed when hovering the mouse over some interface element. Alternatively tooltips can be bound to the right mouse button -STR_CONFIG_SETTING_HOVER_DELAY_VALUE :Hover for {COMMA} second{P 0 "" s} +STR_CONFIG_SETTING_HOVER_DELAY_VALUE :Hover for {COMMA} millisecond{P 0 "" s} ###setting-zero-is-special STR_CONFIG_SETTING_HOVER_DELAY_DISABLED :Right click @@ -2284,6 +2284,7 @@ STR_NETWORK_MESSAGE_CLIENT_COMPANY_SPECTATE :*** {STRING} ha STR_NETWORK_MESSAGE_CLIENT_COMPANY_NEW :*** {STRING} has started a new company (#{2:NUM}) STR_NETWORK_MESSAGE_CLIENT_LEFT :*** {STRING} has left the game ({2:STRING}) STR_NETWORK_MESSAGE_NAME_CHANGE :*** {STRING} has changed his/her name to {STRING} +STR_NETWORK_MESSAGE_GIVE_MONEY :*** {STRING} gave {2:CURRENCY_LONG} to {1:STRING} STR_NETWORK_MESSAGE_SERVER_SHUTDOWN :{WHITE}The server closed the session STR_NETWORK_MESSAGE_SERVER_REBOOT :{WHITE}The server is restarting...{}Please wait... @@ -3676,6 +3677,7 @@ STR_REPLACE_MONORAIL_VEHICLES :Monorail Vehicl STR_REPLACE_MAGLEV_VEHICLES :Maglev Vehicles +STR_REPLACE_REMOVE_WAGON :{BLACK}Wagon removal ({STRING}): {ORANGE}{STRING} STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Make autoreplace keep the length of a train the same by removing wagons (starting at the front), if replacing the engine would make the train longer # Vehicle view diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 8b737e55ed..6b95cc209b 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -1202,9 +1202,9 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet * care about the server shutting down. */ if (this->status >= STATUS_JOIN) { /* To throttle the reconnects a bit, every clients waits its - * Client ID modulo 16. This way reconnects should be spread - * out a bit. */ - _network_reconnect = _network_own_client_id % 16; + * Client ID modulo 16 + 1 (value 0 means no reconnect). + * This way reconnects should be spread out a bit. */ + _network_reconnect = _network_own_client_id % 16 + 1; ShowErrorMessage(STR_NETWORK_MESSAGE_SERVER_REBOOT, INVALID_STRING_ID, WL_CRITICAL); } diff --git a/src/newgrf.cpp b/src/newgrf.cpp index c5ac505410..9e3cac6137 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -2760,8 +2760,8 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, co uint16 options = buf->ReadWord(); if (curidx < CURRENCY_END) { - _currency_specs[curidx].separator[0] = GB(options, 0, 8); - _currency_specs[curidx].separator[1] = '\0'; + _currency_specs[curidx].separator.clear(); + _currency_specs[curidx].separator.push_back(GB(options, 0, 8)); /* By specifying only one bit, we prevent errors, * since newgrf specs said that only 0 and 1 can be set for symbol_pos */ _currency_specs[curidx].symbol_pos = GB(options, 8, 1); diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 3767d8f0ea..aa01055120 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 4dea8c46f5..188305b52f 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/order_cmd.cpp b/src/order_cmd.cpp index 5b93bca22b..55d37f67a9 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1470,10 +1470,10 @@ CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 v->ClearSeparation(); if (HasBit(v->vehicle_flags, VF_TIMETABLE_SEPARATION)) ClrBit(v->vehicle_flags, VF_TIMETABLE_STARTED); - } - /* We have an aircraft/ship, they have a mini-schedule, so update them all */ - if (v->type == VEH_AIRCRAFT || v->type == VEH_SHIP) DirtyVehicleListWindowForVehicle(v); + /* We have an aircraft/ship, they have a mini-schedule, so update them all */ + if (v->type == VEH_AIRCRAFT || v->type == VEH_SHIP) DirtyVehicleListWindowForVehicle(v); + } return CommandCost(); } diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 2feb377c9a..2999a962cf 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -1222,9 +1222,12 @@ bool NPFShipCheckReverse(const Ship *v, Trackdir *best_td) AyStarUserData user = { v->owner, TRANSPORT_WATER, RAILTYPES_NONE, ROADTYPES_NONE, 0 }; if (best_td != nullptr) { - TrackdirBits rtds = DiagdirReachesTrackdirs(ReverseDiagDir(VehicleExitDir(v->direction, v->state))); + DiagDirection entry = ReverseDiagDir(VehicleExitDir(v->direction, v->state)); + TrackdirBits rtds = DiagdirReachesTrackdirs(entry) & TrackStatusToTrackdirBits(GetTileTrackStatus(v->tile, TRANSPORT_WATER, 0, entry)); Trackdir best = (Trackdir)FindFirstBit2x64(rtds); - for (rtds = KillFirstBit(rtds); rtds != TRACKDIR_BIT_NONE; rtds = KillFirstBit(rtds)) { + rtds = KillFirstBit(rtds); + if (rtds == TRACKDIR_BIT_NONE) return false; /* At most one choice. */ + for (; rtds != TRACKDIR_BIT_NONE; rtds = KillFirstBit(rtds)) { Trackdir td = (Trackdir)FindFirstBit2x64(rtds); ftd = NPFRouteToStationOrTileTwoWay(v->tile, best, false, v->tile, td, false, &fstd, &user); if (ftd.best_bird_dist == 0 && NPFGetFlag(&ftd.node, NPF_FLAG_REVERSE)) best = td; diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp index 647b2f3494..225040af61 100644 --- a/src/pathfinder/yapf/yapf_ship.cpp +++ b/src/pathfinder/yapf/yapf_ship.cpp @@ -212,7 +212,13 @@ public: /* create pathfinder instance */ Tpf pf; /* set origin and destination nodes */ - pf.SetOrigin(tile, trackdir == nullptr ? TrackdirToTrackdirBits(td1) | TrackdirToTrackdirBits(td2) : DiagdirReachesTrackdirs(ReverseDiagDir(VehicleExitDir(v->direction, v->state)))); + if (trackdir == nullptr) { + pf.SetOrigin(tile, TrackdirToTrackdirBits(td1) | TrackdirToTrackdirBits(td2)); + } else { + DiagDirection entry = ReverseDiagDir(VehicleExitDir(v->direction, v->state)); + TrackdirBits rtds = DiagdirReachesTrackdirs(entry) & TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0, entry)); + pf.SetOrigin(tile, rtds); + } pf.SetDestination(v); /* find best path */ if (!pf.FindPath(v)) return false; diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index eb198269de..131d8d76ea 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -619,7 +619,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/saveload/afterload.cpp b/src/saveload/afterload.cpp index 721a849489..7d0964523d 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -435,8 +435,8 @@ static void CDECL HandleSavegameLoadCrash(int signum) "or older version.\n" "It will load a NewGRF with the same GRF ID as the missing NewGRF.\n" "This means that if the author makes incompatible NewGRFs with the\n" - "same GRF ID OpenTTD cannot magically do the right thing. In most\n" - "cases OpenTTD will load the savegame and not crash, but this is an\n" + "same GRF ID, OpenTTD cannot magically do the right thing. In most\n" + "cases, OpenTTD will load the savegame and not crash, but this is an\n" "exception.\n" "Please load the savegame with the appropriate NewGRFs installed.\n" "The missing/compatible NewGRFs are:\n"); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 2595adefed..f98f7fe16e 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1866,6 +1866,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 3a5f40a4d9..28a11053e3 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -309,6 +309,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/settings.ini b/src/table/settings/settings.ini index 140789eb38..c0bcc26ab8 100644 --- a/src/table/settings/settings.ini +++ b/src/table/settings/settings.ini @@ -5550,6 +5550,17 @@ str = STR_CONFIG_SETTING_NEWS_ACCIDENTS_DISASTERS 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