chore: some zone maintenance (#1778)

This commit is contained in:
David Markowitz
2025-05-05 07:04:23 -07:00
committed by GitHub
parent 3ebc6709db
commit c77e9ce33a
17 changed files with 204 additions and 221 deletions

View File

@@ -1,11 +1,10 @@
#pragma once
#include "dZMCommon.h"
#include "WorldConfig.h"
#include "Zone.h"
#include "Spawner.h"
#include <map>
class WorldConfig;
class dZoneManager {
public:
enum class dZoneNotifier {
@@ -27,28 +26,36 @@ public:
void Initialize(const LWOZONEID& zoneID);
~dZoneManager();
Zone* GetZone(); //Gets a pointer to the currently loaded zone.
/* Gets a pointer to the currently loaded zone. */
Zone* GetZoneMut() const;
const Zone* GetZone() const { return GetZoneMut(); };
void LoadZone(const LWOZONEID& zoneID); //Discard the current zone (if any) and loads a new zone.
/* Adds a spawner to the zone with the specified ID. */
void AddSpawner(LWOOBJID id, Spawner* spawner);
LWOZONEID GetZoneID() const;
const LWOZONEID& GetZoneID() const;
/* Creates a new spawner. Returns the finalized ID for the created spawner since some bits may be set to get it to function. */
LWOOBJID MakeSpawner(SpawnerInfo info);
Spawner* GetSpawner(LWOOBJID id);
void RemoveSpawner(LWOOBJID id);
std::vector<Spawner*> GetSpawnersByName(std::string spawnerName);
std::vector<Spawner*> GetSpawnersInGroup(std::string group);
std::vector<Spawner*> GetSpawnersByName(const std::string& spawnerName);
std::vector<Spawner*> GetSpawnersInGroup(const std::string& group);
void Update(float deltaTime);
Entity* GetZoneControlObject() { return m_ZoneControlObject; }
bool GetPlayerLoseCoinOnDeath() { return m_PlayerLoseCoinsOnDeath; }
bool GetDisableSaveLocation() { return m_DisableSaveLocation; }
bool GetMountsAllowed() { return m_MountsAllowed; }
bool GetPetsAllowed() { return m_PetsAllowed; }
/* Gets the starting ID for missions in the player UI so they are ordered properly and show in the order accepted by the player. */
uint32_t GetUniqueMissionIdStartingValue();
bool CheckIfAccessibleZone(LWOMAPID zoneID);
// The world config should not be modified by a caller.
const WorldConfig* GetWorldConfig() {
const WorldConfig& GetWorldConfig() {
if (!m_WorldConfig) LoadWorldConfig();
return m_WorldConfig;
return m_WorldConfig.value();
};
private:
@@ -64,7 +71,7 @@ private:
bool m_MountsAllowed = true;
bool m_PetsAllowed = true;
std::map<LWOOBJID, Spawner*> m_Spawners;
WorldConfig* m_WorldConfig = nullptr;
std::optional<WorldConfig> m_WorldConfig = std::nullopt;
Entity* m_ZoneControlObject = nullptr;
};