Advertisement
Guest User

DynamicTeleportMgr.h

a guest
Mar 24th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. /*******************************************************
  2. * File:'DynamicTeleportMgr.h'
  3. * (c)2011 - Wolf Officious (ladislav.alexa@gmail.com)
  4. *******************************************************/
  5.  
  6. #ifndef _DYNTEL_H
  7. #define _DYNTEL_H
  8.  
  9. #include <ace/Singleton.h>
  10.  
  11. #include "Common.h"
  12. #include "World.h"
  13.  
  14. struct TeleportData
  15. {
  16. uint32 entry;
  17. uint32 menu_parent;
  18. int32 menu_sub;
  19. uint8 icon;
  20. uint32 faction;
  21. std::string name;
  22. };
  23.  
  24. struct TeleportLoc
  25. {
  26. uint32 map;
  27. float position_x;
  28. float position_y;
  29. float position_z;
  30. float position_o;
  31. };
  32.  
  33. typedef UNORDERED_MAP<uint32, TeleportData> TeleportDataMap;
  34. typedef UNORDERED_MAP<uint32, TeleportLoc> TeleportLocMap;
  35.  
  36. class DynamicTeleportMgr
  37. {
  38. public:
  39. DynamicTeleportMgr()
  40. {
  41. _IsLoaded = false;
  42. }
  43. ~DynamicTeleportMgr() {}
  44.  
  45. bool Init();
  46. void Update();
  47.  
  48. bool isLoaded() { return _IsLoaded; }
  49.  
  50. inline TeleportData const* GetTeleportData(uint32 id) const
  51. {
  52. TeleportDataMap::const_iterator itr = mTeleportData.find(id);
  53. return itr != mTeleportData.end() ? &itr->second : NULL;
  54. }
  55.  
  56. uint32 GetCount() { return mTeleportData.size(); }
  57.  
  58. inline TeleportLoc const* GetTeleportLoc(uint32 id) const
  59. {
  60. TeleportLocMap::const_iterator itr = mTeleportLoc.find(id);
  61. return itr != mTeleportLoc.end() ? &itr->second : NULL;
  62. }
  63.  
  64. static DynamicTeleportMgr& Instance();
  65.  
  66. private:
  67. TeleportDataMap mTeleportData;
  68. TeleportLocMap mTeleportLoc;
  69.  
  70. bool _IsLoaded;
  71. };
  72.  
  73. #define sDynamicTeleportMgr ACE_Singleton<DynamicTeleportMgr, ACE_Null_Mutex>::instance()
  74.  
  75. #endif /* _DYNTEL_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement