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