Merge pull request #20922 from Gymnasiast/feature/remove-park-fences-multiplayer

Make remove_park_fences multiplayer-safe
This commit is contained in:
Matt 2023-11-03 17:08:05 +02:00 committed by GitHub
commit 9300e33ac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 13 deletions

View File

@ -3695,6 +3695,7 @@ STR_6589 :Show window buttons on the left
STR_6590 :Show the window buttons (e.g. to close the window) on the left of the title bar instead of on the right.
STR_6591 :Staff member is currently fixing a ride and cant be fired.
STR_6592 :Staff member is currently inspecting a ride and cant be fired.
STR_6593 :Remove park fences
#############
# Scenarios #

View File

@ -342,6 +342,8 @@ const char* CheatsGetName(CheatType cheatType)
return LanguageGetString(STR_CHEAT_ALLOW_PATH_AS_QUEUE);
case CheatType::AllowSpecialColourSchemes:
return LanguageGetString(STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES);
case CheatType::RemoveParkFences:
return LanguageGetString(STR_CHEAT_REMOVE_PARK_FENCES);
default:
return "Unknown Cheat";
}

View File

@ -91,6 +91,7 @@ enum class CheatType : int32_t
NoCapOnQueueLengthDummy, // Removed; this dummy exists only for deserialisation parks that had it saved
AllowRegularPathAsQueue,
AllowSpecialColourSchemes,
RemoveParkFences,
Count,
};

View File

@ -248,6 +248,9 @@ GameActions::Result CheatSetAction::Execute() const
case CheatType::AllowSpecialColourSchemes:
gCheatsAllowSpecialColourSchemes = static_cast<bool>(_param1);
break;
case CheatType::RemoveParkFences:
RemoveParkFences();
break;
default:
{
LOG_ERROR("Unabled cheat: %d", _cheatType.id);
@ -395,6 +398,8 @@ ParametersRange CheatSetAction::GetParameterRange(CheatType cheatType) const
case CheatType::NoCapOnQueueLengthDummy:
[[fallthrough]];
case CheatType::RemoveLitter:
[[fallthrough]];
case CheatType::RemoveParkFences:
return { { 0, 0 }, { 0, 0 } };
case CheatType::Count:
break;
@ -786,3 +791,19 @@ void CheatSetAction::CreateDucks(int count) const
}
}
}
void CheatSetAction::RemoveParkFences() const
{
TileElementIterator it;
TileElementIteratorBegin(&it);
do
{
if (it.element->GetType() == TileElementType::Surface)
{
// Remove all park fence flags
it.element->AsSurface()->SetParkFences(0);
}
} while (TileElementIteratorNext(&it));
GfxInvalidateScreen();
}

View File

@ -54,4 +54,5 @@ private:
void OwnAllLand() const;
void ParkSetOpen(bool isOpen) const;
void CreateDucks(int count) const;
void RemoveParkFences() const;
};

View File

@ -1396,18 +1396,8 @@ static int32_t ConsoleCommandRemoveFloatingObjects(InteractiveConsole& console,
static int32_t ConsoleCommandRemoveParkFences(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
{
TileElementIterator it;
TileElementIteratorBegin(&it);
do
{
if (it.element->GetType() == TileElementType::Surface)
{
// Remove all park fence flags
it.element->AsSurface()->SetParkFences(0);
}
} while (TileElementIteratorNext(&it));
GfxInvalidateScreen();
auto action = CheatSetAction(CheatType::RemoveParkFences);
GameActions::Execute(&action);
console.WriteFormatLine("Park fences have been removed.");
return 0;

View File

@ -4000,6 +4000,8 @@ enum : uint16_t
STR_CANT_FIRE_STAFF_FIXING = 6591,
STR_CANT_FIRE_STAFF_INSPECTING = 6592,
STR_CHEAT_REMOVE_PARK_FENCES = 6593,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
};

View File

@ -43,7 +43,7 @@
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "7"
#define NETWORK_STREAM_VERSION "8"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION