Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
3.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. // tactical_mission.h
  3. // Interface for managing player "missions"
  4. // Michael Booth, June 2009
  5. #ifndef TACTICAL_MISSION_H
  6. #define TACTICAL_MISSION_H
  7. #include "nav_area.h"
  8. #include "GameEventListener.h"
  9. class CBasePlayer;
  10. //---------------------------------------------------------------------------------------------
  11. /**
  12. * A mission zone defines a region of space where something tactically interesting occurs.
  13. */
  14. class CTacticalMissionZone
  15. {
  16. public:
  17. virtual CNavArea *SelectArea( CBasePlayer *who ) const;
  18. /**
  19. * Iterate each area in this zone.
  20. * If functor returns false, stop iterating and return false.
  21. */
  22. virtual bool ForEachArea( IForEachNavArea &func ) const;
  23. protected:
  24. CUtlVector< CNavArea * > m_areaVector;
  25. };
  26. //---------------------------------------------------------------------------------------------
  27. /**
  28. * A mission encapsulates an important task or set of tasks, such as capturing an enemy point
  29. */
  30. class CTacticalMission
  31. {
  32. public:
  33. virtual ~CTacticalMission() { }
  34. virtual const CTacticalMissionZone *GetDeployZone( CBasePlayer *who ) const; // where give player should be during this mission
  35. virtual const CTacticalMissionZone *GetObjectiveZone( void ) const; // control points, setup gates, sections of cart path, etc.
  36. virtual const CTacticalMissionZone *GetEnemyZone( void ) const; // where we expect enemies to be during this mission
  37. virtual const char *GetName( void ) const = 0; // return name of this mission
  38. };
  39. inline const CTacticalMissionZone *CTacticalMission::GetDeployZone( CBasePlayer *who ) const
  40. {
  41. return NULL;
  42. }
  43. inline const CTacticalMissionZone *CTacticalMission::GetObjectiveZone( void ) const
  44. {
  45. return NULL;
  46. }
  47. inline const CTacticalMissionZone *CTacticalMission::GetEnemyZone( void ) const
  48. {
  49. return NULL;
  50. }
  51. //---------------------------------------------------------------------------------------------
  52. /**
  53. * The mission manager provides access to all available missions
  54. */
  55. class CTacticalMissionManager : public CGameEventListener
  56. {
  57. public:
  58. CTacticalMissionManager( void );
  59. virtual ~CTacticalMissionManager() { }
  60. virtual void FireGameEvent( IGameEvent *event ); // incoming event processing
  61. virtual void OnServerActivate( void ) { } // invoked when server loads a new map, after everything has been created/spawned
  62. virtual void OnRoundRestart( void ) { } // invoked when a game round restarts
  63. virtual void Register( CTacticalMission *mission );
  64. virtual void Unregister( CTacticalMission *mission );
  65. virtual const CTacticalMission *GetMission( const char *name ); // given a mission name, return the mission (or NULL)
  66. /**
  67. * Iterate each mission.
  68. * If functor returns false, stop iterating and return false.
  69. */
  70. class IForEachMission
  71. {
  72. public:
  73. virtual bool Inspect( const CTacticalMission &mission ) = 0;
  74. };
  75. virtual bool ForEachMission( IForEachMission &func );
  76. protected:
  77. CUtlVector< CTacticalMission * > m_missionVector;
  78. };
  79. // global singleton
  80. extern CTacticalMissionManager &TheTacticalMissions( void );
  81. // factory for instantiating the global singleton
  82. extern CTacticalMissionManager *TacticalMissionFactory( void );
  83. #endif // TACTICAL_MISSION_H