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

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

Delete possessed AI only on creature delete.

Original author: gvcoman
Date: 2008-11-16 14:38:02-05:00

Files:
1 modified

Legend:

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

    r268 r272  
    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" 
    3736 
    3837#include <bitset> 
     
    106105    float startLocZ; 
    107106    float startLocO; 
    108     uint32 script_id; 
     107    char const* script; 
    109108}; 
    110109 
     
    128127class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockable<Map, ZThread::Mutex> 
    129128{ 
    130     friend class MapReference; 
    131129    public: 
    132130        Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); 
     
    240238        GameObject* GetGameObjectInMap(uint64 guid); 
    241239 
    242         bool HavePlayers() const { return !m_mapRefManager.isEmpty(); } 
    243         uint32 GetPlayersCountExceptGMs() const; 
    244         bool PlayersNearGrid(uint32 x,uint32 y) const; 
    245         bool ActiveObjectsNearGrid(uint32 x, uint32 y) const; 
    246  
    247         void AddActiveObject(WorldObject* obj) { i_activeObjects.insert(obj); } 
    248         void RemoveActiveObject(WorldObject* obj) { i_activeObjects.erase(obj); } 
    249  
    250         void SendToPlayers(WorldPacket const* data) const; 
    251  
    252         typedef MapRefManager PlayerList; 
    253         PlayerList const& GetPlayers() const { return m_mapRefManager; } 
    254240        template<class T> void SwitchGridContainers(T* obj, bool active); 
    255241    private: 
     
    292278        inline void setNGrid(NGridType* grid, uint32 x, uint32 y); 
    293279 
    294         void UpdateActiveCells(const float &x, const float &y, const uint32 &t_diff); 
    295280    protected: 
    296281        typedef Trinity::ObjectLevelLockable<Map, ZThread::Mutex>::Lock Guard; 
     
    302287        uint32 m_unloadTimer; 
    303288 
    304         MapRefManager m_mapRefManager; 
    305289    private: 
    306290        typedef GridReadGuard ReadGuard; 
     
    313297        time_t i_gridExpiry; 
    314298 
    315         std::set<WorldObject *> i_activeObjects; 
    316299        std::set<WorldObject *> i_objectsToRemove; 
    317300 
     
    343326{ 
    344327    public: 
     328        typedef std::list<Player *> PlayerList;                 // online players only 
     329 
    345330        InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); 
    346331        ~InstanceMap(); 
     
    350335        void CreateInstanceData(bool load); 
    351336        bool Reset(uint8 method); 
    352         uint32 GetScriptId() { return i_script_id; } 
     337        std::string GetScript() { return i_script; } 
    353338        InstanceData* GetInstanceData() { return i_data; } 
    354339        void PermBindAllPlayers(Player *player); 
     340        PlayerList const& GetPlayers() const { return i_Players;} 
     341        void SendToPlayers(WorldPacket const* data) const; 
    355342        time_t GetResetTime(); 
    356343        void UnloadAll(bool pForce); 
    357344        bool CanEnter(Player* player); 
    358         void SendResetWarnings(uint32 timeLeft) const; 
     345        uint32 GetPlayersCountExceptGMs() const; 
     346        uint32 HavePlayers() const { return !i_Players.empty(); } 
     347        void SendResetWarnings(uint32 timeLeft); 
    359348        void SetResetSchedule(bool on); 
    360349    private: 
     
    362351        bool m_unloadWhenEmpty; 
    363352        InstanceData* i_data; 
    364         uint32 i_script_id; 
     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; 
    365357}; 
    366358 
     
    368360{ 
    369361    public: 
     362        typedef std::list<Player *> PlayerList;                 // online players only 
     363 
    370364        BattleGroundMap(uint32 id, time_t, uint32 InstanceId); 
    371365        ~BattleGroundMap(); 
     
    376370        void SetUnload(); 
    377371        void UnloadAll(bool pForce); 
     372    private: 
     373        PlayerList i_Players; 
    378374}; 
    379375