diff options
Diffstat (limited to 'src/game/Map.h')
-rw-r--r-- | src/game/Map.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/game/Map.h b/src/game/Map.h index d7b3747fb34..17d9953aa19 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -1,7 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * - * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,9 +75,8 @@ typedef struct uint16 area_flag[16][16]; uint8 terrain_type[16][16]; float liquid_level[128][128]; - float v9[16 * 8 + 1][16 * 8 + 1]; - float v8[16 * 8][16 * 8]; - //float Z[MAP_RESOLUTION][MAP_RESOLUTION]; + float v9[MAP_RESOLUTION + 1][MAP_RESOLUTION + 1]; + float v8[MAP_RESOLUTION][MAP_RESOLUTION]; }GridMap; struct CreatureMover @@ -102,7 +101,8 @@ struct InstanceTemplate uint32 levelMin; uint32 levelMax; uint32 maxPlayers; - uint32 reset_delay; + uint32 maxPlayersHeroic; + uint32 reset_delay; // FIX ME: now exist normal/heroic raids with possible different time of reset. float startLocX; float startLocY; float startLocZ; @@ -137,10 +137,8 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O // currently unused for normal maps bool CanUnload(uint32 diff) { - if(!m_unloadTimer) - return false; - if(m_unloadTimer <= diff) - return true; + if(!m_unloadTimer) return false; + if(m_unloadTimer <= diff) return true; m_unloadTimer -= diff; return false; } @@ -162,7 +160,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &cell, TypeContainerVisitor<T, CONTAINER> &visitor); - inline bool IsRemovalGrid(float x, float y) const + bool IsRemovalGrid(float x, float y) const { GridPair p = Trinity::ComputeGridPair(x, y); return( !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL ); @@ -195,7 +193,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O float GetVmapHeight(float x, float y, float z, bool useMaps) const; bool IsInWater(float x, float y, float z) const; // does not use z pos. This is for future use - uint16 GetAreaFlag(float x, float y ) const; + uint16 GetAreaFlag(float x, float y, float z) const; uint8 GetTerrainType(float x, float y ) const; float GetWaterLevel(float x, float y ) const; bool IsUnderWater(float x, float y, float z) const; @@ -203,14 +201,14 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O static uint32 GetAreaId(uint16 areaflag,uint32 map_id); static uint32 GetZoneId(uint16 areaflag,uint32 map_id); - uint32 GetAreaId(float x, float y) const + uint32 GetAreaId(float x, float y, float z) const { - return GetAreaId(GetAreaFlag(x,y),i_id); + return GetAreaId(GetAreaFlag(x,y,z),i_id); } - uint32 GetZoneId(float x, float y) const + uint32 GetZoneId(float x, float y, float z) const { - return GetZoneId(GetAreaFlag(x,y),i_id); + return GetZoneId(GetAreaFlag(x,y,z),i_id); } virtual void MoveAllCreaturesInMoveList(); @@ -221,8 +219,8 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O // assert print helper bool CheckGridIntegrity(Creature* c, bool moved) const; - uint32 GetInstanceId() { return i_InstanceId; } - uint8 GetSpawnMode() { return (i_spawnMode); } + uint32 GetInstanceId() const { return i_InstanceId; } + uint8 GetSpawnMode() const { return (i_spawnMode); } virtual bool CanEnter(Player* /*player*/) { return true; } const char* GetMapName() const; @@ -234,6 +232,17 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O bool IsBattleGround() const { return i_mapEntry && i_mapEntry->IsBattleGround(); } bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); } bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); } + bool GetEntrancePos(int32 &mapid, float &x, float &y) + { + if(!i_mapEntry) + return false; + if(i_mapEntry->entrance_map < 0) + return false; + mapid = i_mapEntry->entrance_map; + x = i_mapEntry->entrance_x; + y = i_mapEntry->entrance_y; + return true; + } void AddObjectToRemoveList(WorldObject *obj); void AddObjectToSwitchList(WorldObject *obj, bool on); @@ -311,7 +320,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O bool isGridObjectDataLoaded(uint32 x, uint32 y) const { return getNGrid(x,y)->isGridObjectDataLoaded(); } void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y) { getNGrid(x,y)->setGridObjectDataLoaded(pLoaded); } - inline void setNGrid(NGridType* grid, uint32 x, uint32 y); + void setNGrid(NGridType* grid, uint32 x, uint32 y); void UpdateActiveCells(const float &x, const float &y, const uint32 &t_diff); protected: @@ -411,6 +420,7 @@ class TRINITY_DLL_SPEC InstanceMap : public Map bool CanEnter(Player* player); void SendResetWarnings(uint32 timeLeft) const; void SetResetSchedule(bool on); + uint32 GetMaxPlayers() const; private: bool m_resetAfterUnload; bool m_unloadWhenEmpty; |