1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 08:45:00 +01:00

Merge pull request #16958 from IntelOrca/fix/16478-park-no-money

Fix  #16478: No money in .park scenarios
This commit is contained in:
Michael Steenbeek
2022-04-16 22:13:50 +02:00
committed by GitHub
12 changed files with 134 additions and 184 deletions

View File

@@ -133,27 +133,13 @@ namespace Editor
return;
}
if (gParkFlags & PARK_FLAGS_NO_MONEY)
{
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
}
else
{
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
}
gParkFlags |= PARK_FLAGS_NO_MONEY;
scenario_reset();
climate_reset(gClimate);
// Clear the scenario completion status
gParkFlags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT;
gScenarioCompletedCompanyValue = MONEY64_UNDEFINED;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
gEditorStep = EditorStep::ObjectiveSelection;
gScenarioCategory = SCENARIO_CATEGORY_OTHER;
viewport_init_all();
News::InitQueue();
context_open_window_view(WV_EDITOR_MAIN);
FinaliseMainView();
gScreenAge = 0;
@@ -358,14 +344,6 @@ namespace Editor
gGuestChangeModifier = 0;
if (fromSave)
{
if (gParkFlags & PARK_FLAGS_NO_MONEY)
{
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
}
else
{
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
}
gParkFlags |= PARK_FLAGS_NO_MONEY;
if (gParkEntranceFee == 0)

View File

@@ -46,11 +46,11 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
{
if (_value != 0)
{
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
gParkFlags |= PARK_FLAGS_NO_MONEY;
}
else
{
gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO;
gParkFlags &= ~PARK_FLAGS_NO_MONEY;
}
}
else

View File

@@ -2206,11 +2206,9 @@ namespace RCT1
gParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES;
}
// RCT2 uses two flags for no money (due to the scenario editor). RCT1 used only one.
// Copy its value to make no money scenarios such as Arid Heights work properly.
if (_s4.park_flags & RCT1_PARK_FLAGS_NO_MONEY)
{
gParkFlags |= PARK_FLAGS_NO_MONEY_SCENARIO;
gParkFlags |= PARK_FLAGS_NO_MONEY;
}
gParkSize = _s4.park_size;

View File

@@ -252,7 +252,15 @@ namespace RCT2
gInitialCash = ToMoney64(_s6.initial_cash);
gBankLoan = ToMoney64(_s6.current_loan);
gParkFlags = _s6.park_flags;
gParkFlags = _s6.park_flags & ~PARK_FLAGS_NO_MONEY_SCENARIO;
// RCT2 used a different flag for `no money` when the park is a scenario
if (_s6.header.type == S6_TYPE_SCENARIO && (_s6.park_flags & PARK_FLAGS_NO_MONEY_SCENARIO))
gParkFlags |= PARK_FLAGS_NO_MONEY;
else
gParkFlags &= ~PARK_FLAGS_NO_MONEY;
gParkEntranceFee = _s6.park_entrance_fee;
// rct1_park_entrance_x
// rct1_park_entrance_y

View File

@@ -91,19 +91,23 @@ using namespace OpenRCT2;
void scenario_begin()
{
game_load_init();
scenario_reset();
if (gScenarioObjective.Type != OBJECTIVE_NONE && !gLoadKeepWindowsOpen)
context_open_window_view(WV_PARK_OBJECTIVE);
gScreenAge = 0;
}
void scenario_reset()
{
// Set the scenario pseudo-random seeds
Random::Rct2::Seed s{ 0x1234567F ^ Platform::GetTicks(), 0x789FABCD ^ Platform::GetTicks() };
gScenarioRand.seed(s);
gParkFlags &= ~PARK_FLAGS_NO_MONEY;
if (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO)
gParkFlags |= PARK_FLAGS_NO_MONEY;
research_reset_current_item();
scenery_set_default_placement_configuration();
News::InitQueue();
if (gScenarioObjective.Type != OBJECTIVE_NONE && !gLoadKeepWindowsOpen)
context_open_window_view(WV_PARK_OBJECTIVE);
auto& park = GetContext()->GetGameState()->GetPark();
gParkRating = park.CalculateParkRating();
@@ -143,10 +147,13 @@ void scenario_begin()
gCurrentProfit = 0;
gWeeklyProfitAverageDividend = 0;
gWeeklyProfitAverageDivisor = 0;
gScenarioCompletedCompanyValue = MONEY64_UNDEFINED;
gTotalAdmissions = 0;
gTotalIncomeFromAdmissions = 0;
gParkFlags &= ~PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT;
gScenarioCompletedCompanyValue = MONEY64_UNDEFINED;
gScenarioCompletedBy = "?";
park.ResetHistories();
finance_reset_history();
award_reset();
@@ -176,8 +183,6 @@ void scenario_begin()
}
gParkFlags |= PARK_FLAGS_SPRITES_INITIALISED;
gScreenAge = 0;
}
static void scenario_end()
@@ -606,6 +611,8 @@ bool scenario_prepare_for_save()
// Fix #2385: saved scenarios did not initialise temperatures to selected climate
climate_reset(gClimate);
scenario_reset();
return true;
}

View File

@@ -169,6 +169,7 @@ extern std::string gScenarioFileName;
void load_from_sc6(const char* path);
void scenario_begin();
void scenario_reset();
void scenario_update();
bool scenario_create_ducks();
bool AllowEarlyCompletion();

View File

@@ -41,7 +41,6 @@ namespace OpenRCT2::Scripting
{ "difficultGuestGeneration", PARK_FLAGS_DIFFICULT_GUEST_GENERATION },
{ "freeParkEntry", PARK_FLAGS_PARK_FREE_ENTRY },
{ "difficultParkRating", PARK_FLAGS_DIFFICULT_PARK_RATING },
{ "noMoney", PARK_FLAGS_NO_MONEY_SCENARIO },
{ "unlockAllPrices", PARK_FLAGS_UNLOCK_ALL_PRICES },
});

View File

@@ -34,7 +34,7 @@ enum : uint32_t
PARK_FLAGS_PARK_FREE_ENTRY = (1 << 13),
PARK_FLAGS_DIFFICULT_PARK_RATING = (1 << 14),
PARK_FLAGS_LOCK_REAL_NAMES_OPTION_DEPRECATED = (1 << 15), // Deprecated now we use a persistent 'real names' setting
PARK_FLAGS_NO_MONEY_SCENARIO = (1 << 17), // equivalent to PARK_FLAGS_NO_MONEY, but used in scenario editor
PARK_FLAGS_NO_MONEY_SCENARIO = (1 << 17), // Deprecated, originally used in scenario editor
PARK_FLAGS_SPRITES_INITIALISED = (1 << 18), // After a scenario is loaded this prevents edits in the scenario editor
PARK_FLAGS_SIX_FLAGS_DEPRECATED = (1 << 19), // Not used anymore
PARK_FLAGS_UNLOCK_ALL_PRICES = (1u << 31), // OpenRCT2 only!