Fix #19906: Destructible cheat does not allow ride modification (#19924)

This commit is contained in:
Chase 2023-04-15 08:10:54 +08:00 committed by GitHub
parent f7b8a2fde7
commit 7e313d45cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 30 additions and 28 deletions

View File

@ -218,6 +218,7 @@ The following people are not part of the development team, but have been contrib
* Ernest Wong (ErnWong) * Ernest Wong (ErnWong)
* Joel H. (HtotheTML) * Joel H. (HtotheTML)
* John Mulcahy (jayjay300) * John Mulcahy (jayjay300)
* Chase Percy (Chase-Percy)
## Toolchain ## Toolchain
* (Balletie) - macOS * (Balletie) - macOS

View File

@ -20,6 +20,7 @@
- Fix: [#19801] The in-game load/save window cannot be resized anymore. - Fix: [#19801] The in-game load/save window cannot be resized anymore.
- Fix: [#19854] Looping Coaster trains clipping through steep quarter turns down. - Fix: [#19854] Looping Coaster trains clipping through steep quarter turns down.
- Fix: [#19901] Random shop colours never assigning last colour. - Fix: [#19901] Random shop colours never assigning last colour.
- Fix: [#19924] Destructible cheat does not allow partial ride modification.
0.4.4 (2023-03-28) 0.4.4 (2023-03-28)
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@ -157,7 +157,6 @@ enum WindowCheatsWidgetIdx
WIDX_FIX_ALL = WIDX_TAB_CONTENT, WIDX_FIX_ALL = WIDX_TAB_CONTENT,
WIDX_RENEW_RIDES, WIDX_RENEW_RIDES,
WIDX_MAKE_DESTRUCTIBLE,
WIDX_RESET_CRASH_STATUS, WIDX_RESET_CRASH_STATUS,
WIDX_10_MINUTE_INSPECTIONS, WIDX_10_MINUTE_INSPECTIONS,
WIDX_CONSTRUCTION_GROUP, WIDX_CONSTRUCTION_GROUP,
@ -165,6 +164,7 @@ enum WindowCheatsWidgetIdx
WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES, WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES,
WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK, WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK,
WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS,
WIDX_MAKE_DESTRUCTIBLE,
WIDX_OPERATION_MODES_GROUP, WIDX_OPERATION_MODES_GROUP,
WIDX_SHOW_ALL_OPERATING_MODES, WIDX_SHOW_ALL_OPERATING_MODES,
WIDX_UNLOCK_OPERATING_LIMITS, WIDX_UNLOCK_OPERATING_LIMITS,
@ -299,14 +299,14 @@ static Widget window_cheats_rides_widgets[] =
MAIN_CHEATS_WIDGETS, MAIN_CHEATS_WIDGETS,
MakeWidget({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_FIX_ALL_RIDES, STR_CHEAT_FIX_ALL_RIDES_TIP ), // Fix all rides MakeWidget({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_FIX_ALL_RIDES, STR_CHEAT_FIX_ALL_RIDES_TIP ), // Fix all rides
MakeWidget({127, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_RENEW_RIDES, STR_CHEAT_RENEW_RIDES_TIP ), // Renew rides MakeWidget({127, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_RENEW_RIDES, STR_CHEAT_RENEW_RIDES_TIP ), // Renew rides
MakeWidget({ 11, 69}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_MAKE_DESTRUCTABLE, STR_CHEAT_MAKE_DESTRUCTABLE_TIP ), // All destructible
MakeWidget({127, 69}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_RESET_CRASH_STATUS, STR_CHEAT_RESET_CRASH_STATUS_TIP ), // Reset crash status MakeWidget({127, 69}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_RESET_CRASH_STATUS, STR_CHEAT_RESET_CRASH_STATUS_TIP ), // Reset crash status
MakeWidget({ 11, 90}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_10_MINUTE_INSPECTIONS, STR_CHEAT_10_MINUTE_INSPECTIONS_TIP ), // 10 minute inspections MakeWidget({ 11, 69}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_10_MINUTE_INSPECTIONS, STR_CHEAT_10_MINUTE_INSPECTIONS_TIP ), // 10 minute inspections
MakeWidget({ 5, 116}, {238, 101}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GROUP_CONSTRUCTION ), // Construction group MakeWidget({ 5, 95}, {238, 122}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GROUP_CONSTRUCTION ), // Construction group
MakeWidget({ 11, 132}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_BUILD_IN_PAUSE_MODE, STR_CHEAT_BUILD_IN_PAUSE_MODE_TIP ), // Build in pause mode MakeWidget({ 11, 111}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_BUILD_IN_PAUSE_MODE, STR_CHEAT_BUILD_IN_PAUSE_MODE_TIP ), // Build in pause mode
MakeWidget({ 11, 153}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ENABLE_ALL_DRAWABLE_TRACK_PIECES, STR_CHEAT_ENABLE_ALL_DRAWABLE_TRACK_PIECES_TIP ), // Show all drawable track pieces MakeWidget({ 11, 132}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ENABLE_ALL_DRAWABLE_TRACK_PIECES, STR_CHEAT_ENABLE_ALL_DRAWABLE_TRACK_PIECES_TIP ), // Show all drawable track pieces
MakeWidget({ 11, 174}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ENABLE_CHAIN_LIFT_ON_ALL_TRACK, STR_CHEAT_ENABLE_CHAIN_LIFT_ON_ALL_TRACK_TIP ), // Enable chain lift on all track MakeWidget({ 11, 153}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ENABLE_CHAIN_LIFT_ON_ALL_TRACK, STR_CHEAT_ENABLE_CHAIN_LIFT_ON_ALL_TRACK_TIP ), // Enable chain lift on all track
MakeWidget({ 11, 195}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, STR_CHEAT_ALLOW_TRACK_PLACE_INVALID_HEIGHTS_TIP), // Allow track place at invalid heights MakeWidget({ 11, 174}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, STR_CHEAT_ALLOW_TRACK_PLACE_INVALID_HEIGHTS_TIP), // Allow track place at invalid heights
MakeWidget({ 11, 195}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_MAKE_DESTRUCTABLE, STR_CHEAT_MAKE_DESTRUCTABLE_TIP ), // All destructible
MakeWidget({ 5, 221}, {238, 122}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GROUP_OPERATION ), // Operation group MakeWidget({ 5, 221}, {238, 122}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GROUP_OPERATION ), // Operation group
MakeWidget({ 11, 237}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_SHOW_ALL_OPERATING_MODES ), // Show all operating modes MakeWidget({ 11, 237}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_SHOW_ALL_OPERATING_MODES ), // Show all operating modes
MakeWidget({ 11, 258}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_UNLOCK_OPERATING_LIMITS, STR_CHEAT_UNLOCK_OPERATING_LIMITS_TIP ), // 410 km/h lift hill etc. MakeWidget({ 11, 258}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_UNLOCK_OPERATING_LIMITS, STR_CHEAT_UNLOCK_OPERATING_LIMITS_TIP ), // 410 km/h lift hill etc.
@ -502,6 +502,7 @@ public:
SetCheckboxValue(WIDX_IGNORE_RESEARCH_STATUS, gCheatsIgnoreResearchStatus); SetCheckboxValue(WIDX_IGNORE_RESEARCH_STATUS, gCheatsIgnoreResearchStatus);
SetCheckboxValue(WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES, gCheatsEnableAllDrawableTrackPieces); SetCheckboxValue(WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES, gCheatsEnableAllDrawableTrackPieces);
SetCheckboxValue(WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, gCheatsAllowTrackPlaceInvalidHeights); SetCheckboxValue(WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, gCheatsAllowTrackPlaceInvalidHeights);
SetCheckboxValue(WIDX_MAKE_DESTRUCTIBLE, gCheatsMakeAllDestructible);
break; break;
} }
@ -1038,7 +1039,7 @@ private:
CheatsSet(CheatType::RenewRides); CheatsSet(CheatType::RenewRides);
break; break;
case WIDX_MAKE_DESTRUCTIBLE: case WIDX_MAKE_DESTRUCTIBLE:
CheatsSet(CheatType::MakeDestructible); CheatsSet(CheatType::MakeDestructible, !gCheatsMakeAllDestructible);
break; break;
case WIDX_FIX_ALL: case WIDX_FIX_ALL:
CheatsSet(CheatType::FixRides); CheatsSet(CheatType::FixRides);

View File

@ -2318,7 +2318,8 @@ static void WindowRideMainInvalidate(WindowBase* w)
return; return;
w->disabled_widgets &= ~((1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_CONSTRUCTION)); w->disabled_widgets &= ~((1uLL << WIDX_DEMOLISH) | (1uLL << WIDX_CONSTRUCTION));
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)) if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
&& !gCheatsMakeAllDestructible)
w->disabled_widgets |= (1uLL << WIDX_DEMOLISH); w->disabled_widgets |= (1uLL << WIDX_DEMOLISH);
auto ft = Formatter::Common(); auto ft = Formatter::Common();

View File

@ -54,6 +54,7 @@ bool gCheatsEnableAllDrawableTrackPieces = false;
bool gCheatsAllowTrackPlaceInvalidHeights = false; bool gCheatsAllowTrackPlaceInvalidHeights = false;
bool gCheatsAllowRegularPathAsQueue = false; bool gCheatsAllowRegularPathAsQueue = false;
bool gCheatsAllowSpecialColourSchemes = false; bool gCheatsAllowSpecialColourSchemes = false;
bool gCheatsMakeAllDestructible = false;
void CheatsReset() void CheatsReset()
{ {
@ -81,6 +82,7 @@ void CheatsReset()
gCheatsAllowTrackPlaceInvalidHeights = false; gCheatsAllowTrackPlaceInvalidHeights = false;
gCheatsAllowRegularPathAsQueue = false; gCheatsAllowRegularPathAsQueue = false;
gCheatsAllowSpecialColourSchemes = false; gCheatsAllowSpecialColourSchemes = false;
gCheatsMakeAllDestructible = false;
} }
void CheatsSet(CheatType cheatType, int32_t param1 /* = 0*/, int32_t param2 /* = 0*/) void CheatsSet(CheatType cheatType, int32_t param1 /* = 0*/, int32_t param2 /* = 0*/)
@ -131,6 +133,7 @@ void CheatsSerialise(DataSerialiser& ds)
CheatEntrySerialise(ds, CheatType::AllowTrackPlaceInvalidHeights, gCheatsAllowTrackPlaceInvalidHeights, count); CheatEntrySerialise(ds, CheatType::AllowTrackPlaceInvalidHeights, gCheatsAllowTrackPlaceInvalidHeights, count);
CheatEntrySerialise(ds, CheatType::AllowRegularPathAsQueue, gCheatsAllowRegularPathAsQueue, count); CheatEntrySerialise(ds, CheatType::AllowRegularPathAsQueue, gCheatsAllowRegularPathAsQueue, count);
CheatEntrySerialise(ds, CheatType::AllowSpecialColourSchemes, gCheatsAllowSpecialColourSchemes, count); CheatEntrySerialise(ds, CheatType::AllowSpecialColourSchemes, gCheatsAllowSpecialColourSchemes, count);
CheatEntrySerialise(ds, CheatType::MakeDestructible, gCheatsMakeAllDestructible, count);
// Remember current position and update count. // Remember current position and update count.
uint64_t endOffset = stream.GetPosition(); uint64_t endOffset = stream.GetPosition();
@ -229,6 +232,9 @@ void CheatsSerialise(DataSerialiser& ds)
case CheatType::AllowSpecialColourSchemes: case CheatType::AllowSpecialColourSchemes:
ds << gCheatsAllowSpecialColourSchemes; ds << gCheatsAllowSpecialColourSchemes;
break; break;
case CheatType::MakeDestructible:
ds << gCheatsMakeAllDestructible;
break;
default: default:
break; break;
} }

View File

@ -35,6 +35,7 @@ extern bool gCheatsEnableAllDrawableTrackPieces;
extern bool gCheatsAllowTrackPlaceInvalidHeights; extern bool gCheatsAllowTrackPlaceInvalidHeights;
extern bool gCheatsAllowRegularPathAsQueue; extern bool gCheatsAllowRegularPathAsQueue;
extern bool gCheatsAllowSpecialColourSchemes; extern bool gCheatsAllowSpecialColourSchemes;
extern bool gCheatsMakeAllDestructible;
enum class CheatType : int32_t enum class CheatType : int32_t
{ {

View File

@ -183,7 +183,8 @@ GameActions::Result CheatSetAction::Execute() const
RenewRides(); RenewRides();
break; break;
case CheatType::MakeDestructible: case CheatType::MakeDestructible:
MakeDestructible(); gCheatsMakeAllDestructible = _param1 != 0;
WindowInvalidateByClass(WindowClass::Ride);
break; break;
case CheatType::FixRides: case CheatType::FixRides:
FixBrokenRides(); FixBrokenRides();
@ -475,16 +476,6 @@ void CheatSetAction::RenewRides() const
WindowInvalidateByClass(WindowClass::Ride); WindowInvalidateByClass(WindowClass::Ride);
} }
void CheatSetAction::MakeDestructible() const
{
for (auto& ride : GetRideManager())
{
ride.lifecycle_flags &= ~RIDE_LIFECYCLE_INDESTRUCTIBLE;
ride.lifecycle_flags &= ~RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK;
}
WindowInvalidateByClass(WindowClass::Ride);
}
void CheatSetAction::ResetRideCrashStatus() const void CheatSetAction::ResetRideCrashStatus() const
{ {
for (auto& ride : GetRideManager()) for (auto& ride : GetRideManager())

View File

@ -40,7 +40,6 @@ private:
void RemoveLitter() const; void RemoveLitter() const;
void FixBrokenRides() const; void FixBrokenRides() const;
void RenewRides() const; void RenewRides() const;
void MakeDestructible() const;
void ResetRideCrashStatus() const; void ResetRideCrashStatus() const;
void Set10MinuteInspection() const; void Set10MinuteInspection() const;
void SetScenarioNoMoney(bool enabled) const; void SetScenarioNoMoney(bool enabled) const;

View File

@ -64,8 +64,9 @@ GameActions::Result RideDemolishAction::Query() const
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_NONE); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DEMOLISH_RIDE, STR_NONE);
} }
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) if ((ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)
&& _modifyType == RIDE_MODIFY_DEMOLISH) && _modifyType == RIDE_MODIFY_DEMOLISH)
&& !gCheatsMakeAllDestructible)
{ {
return GameActions::Result( return GameActions::Result(
GameActions::Status::NoClearance, STR_CANT_DEMOLISH_RIDE, GameActions::Status::NoClearance, STR_CANT_DEMOLISH_RIDE,

View File

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

View File

@ -9,10 +9,10 @@ struct ObjectRepositoryItem;
namespace OpenRCT2 namespace OpenRCT2
{ {
// Current version that is saved. // Current version that is saved.
constexpr uint32_t PARK_FILE_CURRENT_VERSION = 27; constexpr uint32_t PARK_FILE_CURRENT_VERSION = 28;
// The minimum version that is forwards compatible with the current version. // The minimum version that is forwards compatible with the current version.
constexpr uint32_t PARK_FILE_MIN_VERSION = 27; constexpr uint32_t PARK_FILE_MIN_VERSION = 28;
// The minimum version that is backwards compatible with the current version. // The minimum version that is backwards compatible with the current version.
// If this is increased beyond 0, uncomment the checks in ParkFile.cpp and Context.cpp! // If this is increased beyond 0, uncomment the checks in ParkFile.cpp and Context.cpp!

View File

@ -882,7 +882,7 @@ void TrackElement::SetBrakeClosed(bool isClosed)
bool TrackElement::IsIndestructible() const bool TrackElement::IsIndestructible() const
{ {
return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0; return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0 && !gCheatsMakeAllDestructible;
} }
void TrackElement::SetIsIndestructible(bool isIndestructible) void TrackElement::SetIsIndestructible(bool isIndestructible)