Changeset 279 for trunk/src/game/Map.h

Show
Ignore:
Timestamp:
11/22/08 00:36:22 (17 years ago)
Author:
yumileroy
Message:

Merged commit 269 (5f0e38da128a).

Original author: gvcoman
Date: 2008-11-21 14:34:05-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Map.h

    r272 r279  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    3434#include "SharedDefines.h" 
    3535#include "GameSystem/GridRefManager.h" 
     36#include "MapRefManager.h" 
    3637 
    3738#include <bitset> 
     
    105106    float startLocZ; 
    106107    float startLocO; 
    107     char const* script; 
     108    uint32 script_id; 
    108109}; 
    109110 
     
    127128class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockable<Map, ZThread::Mutex> 
    128129{ 
     130    friend class MapReference; 
    129131    public: 
    130132        Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); 
     
    238240        GameObject* GetGameObjectInMap(uint64 guid); 
    239241 
     242        bool HavePlayers() const { return !m_mapRefManager.isEmpty(); } 
     243        uint32 GetPlayersCountExceptGMs() const; 
     244        bool PlayersNearGrid(uint32 x,uint32 y) const; 
     245 
     246        void SendToPlayers(WorldPacket const* data) const; 
     247 
     248        typedef MapRefManager PlayerList; 
     249        PlayerList const& GetPlayers() const { return m_mapRefManager; } 
    240250        template<class T> void SwitchGridContainers(T* obj, bool active); 
    241251    private: 
     
    287297        uint32 m_unloadTimer; 
    288298 
     299        MapRefManager m_mapRefManager; 
    289300    private: 
    290301        typedef GridReadGuard ReadGuard; 
     
    326337{ 
    327338    public: 
    328         typedef std::list<Player *> PlayerList;                 // online players only 
    329  
    330339        InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); 
    331340        ~InstanceMap(); 
     
    335344        void CreateInstanceData(bool load); 
    336345        bool Reset(uint8 method); 
    337         std::string GetScript() { return i_script; } 
     346        uint32 GetScriptId() { return i_script_id; } 
    338347        InstanceData* GetInstanceData() { return i_data; } 
    339348        void PermBindAllPlayers(Player *player); 
    340         PlayerList const& GetPlayers() const { return i_Players;} 
    341         void SendToPlayers(WorldPacket const* data) const; 
    342349        time_t GetResetTime(); 
    343350        void UnloadAll(bool pForce); 
    344351        bool CanEnter(Player* player); 
    345         uint32 GetPlayersCountExceptGMs() const; 
    346         uint32 HavePlayers() const { return !i_Players.empty(); } 
    347         void SendResetWarnings(uint32 timeLeft); 
     352        void SendResetWarnings(uint32 timeLeft) const; 
    348353        void SetResetSchedule(bool on); 
    349354    private: 
     
    351356        bool m_unloadWhenEmpty; 
    352357        InstanceData* i_data; 
    353         std::string i_script; 
    354         // only online players that are inside the instance currently 
    355         // TODO ? - use the grid instead to access the players 
    356         PlayerList i_Players; 
     358        uint32 i_script_id; 
    357359}; 
    358360 
     
    360362{ 
    361363    public: 
    362         typedef std::list<Player *> PlayerList;                 // online players only 
    363  
    364364        BattleGroundMap(uint32 id, time_t, uint32 InstanceId); 
    365365        ~BattleGroundMap(); 
     
    370370        void SetUnload(); 
    371371        void UnloadAll(bool pForce); 
    372     private: 
    373         PlayerList i_Players; 
    374372}; 
    375373