ABSTRACT.H 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. ** Command & Conquer(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program 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. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: F:\projects\c&c\vcs\code\abstract.h_v 2.20 16 Oct 1995 16:46:30 JOE_BOSTIC $ */
  19. /***********************************************************************************************
  20. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : ABSTRACT.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 01/26/95 *
  30. * *
  31. * Last Update : January 26, 1995 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef ABSTRACT_H
  37. #define ABSTRACT_H
  38. DirType Direction(CELL cell1, CELL cell2);
  39. DirType Direction(COORDINATE coord1, COORDINATE coord2);
  40. int Distance(COORDINATE coord1, COORDINATE coord2);
  41. int Distance(CELL coord1, CELL coord2);
  42. COORDINATE As_Coord(TARGET target);
  43. class AbstractTypeClass;
  44. class AbstractClass
  45. {
  46. public:
  47. /*
  48. ** The coordinate location of the unit. For vehicles, this is the center
  49. ** point. For buildings, it is the upper left corner.
  50. */
  51. COORDINATE Coord;
  52. /*
  53. ** The actual object ram-space is located in arrays in the data segment. This flag
  54. ** is used to indicate which objects are free to be reused and which are currently
  55. ** in use by the game.
  56. */
  57. unsigned IsActive:1;
  58. /*-----------------------------------------------------------------------------------
  59. ** Constructor & destructors.
  60. */
  61. AbstractClass(void) {Coord = 0L;};
  62. virtual ~AbstractClass(void) {};
  63. /*
  64. ** Query functions.
  65. */
  66. virtual HousesType Owner(void) const {return HOUSE_NONE;};
  67. /*
  68. ** Coordinate query support functions.
  69. */
  70. virtual COORDINATE Center_Coord(void) const {return Coord;};
  71. virtual COORDINATE Target_Coord(void) const {return Coord;};
  72. /*
  73. ** Coordinate inquiry functions. These are used for both display and
  74. ** combat purposes.
  75. */
  76. DirType Direction(AbstractClass const * object) const {return ::Direction(Center_Coord(), object->Target_Coord());};
  77. DirType Direction(COORDINATE coord) const {return ::Direction(Center_Coord(), coord);};
  78. DirType Direction(TARGET target) const {return ::Direction(Center_Coord(), As_Coord(target));};
  79. DirType Direction(CELL cell) const {return ::Direction(Coord_Cell(Center_Coord()), cell);};
  80. int Distance(TARGET target) const;
  81. int Distance(COORDINATE coord) const {return ::Distance(Center_Coord(), coord);};
  82. int Distance(CELL cell) const {return ::Distance(Coord_Cell(Center_Coord()), cell);};
  83. int Distance(AbstractClass const * object) const {return ::Distance(Center_Coord(), object->Target_Coord());};
  84. /*
  85. ** Object entry and exit from the game system.
  86. */
  87. virtual MoveType Can_Enter_Cell(CELL , FacingType = FACING_NONE) const {return MOVE_OK;};
  88. /*
  89. ** AI.
  90. */
  91. virtual void AI(void) {};
  92. };
  93. #endif