Changeset 272 for trunk/src/game/Map.h
- Timestamp:
- 11/22/08 00:35:41 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Map.h
r268 r272 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 34 34 #include "SharedDefines.h" 35 35 #include "GameSystem/GridRefManager.h" 36 #include "MapRefManager.h"37 36 38 37 #include <bitset> … … 106 105 float startLocZ; 107 106 float startLocO; 108 uint32 script_id;107 char const* script; 109 108 }; 110 109 … … 128 127 class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockable<Map, ZThread::Mutex> 129 128 { 130 friend class MapReference;131 129 public: 132 130 Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); … … 240 238 GameObject* GetGameObjectInMap(uint64 guid); 241 239 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; }254 240 template<class T> void SwitchGridContainers(T* obj, bool active); 255 241 private: … … 292 278 inline void setNGrid(NGridType* grid, uint32 x, uint32 y); 293 279 294 void UpdateActiveCells(const float &x, const float &y, const uint32 &t_diff);295 280 protected: 296 281 typedef Trinity::ObjectLevelLockable<Map, ZThread::Mutex>::Lock Guard; … … 302 287 uint32 m_unloadTimer; 303 288 304 MapRefManager m_mapRefManager;305 289 private: 306 290 typedef GridReadGuard ReadGuard; … … 313 297 time_t i_gridExpiry; 314 298 315 std::set<WorldObject *> i_activeObjects;316 299 std::set<WorldObject *> i_objectsToRemove; 317 300 … … 343 326 { 344 327 public: 328 typedef std::list<Player *> PlayerList; // online players only 329 345 330 InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); 346 331 ~InstanceMap(); … … 350 335 void CreateInstanceData(bool load); 351 336 bool Reset(uint8 method); 352 uint32 GetScriptId() { return i_script_id; }337 std::string GetScript() { return i_script; } 353 338 InstanceData* GetInstanceData() { return i_data; } 354 339 void PermBindAllPlayers(Player *player); 340 PlayerList const& GetPlayers() const { return i_Players;} 341 void SendToPlayers(WorldPacket const* data) const; 355 342 time_t GetResetTime(); 356 343 void UnloadAll(bool pForce); 357 344 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); 359 348 void SetResetSchedule(bool on); 360 349 private: … … 362 351 bool m_unloadWhenEmpty; 363 352 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; 365 357 }; 366 358 … … 368 360 { 369 361 public: 362 typedef std::list<Player *> PlayerList; // online players only 363 370 364 BattleGroundMap(uint32 id, time_t, uint32 InstanceId); 371 365 ~BattleGroundMap(); … … 376 370 void SetUnload(); 377 371 void UnloadAll(bool pForce); 372 private: 373 PlayerList i_Players; 378 374 }; 379 375