From 2bfceea7621fed53415d4071b3b167712c5b2ea9 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Wed, 16 Feb 2022 10:20:09 -0700 Subject: [PATCH 01/14] Doc: Fix broken links to Bootstrap CONTRIBUTING guide and doc license --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b0c5b7ec30..f9ffdf98ce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -265,5 +265,5 @@ If you would not like to accept this risk, please do either commit anonymously o ### Attribution of this Contributing Guide -This contributing guide is adapted from [Bootstrap](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md) under the [Creative Commons Attribution 3.0 Unported License](https://github.com/twbs/bootstrap/blob/master/docs/LICENSE) terms for Bootstrap documentation. +This contributing guide is adapted from [Bootstrap](https://github.com/twbs/bootstrap/blob/main/.github/CONTRIBUTING.md) under the [Creative Commons Attribution 3.0 Unported License](https://creativecommons.org/licenses/by/3.0/) terms for Bootstrap documentation. The GDPR notice is adapted from [rsyslog](https://github.com/rsyslog/rsyslog/blob/master/CONTRIBUTING.md) under the [GNU General Public License](https://github.com/rsyslog/rsyslog/blob/master/COPYING). From c73f578e8ce1e4299e7840683f4801dd89716d60 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Wed, 2 Feb 2022 22:34:22 +0100 Subject: [PATCH 02/14] Codechange: replace magic numbers and C-style arrays with C++-style array for share owners --- src/company_base.h | 3 +- src/company_cmd.cpp | 4 +- src/company_gui.cpp | 15 ++----- src/company_type.h | 1 + src/economy.cpp | 85 ++++++++++++++++------------------- src/network/network_admin.cpp | 8 ++-- src/saveload/afterload.cpp | 7 ++- 7 files changed, 55 insertions(+), 68 deletions(-) diff --git a/src/company_base.h b/src/company_base.h index 065931c6ce..dd2cfc23b8 100644 --- a/src/company_base.h +++ b/src/company_base.h @@ -17,6 +17,7 @@ #include "settings_type.h" #include "group.h" #include +#include /** Statistics about the economy. */ struct CompanyEconomyEntry { @@ -74,7 +75,7 @@ struct CompanyProperties { TileIndex location_of_HQ; ///< Northern tile of HQ; #INVALID_TILE when there is none. TileIndex last_build_coordinate; ///< Coordinate of the last build thing by this company. - Owner share_owners[4]; ///< Owners of the 4 shares of the company. #INVALID_OWNER if nobody has bought them yet. + std::array share_owners; ///< Owners of the shares of the company. #INVALID_OWNER if nobody has bought them yet. Year inaugurated_year; ///< Year of starting the company. diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index c1f68d2b63..99a2d5bd6c 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -67,7 +67,7 @@ Company::Company(uint16 name_1, bool is_ai) this->clear_limit = (uint32)_settings_game.construction.clear_frame_burst << 16; this->tree_limit = (uint32)_settings_game.construction.tree_frame_burst << 16; - for (uint j = 0; j < 4; j++) this->share_owners[j] = INVALID_OWNER; + std::fill(this->share_owners.begin(), this->share_owners.end(), INVALID_OWNER); InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, INVALID_COMPANY); } @@ -557,7 +557,7 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY) c->money = c->current_loan = (std::min(INITIAL_LOAN, _economy.max_loan) * _economy.inflation_prices >> 16) / 50000 * 50000; - c->share_owners[0] = c->share_owners[1] = c->share_owners[2] = c->share_owners[3] = INVALID_OWNER; + std::fill(c->share_owners.begin(), c->share_owners.end(), INVALID_OWNER); c->avail_railtypes = GetCompanyRailtypes(c->index); c->avail_roadtypes = GetCompanyRoadTypes(c->index); diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 66ef1a9898..6c4da6f746 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -2195,10 +2195,8 @@ static const NWidgetPart _nested_company_widgets[] = { int GetAmountOwnedBy(const Company *c, Owner owner) { - return (c->share_owners[0] == owner) + - (c->share_owners[1] == owner) + - (c->share_owners[2] == owner) + - (c->share_owners[3] == owner); + auto share_owned_by = [owner](auto share_owner) { return share_owner == owner; }; + return std::count_if(c->share_owners.begin(), c->share_owners.end(), share_owned_by); } /** Strings for the company vehicle counts */ @@ -2275,13 +2273,8 @@ struct CompanyWindow : Window } /* Owners of company */ - plane = SZSP_HORIZONTAL; - for (uint i = 0; i < lengthof(c->share_owners); i++) { - if (c->share_owners[i] != INVALID_COMPANY) { - plane = 0; - break; - } - } + auto invalid_owner = [](auto owner) { return owner == INVALID_COMPANY; }; + plane = std::all_of(c->share_owners.begin(), c->share_owners.end(), invalid_owner) ? SZSP_HORIZONTAL : 0; wi = this->GetWidget(WID_C_SELECT_DESC_OWNERS); if (plane != wi->shown_plane) { wi->SetDisplayedPlane(plane); diff --git a/src/company_type.h b/src/company_type.h index 8da3133082..3bbcf731e6 100644 --- a/src/company_type.h +++ b/src/company_type.h @@ -40,6 +40,7 @@ static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32; ///< The maximum length of a company name in characters including '\0' static const uint MAX_HISTORY_QUARTERS = 24; ///< The maximum number of quarters kept as performance's history +static const uint MAX_COMPANY_SHARE_OWNERS = 4; ///< The maximum number of shares of a company that can be owned by another company. /** Define basic enum properties */ template <> struct EnumPropsT : MakeEnumPropsT {}; diff --git a/src/economy.cpp b/src/economy.cpp index c6fd2ed398..4f10367821 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -306,43 +306,39 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner) assert(old_owner != new_owner); - { - uint i; - - /* See if the old_owner had shares in other companies */ - for (const Company *c : Company::Iterate()) { - for (i = 0; i < 4; i++) { - if (c->share_owners[i] == old_owner) { - /* Sell its shares */ - CommandCost res = Command::Do(DC_EXEC | DC_BANKRUPT, c->index); - /* Because we are in a DoCommand, we can't just execute another one and - * expect the money to be removed. We need to do it ourself! */ - SubtractMoneyFromCompany(res); - } - } - } - - /* Sell all the shares that people have on this company */ - Backup cur_company2(_current_company, FILE_LINE); - Company *c = Company::Get(old_owner); - for (i = 0; i < 4; i++) { - if (c->share_owners[i] == INVALID_OWNER) continue; - - if (c->bankrupt_value == 0 && c->share_owners[i] == new_owner) { - /* You are the one buying the company; so don't sell the shares back to you. */ - c->share_owners[i] = INVALID_OWNER; - } else { - cur_company2.Change(c->share_owners[i]); - /* Sell the shares */ - CommandCost res = Command::Do(DC_EXEC | DC_BANKRUPT, old_owner); + /* See if the old_owner had shares in other companies */ + for (const Company *c : Company::Iterate()) { + for (auto share_owner : c->share_owners) { + if (share_owner == old_owner) { + /* Sell its shares */ + CommandCost res = Command::Do(DC_EXEC | DC_BANKRUPT, c->index); /* Because we are in a DoCommand, we can't just execute another one and * expect the money to be removed. We need to do it ourself! */ SubtractMoneyFromCompany(res); } } - cur_company2.Restore(); } + /* Sell all the shares that people have on this company */ + Backup cur_company2(_current_company, FILE_LINE); + Company *c = Company::Get(old_owner); + for (auto &share_owner : c->share_owners) { + if (share_owner == INVALID_OWNER) continue; + + if (c->bankrupt_value == 0 && share_owner == new_owner) { + /* You are the one buying the company; so don't sell the shares back to you. */ + share_owner = INVALID_OWNER; + } else { + cur_company2.Change(share_owner); + /* Sell the shares */ + CommandCost res = Command::Do(DC_EXEC | DC_BANKRUPT, old_owner); + /* Because we are in a DoCommand, we can't just execute another one and + * expect the money to be removed. We need to do it ourself! */ + SubtractMoneyFromCompany(res); + } + } + cur_company2.Restore(); + /* Temporarily increase the company's money, to be sure that * removing their property doesn't fail because of lack of money. * Not too drastically though, because it could overflow */ @@ -2029,9 +2025,9 @@ CommandCost CmdBuyShareInCompany(DoCommandFlag flags, TileIndex tile, CompanyID if (_cur_year - c->inaugurated_year < _settings_game.economy.min_years_for_shares) return_cmd_error(STR_ERROR_PROTECTED); /* Those lines are here for network-protection (clients can be slow) */ - if (GetAmountOwnedBy(c, COMPANY_SPECTATOR) == 0) return cost; + if (GetAmountOwnedBy(c, INVALID_OWNER) == 0) return cost; - if (GetAmountOwnedBy(c, COMPANY_SPECTATOR) == 1) { + if (GetAmountOwnedBy(c, INVALID_OWNER) == 1) { if (!c->is_ai) return cost; // We can not buy out a real company (temporarily). TODO: well, enable it obviously. if (GetAmountOwnedBy(c, _current_company) == 3 && !MayCompanyTakeOver(_current_company, target_company)) return_cmd_error(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME); @@ -2040,17 +2036,14 @@ CommandCost CmdBuyShareInCompany(DoCommandFlag flags, TileIndex tile, CompanyID cost.AddCost(CalculateCompanyValue(c) >> 2); if (flags & DC_EXEC) { - Owner *b = c->share_owners; - - while (*b != COMPANY_SPECTATOR) b++; // share owners is guaranteed to contain at least one COMPANY_SPECTATOR - *b = _current_company; - - for (int i = 0; c->share_owners[i] == _current_company;) { - if (++i == 4) { - c->bankrupt_value = 0; - DoAcquireCompany(c); - break; - } + auto unowned_share = std::find(c->share_owners.begin(), c->share_owners.end(), INVALID_OWNER); + assert(unowned_share != c->share_owners.end()); // share owners is guaranteed to contain at least one INVALID_OWNER, i.e. unowned share + *unowned_share = _current_company; + + auto current_company_owns_share = [](auto share_owner) { return share_owner == _current_company; }; + if (std::all_of(c->share_owners.begin(), c->share_owners.end(), current_company_owns_share)) { + c->bankrupt_value = 0; + DoAcquireCompany(c); } InvalidateWindowData(WC_COMPANY, target_company); CompanyAdminUpdate(c); @@ -2083,9 +2076,9 @@ CommandCost CmdSellShareInCompany(DoCommandFlag flags, CompanyID target_company) cost = -(cost - (cost >> 7)); if (flags & DC_EXEC) { - Owner *b = c->share_owners; - while (*b != _current_company) b++; // share owners is guaranteed to contain company - *b = COMPANY_SPECTATOR; + auto our_owner = std::find(c->share_owners.begin(), c->share_owners.end(), _current_company); + assert(our_owner != c->share_owners.end()); // share owners is guaranteed to contain at least one INVALID_OWNER + *our_owner = INVALID_OWNER; InvalidateWindowData(WC_COMPANY, target_company); CompanyAdminUpdate(c); } diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp index 4711cdf046..6729ece6c3 100644 --- a/src/network/network_admin.cpp +++ b/src/network/network_admin.cpp @@ -332,8 +332,8 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyInfo(const Company p->Send_bool (c->is_ai); p->Send_uint8 (CeilDiv(c->months_of_bankruptcy, 3)); // send as quarters_of_bankruptcy - for (size_t i = 0; i < lengthof(c->share_owners); i++) { - p->Send_uint8(c->share_owners[i]); + for (auto owner : c->share_owners) { + p->Send_uint8(owner); } this->SendPacket(p); @@ -359,8 +359,8 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyUpdate(const Compa p->Send_bool (NetworkCompanyIsPassworded(c->index)); p->Send_uint8 (CeilDiv(c->months_of_bankruptcy, 3)); // send as quarters_of_bankruptcy - for (size_t i = 0; i < lengthof(c->share_owners); i++) { - p->Send_uint8(c->share_owners[i]); + for (auto owner : c->share_owners) { + p->Send_uint8(owner); } this->SendPacket(p); diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index ce26c1f5b2..4751ff6c43 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -1755,10 +1755,9 @@ bool AfterLoadGame() * 2) shares that are owned by inactive companies or self * (caused by cheating clients in earlier revisions) */ for (Company *c : Company::Iterate()) { - for (uint i = 0; i < 4; i++) { - CompanyID company = c->share_owners[i]; - if (company == INVALID_COMPANY) continue; - if (!Company::IsValidID(company) || company == c->index) c->share_owners[i] = INVALID_COMPANY; + for (auto &share_owner : c->share_owners) { + if (share_owner == INVALID_COMPANY) continue; + if (!Company::IsValidID(share_owner) || share_owner == c->index) share_owner = INVALID_COMPANY; } } } From fbbc80f79e5a7af3c253c359ab83571466505610 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Tue, 22 Feb 2022 14:00:37 -0700 Subject: [PATCH 03/14] Fix #9020: Update station coverage highlight when adding/removing tiles --- src/station_cmd.cpp | 13 +++++++++++-- src/viewport.cpp | 2 +- src/viewport_func.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 0cc628629d..01fee07784 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -744,9 +744,16 @@ static void DeleteStationIfEmpty(BaseStation *st) void Station::AfterStationTileSetChange(bool adding, StationType type) { this->UpdateVirtCoord(); - this->RecomputeCatchment(); DirtyCompanyInfrastructureWindows(this->owner); - if (adding) InvalidateWindowData(WC_STATION_LIST, this->owner, 0); + + if (adding) { + this->RecomputeCatchment(); + MarkCatchmentTilesDirty(); + InvalidateWindowData(WC_STATION_LIST, this->owner, 0); + } else { + MarkCatchmentTilesDirty(); + this->RecomputeCatchment(); + } switch (type) { case STATION_RAIL: @@ -1628,6 +1635,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector &affected_st if (st->train_station.tile == INVALID_TILE) { st->facilities &= ~FACIL_TRAIN; SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS); + MarkCatchmentTilesDirty(); st->UpdateVirtCoord(); DeleteStationIfEmpty(st); } @@ -1662,6 +1670,7 @@ CommandCost CmdRemoveFromRailStation(DoCommandFlag flags, TileIndex start, TileI if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS); st->MarkTilesDirty(false); + MarkCatchmentTilesDirty(); st->RecomputeCatchment(); } diff --git a/src/viewport.cpp b/src/viewport.cpp index 69db0aeab5..3819266c54 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -3495,7 +3495,7 @@ CommandCost CmdScrollViewport(DoCommandFlag flags, TileIndex tile, ViewportScrol return CommandCost(); } -static void MarkCatchmentTilesDirty() +void MarkCatchmentTilesDirty() { if (_viewport_highlight_town != nullptr) { MarkWholeScreenDirty(); diff --git a/src/viewport_func.h b/src/viewport_func.h index 58e1706eb6..e60df4d31e 100644 --- a/src/viewport_func.h +++ b/src/viewport_func.h @@ -98,5 +98,6 @@ struct Town; void SetViewportCatchmentStation(const Station *st, bool sel); void SetViewportCatchmentTown(const Town *t, bool sel); +void MarkCatchmentTilesDirty(); #endif /* VIEWPORT_FUNC_H */ From d220debc6c693b7d237261a90e9d7ca4e144fa0c Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Thu, 10 Mar 2022 14:34:03 -0700 Subject: [PATCH 04/14] Change: Don't pay Property Maintenance on stations when Infrastructure Maintenance is disabled (#9828) --- src/economy.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/economy.cpp b/src/economy.cpp index 4f10367821..df668cbce7 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -648,13 +648,8 @@ static void CompaniesGenStatistics() Backup cur_company(_current_company, FILE_LINE); - if (!_settings_game.economy.infrastructure_maintenance) { - for (const Station *st : Station::Iterate()) { - cur_company.Change(st->owner); - CommandCost cost(EXPENSES_PROPERTY, _price[PR_STATION_VALUE] >> 1); - SubtractMoneyFromCompany(cost); - } - } else { + /* Pay Infrastructure Maintenance, if enabled */ + if (_settings_game.economy.infrastructure_maintenance) { /* Improved monthly infrastructure costs. */ for (const Company *c : Company::Iterate()) { cur_company.Change(c->index); From 68ec2a7877382a17ccad9aade09a5a444a1ca082 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 11 Mar 2022 16:18:09 +0100 Subject: [PATCH 05/14] Fix: removing long roads doesn't prioritize refusal of local authority over other errors (#9831) --- src/road_cmd.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 796ad99c61..e579796412 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1113,8 +1113,14 @@ std::tuple CmdRemoveLongRoad(DoCommandFlag flags, TileIndex cost.AddCost(ret); had_success = true; } else { - /* Ownership errors are more important. */ - if (last_error.GetErrorMessage() != STR_ERROR_OWNED_BY) last_error = ret; + /* Some errors are more equal than others. */ + switch (last_error.GetErrorMessage()) { + case STR_ERROR_OWNED_BY: + case STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS: + break; + default: + last_error = ret; + } } } From 08a5478a930713f7a1506e3403650a449aa1167b Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Sun, 13 Mar 2022 11:21:40 +0100 Subject: [PATCH 06/14] Add: [NewGRF] Map seed as global variable. This is useful to provide a feature-agnostic, stable random value that differs between games. One of the possible uses is to e.g. use it to create pseudo-random regions for towns or industries. --- src/genworld.cpp | 3 ++- src/newgrf.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/genworld.cpp b/src/genworld.cpp index 587d100b5a..8ff7da064a 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -93,7 +93,6 @@ static void _GenerateWorld() _generating_world = true; if (_network_dedicated) Debug(net, 3, "Generating map, please wait..."); /* Set the Random() seed to generation_seed so we produce the same map with the same seed */ - if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom(); _random.SetSeed(_settings_game.game_creation.generation_seed); SetGeneratingWorldProgress(GWP_MAP_INIT, 2); SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0); @@ -302,6 +301,8 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti _settings_game.construction.map_height_limit = std::max(MAP_HEIGHT_LIMIT_AUTO_MINIMUM, std::min(MAX_MAP_HEIGHT_LIMIT, estimated_height + MAP_HEIGHT_LIMIT_AUTO_CEILING_ROOM)); } + if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom(); + /* Load the right landscape stuff, and the NewGRFs! */ GfxLoadSprites(); LoadStringWidthTable(); diff --git a/src/newgrf.cpp b/src/newgrf.cpp index ef13e5545d..329b8cbea9 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -7046,6 +7046,10 @@ static uint32 GetPatchVariable(uint8 param) case 0x16: return SPR_SHORE_BASE; + /* Game map seed */ + case 0x17: + return _settings_game.game_creation.generation_seed; + default: grfmsg(2, "ParamSet: Unknown Patch variable 0x%02X.", param); return 0; From 1a17b6c8f6b38820b739a1b93c903e3ca846a664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guilloux?= Date: Sun, 13 Mar 2022 16:05:24 +0100 Subject: [PATCH 07/14] Change: [Actions] Remove VS2017 and restore VS2019 for CI (#9835) --- .github/workflows/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 5b69c1eea1..b7016b1650 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -237,7 +237,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, windows-2016] + os: [windows-latest, windows-2019] arch: [x86, x64] runs-on: ${{ matrix.os }} From 0d9fdeda8e6e90d1af95b455802adaf42a7d2f13 Mon Sep 17 00:00:00 2001 From: Dave Shifflett Date: Tue, 15 Mar 2022 16:33:22 -0500 Subject: [PATCH 08/14] Feature: Allow Shift+Insert as paste in edit box (#9836) --- src/textbuf.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/textbuf.cpp b/src/textbuf.cpp index 53d90e6c24..75e1f44848 100644 --- a/src/textbuf.cpp +++ b/src/textbuf.cpp @@ -475,6 +475,7 @@ HandleKeyPressResult Textbuf::HandleKeyPress(WChar key, uint16 keycode) case WKC_RETURN: case WKC_NUM_ENTER: return HKPR_CONFIRM; case (WKC_CTRL | 'V'): + case (WKC_SHIFT | WKC_INSERT): edited = this->InsertClipboard(); break; From 8d54f765392654ab634ba3a950c56dd0bf1e7dd9 Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Sun, 20 Mar 2022 12:05:31 +0100 Subject: [PATCH 09/14] Fix #9837, 46bd2f1c: Road build with wrong half-tile ends. --- src/road_cmd.cpp | 3 ++- src/road_gui.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index e579796412..7394075442 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -989,7 +989,8 @@ CommandCost CmdBuildLongRoad(DoCommandFlag flags, TileIndex start_tile, TileInde /* Swap direction, also the half-tile drag vars. */ if (start_tile > end_tile || (start_tile == end_tile && start_half)) { dir = ReverseDiagDir(dir); - std::swap(start_half, end_half); + start_half = !start_half; + end_half = !end_half; if (drd == DRD_NORTHBOUND || drd == DRD_SOUTHBOUND) drd ^= DRD_BOTH; } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 275f039ba8..80a8ed618c 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -638,14 +638,14 @@ struct BuildRoadToolbarWindow : Window { case DDSP_PLACE_ROAD_X_DIR: case DDSP_PLACE_ROAD_Y_DIR: case DDSP_PLACE_AUTOROAD: { - bool start_half = _place_road_dir == AXIS_Y ? _place_road_start_half_y : _place_road_start_half_y; + bool start_half = _place_road_dir == AXIS_Y ? _place_road_start_half_y : _place_road_start_half_x; if (_remove_button_clicked) { Command::Post(this->rti->strings.err_remove_road, CcPlaySound_CONSTRUCTION_OTHER, start_tile, end_tile, _cur_roadtype, _place_road_dir, start_half, _place_road_end_half); } else { Command::Post(this->rti->strings.err_build_road, CcPlaySound_CONSTRUCTION_OTHER, - start_tile, end_tile, _cur_roadtype, _place_road_dir, _one_way_button_clicked ? DRD_NORTHBOUND : DRD_NONE, start_tile, _place_road_end_half, false); + start_tile, end_tile, _cur_roadtype, _place_road_dir, _one_way_button_clicked ? DRD_NORTHBOUND : DRD_NONE, start_half, _place_road_end_half, false); } break; } From 61c6fd30557409e57d6c93d27ff4816ce3d60483 Mon Sep 17 00:00:00 2001 From: ALEX11BR <49609151+ALEX11BR@users.noreply.github.com> Date: Fri, 18 Feb 2022 16:29:39 +0200 Subject: [PATCH 10/14] Fix: correct some mistaken Romanian real towns --- src/table/townname.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/table/townname.h b/src/table/townname.h index 85ac330609..b3f197a046 100644 --- a/src/table/townname.h +++ b/src/table/townname.h @@ -1943,7 +1943,7 @@ static const char * const _name_romanian_real[] = { u8"Bac\u0103u", "Baia Mare", u8"B\u0103ile Herculane", - u8"B\u0103ilesti", + u8"B\u0103ile\u0219ti", u8"B\u00e2rlad", "Bicaz", u8"Bistri\u021ba", @@ -1951,11 +1951,11 @@ static const char * const _name_romanian_real[] = { "Borsec", u8"Boto\u0219ani", u8"Br\u0103ila", - u8"Bra\u021bov", + u8"Bra\u0219ov", u8"Bucure\u0219ti", "Buftea", u8"Buz\u0103u", - u8"C\u0103l\u0103rasi", + u8"C\u0103l\u0103ra\u0219i", u8"Caransebe\u0219", u8"Cernavod\u0103", "Cluj-Napoca", @@ -1966,12 +1966,12 @@ static const char * const _name_romanian_real[] = { "Deva", "Dorohoi", "Drobeta-Turnu Severin", - u8"Dr\u0103g\u0103sani", - u8"F\u0103g\u0103ras", + u8"Dr\u0103g\u0103\u0219ani", + u8"F\u0103g\u0103ra\u0219", u8"F\u0103lticeni", u8"Fete\u0219ti", u8"Foc\u0219ani", - u8"Gala\u0219i", + u8"Gala\u021bi", "Gheorgheni", "Giurgiu", u8"H\u00e2r\u0219ova", @@ -2015,10 +2015,10 @@ static const char * const _name_romanian_real[] = { "Sovata", "Suceava", "Sulina", - u8"T\u0103nd\u0103rei", - u8"T\u00e2rgoviste", + u8"\u021a\u0103nd\u0103rei", + u8"T\u00e2rgovi\u0219te", u8"T\u00e2rgu Jiu", - u8"T\u00e2rgu Mures", + u8"T\u00e2rgu Mure\u0219", "Tecuci", u8"Timi\u0219oara", "Tulcea", From 7a97a33598774faf65576b55e5d1322716859de6 Mon Sep 17 00:00:00 2001 From: Owen Rudge Date: Mon, 28 Mar 2022 11:56:19 +0100 Subject: [PATCH 11/14] Fix: [Actions] Switch source for 'gon' in macOS build job --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7adc7c9a03..c19ad01b9a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -619,8 +619,8 @@ jobs: HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 run: | - brew tap mitchellh/gon - brew install mitchellh/gon/gon + brew tap mistydemeo/gon + brew install mistydemeo/gon/gon - name: Notarize env: From 1bfbcff71ea11e327d4287d515f1f30d267953ec Mon Sep 17 00:00:00 2001 From: Owen Rudge Date: Thu, 31 Mar 2022 10:16:19 +0100 Subject: [PATCH 12/14] Change: [Actions] Switch back to primary source for 'gon' in macOS build job This reverts commit 7a97a33598774faf65576b55e5d1322716859de6. --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c19ad01b9a..7adc7c9a03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -619,8 +619,8 @@ jobs: HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 run: | - brew tap mistydemeo/gon - brew install mistydemeo/gon/gon + brew tap mitchellh/gon + brew install mitchellh/gon/gon - name: Notarize env: From 148695c5710d4214d2ef4d5c6b36f00f381ae2e1 Mon Sep 17 00:00:00 2001 From: Aaron Katzin Date: Sat, 2 Apr 2022 11:37:07 +0300 Subject: [PATCH 13/14] Fix #9736: Duplicate multiplayer window opens upon canceling password entry (#9842) --- src/network/network_gui.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 007dddb6d0..1e8b2f4b9c 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -2218,7 +2218,6 @@ struct NetworkJoinStatusWindow : Window { { if (StrEmpty(str)) { NetworkDisconnect(); - ShowNetworkGameWindow(); return; } From 8537fa72063a7376065fd996fa249cc7dbfdb2f3 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 2 Apr 2022 12:36:15 +0200 Subject: [PATCH 14/14] Fix: [Actions] Remove Ubuntu:groovy from release pipeline (#9845) It no longer exists upstream. Let's focus on LTS only for now. --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7adc7c9a03..d99b51e1e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -377,9 +377,6 @@ jobs: - container_image: "ubuntu:20.04" bundle_name: "focal" compiler: "g++" - - container_image: "ubuntu:20.10" - bundle_name: "groovy" - compiler: "g++" - container_image: "debian:buster" bundle_name: "buster" compiler: "g++"