comndr.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //***************************************************************************
  2. //
  3. // comndr.h - This file contains the Commander Class header
  4. //
  5. // MechCommander 2
  6. //
  7. //---------------------------------------------------------------------------//
  8. // Copyright (C) Microsoft Corporation. All rights reserved. //
  9. //===========================================================================//
  10. #ifndef COMNDR_H
  11. #define COMNDR_H
  12. //---------------------------------------------------------------------------
  13. #ifndef DCOMNDR_H
  14. #include "dcomndr.h"
  15. #endif
  16. #ifndef GAMEOBJ_H
  17. #include "gameobj.h"
  18. #endif
  19. #ifndef DMOVER_H
  20. #include "dmover.h"
  21. #endif
  22. #ifndef GROUP_H
  23. #include "group.h"
  24. #endif
  25. #ifndef DTEAM_H
  26. #include "dteam.h"
  27. #endif
  28. #ifndef TACORDR_H
  29. #include "tacordr.h"
  30. #endif
  31. #ifndef UNITDESG_H
  32. #include "unitdesg.h"
  33. #endif
  34. //---------------------------------------------------------------------------
  35. typedef struct _CommanderData
  36. {
  37. long id;
  38. long teamId;
  39. MoverGroupData groups[MAX_MOVERGROUPS];
  40. } CommanderData;
  41. typedef struct _StaticCommanderData
  42. {
  43. long numCommanders;
  44. long homeCommanderId;
  45. } StaticCommanderData;
  46. class Commander {
  47. public:
  48. long id;
  49. TeamPtr team;
  50. MoverGroupPtr groups[MAX_MOVERGROUPS];
  51. static long numCommanders;
  52. static CommanderPtr commanders[MAX_COMMANDERS];
  53. static CommanderPtr home;
  54. public:
  55. void* operator new (size_t ourSize);
  56. void operator delete (void* us);
  57. virtual void init (void);
  58. Commander (void) {
  59. init();
  60. }
  61. virtual void destroy (void);
  62. ~Commander (void) {
  63. destroy();
  64. }
  65. virtual long getId (void) {
  66. return(id);
  67. }
  68. virtual void setId (long _id) {
  69. id = _id;
  70. commanders[id] = this;
  71. }
  72. virtual TeamPtr getTeam (void) {
  73. return(team);
  74. }
  75. virtual void setTeam (TeamPtr _team) {
  76. team = _team;
  77. }
  78. virtual MoverGroupPtr getGroup (long groupNumber) {
  79. return(groups[groupNumber]);
  80. }
  81. long setGroup (long id, long numMates, MoverPtr* moverList, long point);
  82. void setLocalMoverId (long localMoverId);
  83. void eject (void);
  84. void addToGUI (bool visible = true);
  85. void setHomeCommander (void) {
  86. home = this;
  87. }
  88. static CommanderPtr getCommander (long _id) {
  89. return(commanders[_id]);
  90. }
  91. static long Save (PacketFilePtr file, long packetNum);
  92. static long Load (PacketFilePtr file, long packetNum);
  93. };
  94. //***************************************************************************
  95. #endif