Member.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // munging macros to go to/from interal internal/external ratings
  2. #define RATING_EXT2DISP(x) ((x) * 1000 / MAXSHORT)
  3. #define RATING_EXT2INT(x) ((float) (x) / (float) MAXSHORT)
  4. #define RATING_INT2EXT(x) (MAXSHORT * (x))
  5. class IMemberBase // inheritted by IZonePlayer
  6. {
  7. public:
  8. enum Rank
  9. {
  10. RANK_UNKNOWN = 0,
  11. RANK_PRIVATE,
  12. RANK_SERGEANT,
  13. RANK_GENERAL,
  14. };
  15. static IsRankValid(Rank rank)
  16. {
  17. return rank >= RANK_PRIVATE && rank <= RANK_GENERAL;
  18. }
  19. static char * Rank2String (Rank rank)
  20. {
  21. static char* s_szRank[] = {
  22. "Unknown",
  23. "Private",
  24. "Sergant",
  25. "General",
  26. };
  27. return s_szRank[rank];
  28. }
  29. enum Position
  30. {
  31. POS_UNKNOWN = 0,
  32. POS_MEMBER,
  33. POS_ASL,
  34. POS_LEADER // if change this, you need to update enum DetailedStatus
  35. };
  36. static IsPositionValid(Position position)
  37. {
  38. return position >= POS_MEMBER && position <= POS_LEADER;
  39. }
  40. static char * Position2String (Position position)
  41. {
  42. static char* s_szPosition[] = {
  43. "Unknown",
  44. "Member",
  45. "ASL",
  46. "Leader",
  47. };
  48. return s_szPosition[position];
  49. }
  50. enum Status
  51. {
  52. STAT_NO_ASSOCIATION = 0,
  53. STAT_BOOTED,
  54. STAT_REJECTED,
  55. STAT_QUIT,
  56. STAT_PENDING,
  57. STAT_ACTIVE, // if you add another need to update GetStatus -AND- maybe even GetDetailedStatus()
  58. };
  59. static IsStatusValid(Status status)
  60. {
  61. return status >= STAT_NO_ASSOCIATION && status <= STAT_ACTIVE;
  62. }
  63. static char * Status2String (Status status)
  64. {
  65. static char * s_szStatus[] = {
  66. "No Association",
  67. "Booted",
  68. "Rejected",
  69. "Retired",
  70. "Pending",
  71. "Active",
  72. };
  73. return s_szStatus[status];
  74. }
  75. enum DetailedStatus // combo of position and status
  76. {
  77. DSTAT_NO_ASSOCIATION = 0, // order is used for sorting in squad screen
  78. DSTAT_UNKNOWN,
  79. DSTAT_BOOTED,
  80. DSTAT_REJECTED,
  81. DSTAT_PENDING,
  82. DSTAT_MEMBER,
  83. DSTAT_ASL,
  84. DSTAT_LEADER, // if you add another need to update GetDetailedStatus() -AND- maybe even GetStatus()
  85. };
  86. static IsDetailedStatusValid(DetailedStatus status)
  87. {
  88. return status >= DSTAT_NO_ASSOCIATION && status <= DSTAT_LEADER;
  89. }
  90. static char * DetailedStatus2String (DetailedStatus status)
  91. {
  92. static char * s_szDetailedStatus[] = {
  93. "No Association",
  94. "Unknown",
  95. "Booted",
  96. "Rejected",
  97. "Pending",
  98. "Member",
  99. "ASL",
  100. "Leader",
  101. };
  102. return s_szDetailedStatus[status];
  103. }
  104. };