diff --git a/src/openrct2/management/finance.c b/src/openrct2/management/finance.c index 60555c95ab..a5fcdd1ebf 100644 --- a/src/openrct2/management/finance.c +++ b/src/openrct2/management/finance.c @@ -73,9 +73,16 @@ uint8 gCommandExpenditureType; void finance_payment(money32 amount, rct_expenditure_type type) { money32 cur_money = DECRYPT_MONEY(gCashEncrypted); - money32 new_money = cur_money - amount; + money32 new_money; //overflow check + if (amount < 0 && cur_money >= INT_MAX + amount) + new_money = INT_MAX; + else if (amount >= 0 && cur_money < INT_MIN + amount) + new_money = INT_MIN; + else + new_money = cur_money - amount; + gCashEncrypted = ENCRYPT_MONEY(new_money); gExpenditureTable[type] -= amount; if (dword_988E60[type] & 1) diff --git a/src/openrct2/network/network.h b/src/openrct2/network/network.h index 3cf2da128b..3306bec08b 100644 --- a/src/openrct2/network/network.h +++ b/src/openrct2/network/network.h @@ -54,7 +54,7 @@ extern "C" { // This define 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 "28" +#define NETWORK_STREAM_VERSION "29" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION #ifdef __cplusplus