1 /***************************************************************************** 2 * Copyright (c) 2014-2020 OpenRCT2 developers 3 * 4 * For a complete list of all authors, please refer to contributors.md 5 * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 6 * 7 * OpenRCT2 is licensed under the GNU General Public License version 3. 8 *****************************************************************************/ 9 10 #pragma once 11 12 #include "../common.h" 13 #include "../ride/Ride.h" 14 #include "Map.h" 15 16 #define MAX_ENTRANCE_FEE MONEY(200, 00) 17 18 constexpr const uint8_t ParkRatingHistoryUndefined = std::numeric_limits<uint8_t>::max(); 19 constexpr const uint32_t GuestsInParkHistoryUndefined = std::numeric_limits<uint32_t>::max(); 20 21 enum : uint32_t 22 { 23 PARK_FLAGS_PARK_OPEN = (1 << 0), 24 PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT = (1 << 1), 25 PARK_FLAGS_FORBID_LANDSCAPE_CHANGES = (1 << 2), 26 PARK_FLAGS_FORBID_TREE_REMOVAL = (1 << 3), 27 PARK_FLAGS_SHOW_REAL_GUEST_NAMES = (1 << 4), 28 PARK_FLAGS_FORBID_HIGH_CONSTRUCTION = (1 << 5), // below tree height 29 PARK_FLAGS_PREF_LESS_INTENSE_RIDES = (1 << 6), 30 PARK_FLAGS_FORBID_MARKETING_CAMPAIGN = (1 << 7), 31 PARK_FLAGS_ANTI_CHEAT_DEPRECATED = (1 << 8), // Not used anymore, used for cheat detection 32 PARK_FLAGS_PREF_MORE_INTENSE_RIDES = (1 << 9), 33 PARK_FLAGS_NO_MONEY = (1 << 11), 34 PARK_FLAGS_DIFFICULT_GUEST_GENERATION = (1 << 12), 35 PARK_FLAGS_PARK_FREE_ENTRY = (1 << 13), 36 PARK_FLAGS_DIFFICULT_PARK_RATING = (1 << 14), 37 PARK_FLAGS_LOCK_REAL_NAMES_OPTION_DEPRECATED = (1 << 15), // Deprecated now we use a persistent 'real names' setting 38 PARK_FLAGS_NO_MONEY_SCENARIO = (1 << 17), // equivalent to PARK_FLAGS_NO_MONEY, but used in scenario editor 39 PARK_FLAGS_SPRITES_INITIALISED = (1 << 18), // After a scenario is loaded this prevents edits in the scenario editor 40 PARK_FLAGS_SIX_FLAGS_DEPRECATED = (1 << 19), // Not used anymore 41 PARK_FLAGS_UNLOCK_ALL_PRICES = (1u << 31), // OpenRCT2 only! 42 }; 43 44 struct Guest; 45 struct rct_ride; 46 47 namespace OpenRCT2 48 { 49 class Date; 50 51 class Park final 52 { 53 public: 54 std::string Name; 55 56 Park() = default; 57 Park(const Park&) = delete; 58 59 bool IsOpen() const; 60 61 uint16_t GetParkRating() const; 62 money64 GetParkValue() const; 63 money64 GetCompanyValue() const; 64 65 void Initialise(); 66 void Update(const Date& date); 67 68 int32_t CalculateParkSize() const; 69 int32_t CalculateParkRating() const; 70 money64 CalculateParkValue() const; 71 money64 CalculateCompanyValue() const; 72 static uint8_t CalculateGuestInitialHappiness(uint8_t percentage); 73 74 Guest* GenerateGuest(); 75 76 void ResetHistories(); 77 void UpdateHistories(); 78 79 private: 80 money64 CalculateRideValue(const Ride* ride) const; 81 money16 CalculateTotalRideValueForMoney() const; 82 uint32_t CalculateSuggestedMaxGuests() const; 83 uint32_t CalculateGuestGenerationProbability() const; 84 85 void GenerateGuests(); 86 Guest* GenerateGuestFromCampaign(int32_t campaign); 87 }; 88 } // namespace OpenRCT2 89 90 extern uint64_t gParkFlags; 91 extern uint16_t gParkRating; 92 extern money16 gParkEntranceFee; 93 extern uint16_t gParkSize; 94 extern money16 gLandPrice; 95 extern money16 gConstructionRightsPrice; 96 97 extern uint64_t gTotalAdmissions; 98 extern money64 gTotalIncomeFromAdmissions; 99 100 extern money64 gParkValue; 101 extern money64 gCompanyValue; 102 103 extern int16_t gParkRatingCasualtyPenalty; 104 extern uint8_t gParkRatingHistory[32]; 105 extern uint32_t gGuestsInParkHistory[32]; 106 extern int32_t _guestGenerationProbability; 107 extern uint32_t _suggestedGuestMaximum; 108 109 void set_forced_park_rating(int32_t rating); 110 int32_t get_forced_park_rating(); 111 112 int32_t park_is_open(); 113 int32_t park_calculate_size(); 114 115 void update_park_fences(const CoordsXY& coords); 116 void update_park_fences_around_tile(const CoordsXY& coords); 117 118 uint8_t calculate_guest_initial_happiness(uint8_t percentage); 119 120 void park_set_open(bool open); 121 int32_t park_entrance_get_index(const CoordsXYZ& entrancePos); 122 void park_set_entrance_fee(money32 value); 123 money16 park_get_entrance_fee(); 124 125 bool park_ride_prices_unlocked(); 126 bool park_entry_price_unlocked(); 127