RailedTransportAIUpdate.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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: RailedTransportAIUpdate.h ////////////////////////////////////////////////////////////////
  24. // Author: Colin Day, August 2002
  25. // Desc: Railed transport AI
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __RAILED_TRANSPORT_AI_UPDATE_H_
  29. #define __RAILED_TRANSPORT_AI_UPDATE_H_
  30. // USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
  31. #include "GameLogic/Module/AIUpdate.h"
  32. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  33. class Waypoint;
  34. // ------------------------------------------------------------------------------------------------
  35. // ------------------------------------------------------------------------------------------------
  36. class RailedTransportAIUpdateModuleData : public AIUpdateModuleData
  37. {
  38. public:
  39. RailedTransportAIUpdateModuleData( void );
  40. static void buildFieldParse( MultiIniFieldParse &p );
  41. AsciiString m_pathPrefixName; ///< prefix to use for waypont start and end points we'll look for
  42. };
  43. //-------------------------------------------------------------------------------------------------
  44. //-------------------------------------------------------------------------------------------------
  45. class RailedTransportAIUpdate : public AIUpdateInterface
  46. {
  47. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( RailedTransportAIUpdate, "RailedTransportAIUpdate" )
  48. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( RailedTransportAIUpdate, RailedTransportAIUpdateModuleData )
  49. public:
  50. RailedTransportAIUpdate( Thing *thing, const ModuleData *moduleData );
  51. // virtual destructor prototype provided by memory pool declaration
  52. // AIUpdate interface methods
  53. virtual void aiDoCommand( const AICommandParms *parms );
  54. virtual UpdateSleepTime update( void );
  55. protected:
  56. // ai module methods
  57. virtual void privateExecuteRailedTransport( CommandSourceType cmdSource );
  58. virtual void privateEvacuate( Int exposeStealthUnits, CommandSourceType cmdSource );
  59. // our methods
  60. void setInTransit( Bool inTransit );
  61. void loadWaypointData( void );
  62. void pickAndMoveToInitialLocation( void );
  63. // our data
  64. Bool m_inTransit; ///< in transit
  65. struct WaypointPathInfo
  66. {
  67. UnsignedInt startWaypointID;
  68. UnsignedInt endWaypointID;
  69. };
  70. enum { MAX_WAYPOINT_PATHS = 32 };
  71. WaypointPathInfo m_path[ MAX_WAYPOINT_PATHS ]; ///< transit paths we can use
  72. Int m_numPaths; ///< how many waypoint paths are in m_path
  73. Int m_currentPath; ///< index into m_path for our current path
  74. Bool m_waypointDataLoaded; ///< TRUE once we've searched the map to load m_path
  75. };
  76. #endif // end __RAILED_TRANSPORT_AI_UPDATE_H_