Move park initialisation to park class

This commit is contained in:
Ted John 2017-07-23 13:17:44 +01:00 committed by Aaron van Geffen
parent 8929e5533b
commit 5a7e34a267
2 changed files with 83 additions and 74 deletions

View File

@ -15,6 +15,7 @@
#pragma endregion
#include "../Cheats.h"
#include "../Context.h"
#include "../config/Config.h"
#include "../core/Math.hpp"
#include "../core/Memory.hpp"
@ -36,13 +37,12 @@
#include "../ride/RideData.h"
#include "../ride/ShopItem.h"
#include "../scenario/Scenario.h"
#include "../windows/Intent.h"
#include "Entrance.h"
#include "Map.h"
#include "Park.h"
#include "Sprite.h"
#include "Surface.h"
#include "../windows/Intent.h"
#include "../Context.h"
rct_string_id gParkName;
uint32 gParkNameArgs;
@ -79,78 +79,6 @@ sint32 _suggestedGuestMaximum;
*/
sint32 _guestGenerationProbability;
sint32 park_is_open()
{
return (gParkFlags & PARK_FLAGS_PARK_OPEN) != 0;
}
/**
*
* rct2: 0x00667132
*/
void park_init()
{
sint32 i;
gUnk13CA740 = 0;
gParkName = STR_UNNAMED_PARK;
gStaffHandymanColour = COLOUR_BRIGHT_RED;
gStaffMechanicColour = COLOUR_LIGHT_BLUE;
gStaffSecurityColour = COLOUR_YELLOW;
gNumGuestsInPark = 0;
gNumGuestsInParkLastWeek = 0;
gNumGuestsHeadingForPark = 0;
gGuestChangeModifier = 0;
gParkRating = 0;
_guestGenerationProbability = 0;
gTotalRideValueForMoney = 0;
gResearchLastItem.rawValue = RESEARCHED_ITEMS_SEPARATOR;
for (i = 0; i < 20; i++)
gMarketingCampaignDaysLeft[i] = 0;
research_reset_items();
finance_init();
set_every_ride_type_not_invented();
set_all_scenery_items_invented();
gParkEntranceFee = MONEY(10, 00);
for (auto &peepSpawn : gPeepSpawns)
{
peepSpawn.x = PEEP_SPAWN_UNDEFINED;
}
gResearchPriorities =
(1 << RESEARCH_CATEGORY_TRANSPORT) |
(1 << RESEARCH_CATEGORY_GENTLE) |
(1 << RESEARCH_CATEGORY_ROLLERCOASTER) |
(1 << RESEARCH_CATEGORY_THRILL) |
(1 << RESEARCH_CATEGORY_WATER) |
(1 << RESEARCH_CATEGORY_SHOP) |
(1 << RESEARCH_CATEGORY_SCENERY_GROUP);
gResearchFundingLevel = RESEARCH_FUNDING_NORMAL;
gGuestInitialCash = MONEY(50,00); // Cash per guest (average)
gGuestInitialHappiness = calculate_guest_initial_happiness(50); // 50%
gGuestInitialHunger = 200;
gGuestInitialThirst = 200;
gScenarioObjectiveType = OBJECTIVE_GUESTS_BY;
gScenarioObjectiveYear = 4;
gScenarioObjectiveNumGuests = 1000;
gLandPrice = MONEY(90, 00);
gConstructionRightsPrice = MONEY(40,00);
gParkFlags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
park_reset_history();
finance_reset_history();
award_reset();
gS6Info.name[0] = '\0';
format_string(gS6Info.details, 256, STR_NO_DETAILS_YET, nullptr);
}
/**
*
* rct2: 0x00667104
@ -580,6 +508,11 @@ Park::~Park()
}
}
bool Park::IsOpen() const
{
return (gParkFlags & PARK_FLAGS_PARK_OPEN) != 0;
}
uint16 Park::GetParkRating() const
{
return gParkRating;
@ -595,6 +528,69 @@ money32 Park::GetCompanyValue() const
return gCompanyValue;
}
void Park::Initialise()
{
gUnk13CA740 = 0;
gParkName = STR_UNNAMED_PARK;
gStaffHandymanColour = COLOUR_BRIGHT_RED;
gStaffMechanicColour = COLOUR_LIGHT_BLUE;
gStaffSecurityColour = COLOUR_YELLOW;
gNumGuestsInPark = 0;
gNumGuestsInParkLastWeek = 0;
gNumGuestsHeadingForPark = 0;
gGuestChangeModifier = 0;
gParkRating = 0;
_guestGenerationProbability = 0;
gTotalRideValueForMoney = 0;
gResearchLastItem.rawValue = RESEARCHED_ITEMS_SEPARATOR;
for (size_t i = 0; i < 20; i++)
{
gMarketingCampaignDaysLeft[i] = 0;
}
research_reset_items();
finance_init();
set_every_ride_type_not_invented();
set_all_scenery_items_invented();
gParkEntranceFee = MONEY(10, 00);
for (auto &peepSpawn : gPeepSpawns)
{
peepSpawn.x = PEEP_SPAWN_UNDEFINED;
}
gResearchPriorities =
(1 << RESEARCH_CATEGORY_TRANSPORT) |
(1 << RESEARCH_CATEGORY_GENTLE) |
(1 << RESEARCH_CATEGORY_ROLLERCOASTER) |
(1 << RESEARCH_CATEGORY_THRILL) |
(1 << RESEARCH_CATEGORY_WATER) |
(1 << RESEARCH_CATEGORY_SHOP) |
(1 << RESEARCH_CATEGORY_SCENERY_GROUP);
gResearchFundingLevel = RESEARCH_FUNDING_NORMAL;
gGuestInitialCash = MONEY(50,00);
gGuestInitialHappiness = CalculateGuestInitialHappiness(50);
gGuestInitialHunger = 200;
gGuestInitialThirst = 200;
gScenarioObjectiveType = OBJECTIVE_GUESTS_BY;
gScenarioObjectiveYear = 4;
gScenarioObjectiveNumGuests = 1000;
gLandPrice = MONEY(90,00);
gConstructionRightsPrice = MONEY(40,00);
gParkFlags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
ResetHistories();
finance_reset_history();
award_reset();
gS6Info.name[0] = '\0';
format_string(gS6Info.details, 256, STR_NO_DETAILS_YET, nullptr);
}
void Park::Update()
{
// Every 5 seconds approximately
@ -1062,6 +1058,16 @@ void Park::UpdateHistories()
window_invalidate_by_class(WC_FINANCES);
}
sint32 park_is_open()
{
return _singleton->IsOpen();
}
void park_init()
{
_singleton->Initialise();
}
sint32 park_calculate_size()
{
auto tiles = _singleton->CalculateParkSize();

View File

@ -61,10 +61,13 @@ namespace OpenRCT2
Park();
~Park();
bool IsOpen() const;
uint16 GetParkRating() const;
money32 GetParkValue() const;
money32 GetCompanyValue() const;
void Initialise();
void Update();
sint32 CalculateParkSize() const;