mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-21 06:43:04 +01:00
Make remove_park_fences multiplayer-safe
This commit is contained in:
@@ -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_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 can’t be fired.
|
STR_6591 :Staff member is currently fixing a ride and can’t be fired.
|
||||||
STR_6592 :Staff member is currently inspecting a ride and can’t be fired.
|
STR_6592 :Staff member is currently inspecting a ride and can’t be fired.
|
||||||
|
STR_6593 :Remove park fences
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# Scenarios #
|
# Scenarios #
|
||||||
|
|||||||
@@ -342,6 +342,8 @@ const char* CheatsGetName(CheatType cheatType)
|
|||||||
return LanguageGetString(STR_CHEAT_ALLOW_PATH_AS_QUEUE);
|
return LanguageGetString(STR_CHEAT_ALLOW_PATH_AS_QUEUE);
|
||||||
case CheatType::AllowSpecialColourSchemes:
|
case CheatType::AllowSpecialColourSchemes:
|
||||||
return LanguageGetString(STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES);
|
return LanguageGetString(STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES);
|
||||||
|
case CheatType::RemoveParkFences:
|
||||||
|
return LanguageGetString(STR_CHEAT_REMOVE_PARK_FENCES);
|
||||||
default:
|
default:
|
||||||
return "Unknown Cheat";
|
return "Unknown Cheat";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ enum class CheatType : int32_t
|
|||||||
NoCapOnQueueLengthDummy, // Removed; this dummy exists only for deserialisation parks that had it saved
|
NoCapOnQueueLengthDummy, // Removed; this dummy exists only for deserialisation parks that had it saved
|
||||||
AllowRegularPathAsQueue,
|
AllowRegularPathAsQueue,
|
||||||
AllowSpecialColourSchemes,
|
AllowSpecialColourSchemes,
|
||||||
|
RemoveParkFences,
|
||||||
Count,
|
Count,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -248,6 +248,9 @@ GameActions::Result CheatSetAction::Execute() const
|
|||||||
case CheatType::AllowSpecialColourSchemes:
|
case CheatType::AllowSpecialColourSchemes:
|
||||||
gCheatsAllowSpecialColourSchemes = static_cast<bool>(_param1);
|
gCheatsAllowSpecialColourSchemes = static_cast<bool>(_param1);
|
||||||
break;
|
break;
|
||||||
|
case CheatType::RemoveParkFences:
|
||||||
|
RemoveParkFences();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
LOG_ERROR("Unabled cheat: %d", _cheatType.id);
|
LOG_ERROR("Unabled cheat: %d", _cheatType.id);
|
||||||
@@ -395,6 +398,8 @@ ParametersRange CheatSetAction::GetParameterRange(CheatType cheatType) const
|
|||||||
case CheatType::NoCapOnQueueLengthDummy:
|
case CheatType::NoCapOnQueueLengthDummy:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case CheatType::RemoveLitter:
|
case CheatType::RemoveLitter:
|
||||||
|
[[fallthrough]];
|
||||||
|
case CheatType::RemoveParkFences:
|
||||||
return { { 0, 0 }, { 0, 0 } };
|
return { { 0, 0 }, { 0, 0 } };
|
||||||
case CheatType::Count:
|
case CheatType::Count:
|
||||||
break;
|
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();
|
||||||
|
}
|
||||||
|
|||||||
@@ -54,4 +54,5 @@ private:
|
|||||||
void OwnAllLand() const;
|
void OwnAllLand() const;
|
||||||
void ParkSetOpen(bool isOpen) const;
|
void ParkSetOpen(bool isOpen) const;
|
||||||
void CreateDucks(int count) const;
|
void CreateDucks(int count) const;
|
||||||
|
void RemoveParkFences() const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1396,18 +1396,8 @@ static int32_t ConsoleCommandRemoveFloatingObjects(InteractiveConsole& console,
|
|||||||
|
|
||||||
static int32_t ConsoleCommandRemoveParkFences(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandRemoveParkFences(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
TileElementIterator it;
|
auto action = CheatSetAction(CheatType::RemoveParkFences);
|
||||||
TileElementIteratorBegin(&it);
|
GameActions::Execute(&action);
|
||||||
do
|
|
||||||
{
|
|
||||||
if (it.element->GetType() == TileElementType::Surface)
|
|
||||||
{
|
|
||||||
// Remove all park fence flags
|
|
||||||
it.element->AsSurface()->SetParkFences(0);
|
|
||||||
}
|
|
||||||
} while (TileElementIteratorNext(&it));
|
|
||||||
|
|
||||||
GfxInvalidateScreen();
|
|
||||||
|
|
||||||
console.WriteFormatLine("Park fences have been removed.");
|
console.WriteFormatLine("Park fences have been removed.");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -4000,6 +4000,8 @@ enum : uint16_t
|
|||||||
STR_CANT_FIRE_STAFF_FIXING = 6591,
|
STR_CANT_FIRE_STAFF_FIXING = 6591,
|
||||||
STR_CANT_FIRE_STAFF_INSPECTING = 6592,
|
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
|
// 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
|
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user