From 0a4fa68138da6d70eacfd3e9e69fcaf20b345cd6 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 19 Jun 2019 03:18:58 +0200 Subject: [PATCH 1/3] Fix money effect having random position in multiplayer --- src/openrct2/world/MoneyEffect.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/openrct2/world/MoneyEffect.cpp b/src/openrct2/world/MoneyEffect.cpp index 16680d802d..1b57ecc48b 100644 --- a/src/openrct2/world/MoneyEffect.cpp +++ b/src/openrct2/world/MoneyEffect.cpp @@ -12,6 +12,7 @@ #include "../interface/Viewport.h" #include "../interface/Window.h" #include "../localisation/Localisation.h" +#include "../network/network.h" #include "Map.h" #include "Sprite.h" @@ -80,6 +81,14 @@ void rct_money_effect::Create(money32 value) if (mapPosition.x == LOCATION_NULL) { + // If game actions return no valid location of the action we can not use the screen + // coordinates as every client will have different ones. + if (network_get_mode() != NETWORK_MODE_NONE) + { + log_warning("Attempted to create money effect without a valid location in multiplayer"); + return; + } + rct_window* mainWindow = window_get_main(); if (mainWindow == nullptr) return; From df30d5d9bc5fe1713fead34b6ed9245cf45c88d3 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 19 Jun 2019 03:20:19 +0200 Subject: [PATCH 2/3] Fix MarketingCampaignFlags::FIRST_WEEK not being imported/exported with sv6 --- src/openrct2/management/Marketing.h | 1 + src/openrct2/rct2/S6Exporter.cpp | 2 ++ src/openrct2/rct2/S6Importer.cpp | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/openrct2/management/Marketing.h b/src/openrct2/management/Marketing.h index 6d4df0ebde..36c931754b 100644 --- a/src/openrct2/management/Marketing.h +++ b/src/openrct2/management/Marketing.h @@ -36,6 +36,7 @@ enum enum { + CAMPAIGN_FIRST_WEEK_FLAG = (1 << 6), CAMPAIGN_ACTIVE_FLAG = (1 << 7) }; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 1772a19fb2..e5a3d286a5 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -795,6 +795,8 @@ void S6Exporter::ExportMarketingCampaigns() for (const auto& campaign : gMarketingCampaigns) { _s6.campaign_weeks_left[campaign.Type] = campaign.WeeksLeft | CAMPAIGN_ACTIVE_FLAG; + if ((campaign.Flags & MarketingCampaignFlags::FIRST_WEEK)) + _s6.campaign_weeks_left[campaign.Type] |= CAMPAIGN_FIRST_WEEK_FLAG; if (campaign.Type == ADVERTISING_CAMPAIGN_RIDE_FREE || campaign.Type == ADVERTISING_CAMPAIGN_RIDE) { _s6.campaign_ride_index[campaign.Type] = campaign.RideId; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 994070cb4d..2ce88cd597 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1072,7 +1072,11 @@ public: { MarketingCampaign campaign{}; campaign.Type = (uint8_t)i; - campaign.WeeksLeft = _s6.campaign_weeks_left[i] & ~CAMPAIGN_ACTIVE_FLAG; + campaign.WeeksLeft = _s6.campaign_weeks_left[i] & ~(CAMPAIGN_ACTIVE_FLAG | CAMPAIGN_FIRST_WEEK_FLAG); + if ((_s6.campaign_weeks_left[i] & CAMPAIGN_FIRST_WEEK_FLAG) != 0) + { + campaign.Flags |= MarketingCampaignFlags::FIRST_WEEK; + } if (campaign.Type == ADVERTISING_CAMPAIGN_RIDE_FREE || campaign.Type == ADVERTISING_CAMPAIGN_RIDE) { campaign.RideId = _s6.campaign_ride_index[i]; From 881b7012ac93fa953c501cfd0a99bddfb3e621cb Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 19 Jun 2019 03:29:46 +0200 Subject: [PATCH 3/3] Bump up network version --- src/openrct2/network/Network.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index 6e5e854a8f..20d496191e 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -33,7 +33,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 "43" +#define NETWORK_STREAM_VERSION "44" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr;