9
3

Titles.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef TITLES_H_
  17. #define TITLES_H_
  18. #include <string>
  19. #include <map>
  20. #include <list>
  21. #include "../common/Mutex.h"
  22. #include "../common/types.h"
  23. using namespace std;
  24. class Title {
  25. public:
  26. Title();
  27. Title(Title* title);
  28. ~Title();
  29. void SetID(int32 id) {this->id = id;}
  30. void SetName(const char *name) {strncpy(this->name, name, sizeof(this->name));}
  31. void SetPrefix(int8 prefix) {this->prefix = prefix;}
  32. void SetSaveNeeded(bool save_needed) {this->save_needed = save_needed;}
  33. int32 GetID() {return id;}
  34. const char* GetName() {return name;}
  35. int8 GetPrefix() {return prefix;}
  36. bool GetSaveNeeded() {return save_needed;}
  37. private:
  38. int32 id;
  39. int8 prefix;
  40. char name[256];
  41. bool save_needed;
  42. };
  43. class MasterTitlesList {
  44. public:
  45. MasterTitlesList();
  46. ~MasterTitlesList();
  47. void Clear();
  48. int32 Size();
  49. void AddTitle(Title* title);
  50. Title* GetTitle(int32 id);
  51. Title* GetTitleByName(const char* title_name);
  52. map<int32, Title*>* GetAllTitles();
  53. private:
  54. map<int32,Title*> titles_list;
  55. };
  56. class PlayerTitlesList {
  57. public:
  58. PlayerTitlesList();
  59. ~PlayerTitlesList();
  60. Title* GetTitle(int32 index);
  61. list<Title*>* GetAllTitles();
  62. void Add(Title* title);
  63. private:
  64. list<Title*> player_titles_list;
  65. };
  66. #endif