#pragma once #include "Common.hpp" #include "parser/Adt/Adt.hpp" #include "parser/Wmo/WmoInstance.hpp" #include "utility/BinaryStream.hpp" #include #include #include #include #include #include #include #include namespace parser { class Wmo; class Doodad; class DoodadInstance; class Map { private: bool m_hasAdt[MeshSettings::Adts][MeshSettings::Adts]; bool m_hasTerrain; // ALPHA-EXCLUSIVE DATA bool m_isAlphaData; std::shared_ptr> m_alphaData; std::uint32_t m_adtOffsets[MeshSettings::Adts][MeshSettings::Adts]; std::vector m_doodadNames; std::vector m_wmoNames; // END ALPHA-EXCLUSIVE DATA mutable std::mutex m_adtMutex; std::unique_ptr m_adts[MeshSettings::Adts][MeshSettings::Adts]; std::unique_ptr m_globalWmo; mutable std::mutex m_wmoMutex; std::vector> m_loadedWmos; std::map> m_loadedWmoInstances; std::map> m_loadedWmoGameObjects; mutable std::mutex m_doodadMutex; std::vector> m_loadedDoodads; // must be shared because it can also be owned by a WMO std::map> m_loadedDoodadInstances; std::map> m_loadedDoodadGameObjects; friend Adt::Adt(Map*, int, int); public: const std::string Name; const unsigned int Id; Map(const std::string& MapName); bool HasAdt(int x, int y) const; const Adt* GetAdt(int x, int y); void UnloadAdt(int x, int y); const Wmo* GetWmo(const std::string& name); void InsertWmoInstance(unsigned int uniqueId, const WmoInstance* wmo); const WmoInstance* GetWmoInstance(unsigned int uniqueId) const; const WmoInstance* GetGlobalWmoInstance() const; const Doodad* GetDoodad(const std::string& name); void InsertDoodadInstance(unsigned int uniqueId, const DoodadInstance* doodad); const DoodadInstance* GetDoodadInstance(unsigned int uniqueId) const; void Serialize(utility::BinaryStream& stream) const; }; } // namespace parser