ActionManager.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: ActionManager.h //////////////////////////////////////////////////////////////////////////
  24. // Author: Colin Day
  25. // Desc: TheActionManager is a convenient place for us to wrap up all sorts of logical
  26. // queries about what objects can do in the world and to other objects. The purpose
  27. // of having a central place for this logic assists us in making these logical kind
  28. // of queries in the user interface and allows us to use the same code to validate
  29. // commands as they come in over the network interface in order to do the
  30. // real action.
  31. ///////////////////////////////////////////////////////////////////////////////////////////////////
  32. #pragma once
  33. #ifndef __ACTIONMANAGER_H_
  34. #define __ACTIONMANAGER_H_
  35. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  36. #include "Common/SubsystemInterface.h"
  37. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  38. class Object;
  39. class Player;
  40. class SpecialPowerTemplate;
  41. enum SpecialPowerType;
  42. enum WeaponSlotType;
  43. enum CommandSourceType;
  44. enum CanAttackResult;
  45. enum CanEnterType
  46. {
  47. CHECK_CAPACITY,
  48. DONT_CHECK_CAPACITY,
  49. COMBATDROP_INTO
  50. };
  51. // ------------------------------------------------------------------------------------------------
  52. // ------------------------------------------------------------------------------------------------
  53. class ActionManager : public SubsystemInterface
  54. {
  55. public:
  56. ActionManager( void );
  57. virtual ~ActionManager( void );
  58. virtual void init( void ) { }; ///< subsystem interface
  59. virtual void reset( void ) { }; ///< subsystem interface
  60. virtual void update( void ) { }; ///< subsystem interface
  61. //Single unit to unit check
  62. Bool canGetRepairedAt( const Object *obj, const Object *repairDest, CommandSourceType commandSource );
  63. Bool canTransferSuppliesAt( const Object *obj, const Object *transferDest );
  64. Bool canDockAt( const Object *obj, const Object *dockDest, CommandSourceType commandSource );
  65. Bool canGetHealedAt( const Object *obj, const Object *healDest, CommandSourceType commandSource );
  66. Bool canRepairObject( const Object *obj, const Object *objectToRepair, CommandSourceType commandSource );
  67. Bool canResumeConstructionOf( const Object *obj, const Object *objectBeingConstructed, CommandSourceType commandSource );
  68. Bool canEnterObject( const Object *obj, const Object *objectToEnter, CommandSourceType commandSource, CanEnterType mode );
  69. CanAttackResult getCanAttackObject( const Object *obj, const Object *objectToAttack, CommandSourceType commandSource, AbleToAttackType attackType );
  70. Bool canConvertObjectToCarBomb( const Object *obj, const Object *objectToConvert, CommandSourceType commandSource );
  71. Bool canHijackVehicle( const Object *obj, const Object *ObjectToHijack, CommandSourceType commandSource ); // LORENZEN
  72. Bool canSabotageBuilding( const Object *obj, const Object *objectToSabotage, CommandSourceType commandSource );
  73. Bool canCaptureBuilding( const Object *obj, const Object *objectToCapture, CommandSourceType commandSource );
  74. Bool canDisableVehicleViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource, Bool checkSourceRequirements = true );
  75. #ifdef ALLOW_SURRENDER
  76. Bool canPickUpPrisoner( const Object *obj, const Object *prisoner, CommandSourceType commandSource );
  77. #endif
  78. Bool canStealCashViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource );
  79. Bool canSnipeVehicle( const Object *obj, const Object *objectToSnipe, CommandSourceType commandSource );
  80. Bool canBribeUnit( const Object *obj, const Object *objectToBribe, CommandSourceType commandSource );
  81. Bool canCutBuildingPower( const Object *obj, const Object *building, CommandSourceType commandSource );
  82. Bool canDisableBuildingViaHacking( const Object *obj, const Object *objectToHack, CommandSourceType commandSource );
  83. Bool canDoSpecialPowerAtLocation( const Object *obj, const Coord3D *loc, CommandSourceType commandSource, const SpecialPowerTemplate *spTemplate, const Object *objectInWay, UnsignedInt commandOptions, Bool checkSourceRequirements = true );
  84. Bool canDoSpecialPowerAtObject( const Object *obj, const Object *target, CommandSourceType commandSource, const SpecialPowerTemplate *spTemplate, UnsignedInt commandOptions, Bool checkSourceRequirements = true);
  85. Bool canDoSpecialPower( const Object *obj, const SpecialPowerTemplate *spTemplate, CommandSourceType commandSource, UnsignedInt commandOptions, Bool checkSourceRequirements = true );
  86. Bool canMakeObjectDefector( const Object *obj, const Object *objectToMakeDefector, CommandSourceType commandSource );
  87. Bool canFireWeaponAtLocation( const Object *obj, const Coord3D *loc, CommandSourceType commandSource, const WeaponSlotType slot, const Object *objectInWay );
  88. Bool canFireWeaponAtObject( const Object *obj, const Object *target, CommandSourceType commandSource, const WeaponSlotType slot );
  89. Bool canFireWeapon( const Object *obj, const WeaponSlotType slot, CommandSourceType commandSource );
  90. Bool canGarrison( const Object *obj, const Object *target, CommandSourceType commandSource );
  91. Bool canOverrideSpecialPowerDestination( const Object *obj, const Coord3D *loc, SpecialPowerType spType, CommandSourceType commandSource );
  92. //Player to unit check
  93. Bool canPlayerGarrison( const Player *player, const Object *target, CommandSourceType commandSource );
  94. protected:
  95. };
  96. // EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
  97. extern ActionManager *TheActionManager;
  98. #endif // end __ACTIONMANAGER_H_