diff --git a/distribution/changelog.txt b/distribution/changelog.txt index a7bb3ebd73..3ef5757088 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,6 +4,7 @@ - Fix: [#475] Water sides drawn incorrectly (original bug). - Fix: [#6123, #7907, #9472, #11028] Cannot build some track designs with 4 stations (original bug). - Fix: [#7094] Back wall edge texture in water missing. +- Fix: [#11005] Company value overflows. - Fix: [#11027] Third color on walls becomes black when saving. 0.2.5 (2020-03-24) diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index 0ebbbfaed6..f3f360e540 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -31,7 +31,7 @@ // This string specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "1" +#define NETWORK_STREAM_VERSION "2" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr; diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 3ab8b011e6..e9354ca34e 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -33,6 +33,7 @@ #include "../ride/RideData.h" #include "../ride/ShopItem.h" #include "../scenario/Scenario.h" +#include "../util/Util.h" #include "../windows/Intent.h" #include "Entrance.h" #include "Map.h" @@ -516,7 +517,12 @@ money32 Park::CalculateRideValue(const Ride* ride) const money32 Park::CalculateCompanyValue() const { - return finance_get_current_cash() + gParkValue - gBankLoan; + money32 result = gParkValue - gBankLoan; + + // Clamp addition to prevent overflow + result = add_clamp_money32(result, finance_get_current_cash()); + + return result; } money16 Park::CalculateTotalRideValueForMoney() const