Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions Generals/Code/GameEngine/Include/Common/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Object;
class Player;
class Thing;
class W3DModelDrawModuleData; // ugh, hack (srj)
class W3DTreeDrawModuleData; // ugh, hack (srj)
struct FieldParse;

// TYPES //////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -109,6 +110,8 @@ class ModuleData : public Snapshot

// ugh, hack
virtual const W3DModelDrawModuleData* getAsW3DModelDrawModuleData() const { return nullptr; }
// ugh, hack
virtual const W3DTreeDrawModuleData* getAsW3DTreeDrawModuleData() const { return nullptr; }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this hack added?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is a merge from Zero Hour.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this from Zero Hour, to make it possible to add override here in the Code code:

virtual const W3DTreeDrawModuleData* getAsW3DTreeDrawModuleData() const { return this; }

virtual StaticGameLODLevel getMinimumRequiredGameLOD() const { return (StaticGameLODLevel)0;}

static void buildFieldParse(MultiIniFieldParse& p)
Expand All @@ -133,20 +136,20 @@ class ModuleData : public Snapshot
#define MAKE_STANDARD_MODULE_MACRO( cls ) \
public: \
static Module* friend_newModuleInstance( Thing *thing, const ModuleData* moduleData ) { return newInstance( cls )( thing, moduleData ); } \
virtual NameKeyType getModuleNameKey() const { static NameKeyType nk = NAMEKEY(#cls); return nk; } \
virtual NameKeyType getModuleNameKey() const override { static NameKeyType nk = NAMEKEY(#cls); return nk; } \
protected: \
virtual void crc( Xfer *xfer ); \
virtual void xfer( Xfer *xfer ); \
virtual void loadPostProcess();
virtual void crc( Xfer *xfer ) override; \
virtual void xfer( Xfer *xfer ) override; \
virtual void loadPostProcess() override;

// ------------------------------------------------------------------------------------------------
// For the creation of abstract module classes
// ------------------------------------------------------------------------------------------------
#define MAKE_STANDARD_MODULE_MACRO_ABC( cls ) \
protected: \
virtual void crc( Xfer *xfer ); \
virtual void xfer( Xfer *xfer ); \
virtual void loadPostProcess();
virtual void crc( Xfer *xfer ) override; \
virtual void xfer( Xfer *xfer ) override; \
virtual void loadPostProcess() override;

//-------------------------------------------------------------------------------------------------
// only use this macro for an ABC. for a real class, use MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA.
Expand Down
9 changes: 0 additions & 9 deletions Generals/Code/GameEngine/Include/Common/StateMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,6 @@ class State : public MemoryPoolObject, public Snapshot
inline void setName(AsciiString n) { m_name = n; }
#endif

protected:
// snapshot interface - pure virtual here.
// Essentially all the member data gets set up on creation and shouldn't change.
// So none of it needs to be saved, and it nicely forces all user states to
// remember to implement crc, xfer & loadPostProcess. jba
virtual void crc( Xfer *xfer )=0;
virtual void xfer( Xfer *xfer )=0;
virtual void loadPostProcess()=0;

private:

struct TransitionInfo
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/GameClient/InGameUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ friend class Drawable; // for selection/deselection transactions
virtual void disregardDrawable( Drawable *draw ); ///< Drawable is being destroyed, clean up any UI elements associated with it

virtual void preDraw(); ///< Logic which needs to occur before the UI renders
virtual void draw() = 0; ///< Render the in-game user interface
virtual void draw() override = 0; ///< Render the in-game user interface
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if this is omitted?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing. It's just to acknowledge that the base class also has this exact function, but it's not pure virtual. If that were removed that would lead to a compilation error here, which seems desirable.

virtual void postDraw(); ///< Logic which needs to occur after the UI renders
virtual void postWindowDraw(); ///< Logic which needs to occur after the WindowManager has repainted the menus

Expand Down
20 changes: 10 additions & 10 deletions Generals/Code/GameEngine/Include/GameLogic/AIStateMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class AIStateMachine : public StateMachine
public: // overrides.
virtual StateReturnType updateStateMachine() override; ///< run one step of the machine
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getCurrentStateName() const ;
virtual AsciiString getCurrentStateName() const override;
#endif

protected:
Expand Down Expand Up @@ -573,7 +573,7 @@ EMPTY_DTOR(AIPickUpCrateState)
virtual void onExit( StateExitType status ) override;
virtual StateReturnType update() override;
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getName() const ;
virtual AsciiString getName() const override;
#endif

protected:
Expand Down Expand Up @@ -681,7 +681,7 @@ class AIAttackFollowWaypointPathState : public AIFollowWaypointPathState
virtual void onExit( StateExitType status ) override;
virtual StateReturnType update() override;
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getName() const ;
virtual AsciiString getName() const override;
#endif

protected:
Expand Down Expand Up @@ -983,7 +983,7 @@ class AIAttackState : public State, public NotifyWeaponFiredInterface
virtual Bool isAttackingObject() const override { return m_isAttackingObject; }
virtual Bool isForceAttacking() const { return m_isForceAttacking; }
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getName() const ;
virtual AsciiString getName() const override;
#endif

virtual Bool isAttack() const override { return TRUE; }
Expand Down Expand Up @@ -1022,7 +1022,7 @@ class AIAttackSquadState : public State
virtual StateReturnType update() override;
Object *chooseVictim();
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getName() const ;
virtual AsciiString getName() const override;
#endif


Expand Down Expand Up @@ -1064,7 +1064,7 @@ class AIDockState : public State
virtual void onExit( StateExitType status ) override;
virtual StateReturnType update() override;
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getName() const ;
virtual AsciiString getName() const override;
#endif

protected:
Expand Down Expand Up @@ -1135,7 +1135,7 @@ class AIGuardState : public State
virtual void onExit( StateExitType status ) override;
virtual StateReturnType update() override;
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getName() const ;
virtual AsciiString getName() const override;
#endif
protected:
// snapshot interface
Expand Down Expand Up @@ -1164,7 +1164,7 @@ class AITunnelNetworkGuardState : public State
virtual void onExit( StateExitType status ) override;
virtual StateReturnType update() override;
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getName() const ;
virtual AsciiString getName() const override;
#endif
protected:
// snapshot interface
Expand Down Expand Up @@ -1193,7 +1193,7 @@ class AIHuntState : public State
virtual void onExit( StateExitType status ) override;
virtual StateReturnType update() override;
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getName() const ;
virtual AsciiString getName() const override;
#endif

protected:
Expand Down Expand Up @@ -1223,7 +1223,7 @@ class AIAttackAreaState : public State
virtual void onExit( StateExitType status ) override;
virtual StateReturnType update() override;
#ifdef STATE_MACHINE_DEBUG
virtual AsciiString getName() const ;
virtual AsciiString getName() const override;
#endif

protected:
Expand Down
42 changes: 0 additions & 42 deletions Generals/Code/GameEngine/Include/GameLogic/Module/BodyModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,43 +207,10 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface
// BehaviorModule
virtual BodyModuleInterface* getBody() override { return this; }

/**
Try to damage this Object. The module's Armor
will be taken into account, so the actual damage done may vary
considerably from what you requested. Also note that (if damage is done)
the DamageFX will be invoked to provide a/v fx as appropriate.
*/
virtual void attemptDamage( DamageInfo *damageInfo ) = 0;

/**
Instead of having negative damage count as healing, or allowing access to the private
changeHealth Method, we will use this parallel to attemptDamage to do healing without hack.
*/
virtual void attemptHealing( DamageInfo *healingInfo ) = 0;

/**
Estimate the (unclipped) damage that would be done to this object
by the given damage (taking bonuses, armor, etc into account),
but DO NOT alter the body in any way. (This is used by the AI system
to choose weapons.)
*/
virtual Real estimateDamage( DamageInfoInput& damageInfo ) const = 0;

virtual Real getHealth() const = 0; ///< get current health

virtual Real getMaxHealth() const override {return 0.0f;} ///< return max health

virtual Real getInitialHealth() const override {return 0.0f;} // return initial health

virtual BodyDamageType getDamageState() const = 0;
virtual void setDamageState( BodyDamageType newState ) = 0; ///< control damage state directly. Will adjust hitpoints.
virtual void setAflame( Bool setting ) = 0;///< This is a major change like a damage state.

virtual void onVeterancyLevelChanged( VeterancyLevel oldLevel, VeterancyLevel newLevel, Bool provideFeedback = FALSE ) = 0; ///< I just achieved this level right this moment

virtual void setArmorSetFlag(ArmorSetType ast) = 0;
virtual void clearArmorSetFlag(ArmorSetType ast) = 0;

virtual const DamageInfo *getLastDamageInfo() const override { return nullptr; } ///< return info on last damage dealt to this object
virtual UnsignedInt getLastDamageTimestamp() const override { return 0; } ///< return frame of last damage dealt
virtual UnsignedInt getLastHealingTimestamp() const override { return 0; } ///< return frame of last healing dealt
Expand All @@ -266,15 +233,6 @@ class BodyModule : public BehaviorModule, public BodyModuleInterface
virtual void applyDamageScalar( Real scalar ) override { m_damageScalar *= scalar; }
virtual Real getDamageScalar() const override { return m_damageScalar; }

/**
Change the module's health by the given delta. Note that
the module's DamageFX and Armor are NOT taken into
account, so you should think about what you're bypassing when you
call this directly (especially when when decreasing health, since
you probably want "attemptDamage" or "attemptHealing")
*/
virtual void internalChangeHealth( Real delta ) = 0;

virtual void evaluateVisualCondition() override { }
virtual void updateBodyParticleSystems() override { };// made public for topple anf building collapse updates -ML

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ class CollideModule : public BehaviorModule,
// BehaviorModule
virtual CollideModuleInterface* getCollide() override { return this; }

virtual void onCollide( Object *other, const Coord3D *loc, const Coord3D *normal ) = 0;

/// this is used for things like pilots, to determine if they can "enter" something
virtual Bool wouldLikeToCollideWith(const Object* other) const override { return false; }
virtual Bool isHijackedVehicleCrateCollide() const override { return false; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class CreateModule : public BehaviorModule, public CreateModuleInterface
// BehaviorModule
virtual CreateModuleInterface* getCreate() override { return this; }

virtual void onCreate() = 0; ///< This is called when you become a code Object
virtual void onBuildComplete() override { m_needToRunOnBuildComplete = FALSE; } ///< This is called when you are a finished game object
virtual Bool shouldDoOnBuildComplete() const override { return m_needToRunOnBuildComplete; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ class DamageModule : public BehaviorModule, public DamageModuleInterface
// BehaviorModule
virtual DamageModuleInterface* getDamage() override { return this; }

// damage module callbacks
virtual void onDamage( DamageInfo *damageInfo ) = 0; ///< damage callback
virtual void onHealing( DamageInfo *damageInfo ) = 0; ///< healing callback
virtual void onBodyDamageStateChange( const DamageInfo* damageInfo,
BodyDamageType oldState,
BodyDamageType newState) = 0; ///< state change callback

protected:

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ class DestroyModule : public BehaviorModule, public DestroyModuleInterface
// BehaviorModule
virtual DestroyModuleInterface* getDestroy() override { return this; }

virtual void onDestroy() = 0;

protected:

};
2 changes: 0 additions & 2 deletions Generals/Code/GameEngine/Include/GameLogic/Module/DieModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ class DieModule : public BehaviorModule, public DieModuleInterface
// BehaviorModule
virtual DieModuleInterface* getDie() override { return this; }

virtual void onDie( const DamageInfo *damageInfo ) = 0;

protected:
Bool isDieApplicable(const DamageInfo *damageInfo) const { return getDieModuleData()->isDieApplicable(getObject(), damageInfo); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class JetAIUpdate : public AIUpdateInterface

virtual AIStateMachine* makeStateMachine() override;

virtual void privateFollowPath( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction );///< follow the path defined by the given array of points
virtual void privateFollowPath( std::vector<Coord3D>* path, Object *ignoreObject, CommandSourceType cmdSource, Bool exitProduction ) override;///< follow the path defined by the given array of points
virtual void privateFollowPathAppend( const Coord3D *pos, CommandSourceType cmdSource ) override;
virtual void privateEnter( Object *obj, CommandSourceType cmdSource ) override; ///< enter the given object
virtual void privateGetRepaired( Object *repairDepot, CommandSourceType cmdSource ) override;///< get repaired at repair depot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ class ObjectHelper : public UpdateModule
setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER);
}

// inherited from UpdateModuleInterface
virtual UpdateSleepTime update() = 0;

// custom to this class.
void sleepUntil(UnsignedInt when);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class OpenContain : public UpdateModule,
// default OpenContain has unlimited capacity...!
virtual Bool isValidContainerFor(const Object* obj, Bool checkCapacity) const override;
virtual void addToContain( Object *obj ) override; ///< add 'obj' to contain list
virtual void addToContainList( Object *obj ); ///< The part of AddToContain that inheritors can override (Can't do whole thing because of all the private stuff involved)
virtual void addToContainList( Object *obj ) override; ///< The part of AddToContain that inheritors can override (Can't do whole thing because of all the private stuff involved)
virtual void removeFromContain( Object *obj, Bool exposeStealthUnits = FALSE ) override; ///< remove 'obj' from contain list
virtual void removeAllContained( Bool exposeStealthUnits = FALSE ) override; ///< remove all objects on contain list
virtual Bool isEnclosingContainerFor( const Object *obj ) const override; ///< Does this type of Contain Visibly enclose its contents?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class OverlordContain : public TransportContain

virtual Bool isValidContainerFor(const Object* obj, Bool checkCapacity) const override;
virtual void addToContain( Object *obj ) override; ///< add 'obj' to contain list
virtual void addToContainList( Object *obj ); ///< The part of AddToContain that inheritors can override (Can't do whole thing because of all the private stuff involved)
virtual void addToContainList( Object *obj ) override; ///< The part of AddToContain that inheritors can override (Can't do whole thing because of all the private stuff involved)
virtual void removeFromContain( Object *obj, Bool exposeStealthUnits = FALSE ) override; ///< remove 'obj' from contain list
virtual void removeAllContained( Bool exposeStealthUnits = FALSE ) override; ///< remove all objects on contain list
virtual Bool isEnclosingContainerFor( const Object *obj ) const override; ///< Does this type of Contain Visibly enclose its contents?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ class UpdateModule : public BehaviorModule, public UpdateModuleInterface
// BehaviorModule
virtual UpdateModuleInterface* getUpdate() override { return this; }

// UpdateModuleInterface
virtual UpdateSleepTime update() = 0;

virtual DisabledMaskType getDisabledTypesToProcess() const override
{
return DISABLEDMASK_NONE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class UpgradeMux : public UpgradeModuleInterface
virtual void getUpgradeActivationMasks(UpgradeMaskType& activation, UpgradeMaskType& conflicting) const = 0; ///< Here's the actual work of Upgrading
virtual void performUpgradeFX() = 0; ///< perform the associated fx list
virtual Bool requiresAllActivationUpgrades() const = 0;
virtual Bool isSubObjectsUpgrade() = 0;

void giveSelfUpgrade()
{
Expand Down
Loading
Loading