diff options
Diffstat (limited to 'src/game/base/patrol.h')
-rw-r--r-- | src/game/base/patrol.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/src/game/base/patrol.h b/src/game/base/patrol.h new file mode 100644 index 0000000..3e15d3d --- /dev/null +++ b/src/game/base/patrol.h @@ -0,0 +1,96 @@ +/* + base/patrol.h + This file is part of the Osirion project and is distributed under + the terms and conditions of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_BASE_PATROL_H__ +#define __INCLUDED_BASE_PATROL_H__ + +#include "core/entity.h" +#include "base/faction.h" +#include "base/npc.h" + +namespace game +{ + +/** + * @brief a patrol entity manages a group of NPCs. + * A Patrol instance is a server-side entity used to manage + * a group of NPC ships. It manages group purpose, group commands + * and respawning by giving orders to the member NPCs. + * A Patrol can manage any kind of NPC group: + * be it a patrol, a trade convoy or a player wing. + * */ +class Patrol: public core::Entity { + +public: + /** + * @brief a node in the patrol's travel path + * */ + class WayPoint { + public: + WayPoint(); + ~WayPoint(); + + inline core::Entity *target() + { + return waypoint_target; + } + + inline const std::string & target_label() const { + return waypoint_target_label; + } + + inline const bool dock() const { + return waypoint_dock; + } + + inline const std::string & buy_label() const { + return waypoint_buy_label; + } + + void set_target(core::Entity *entity); + + void set_target_label(const std::string &label); + + void set_buy_label(const std::string &label); + + void set_dock(const bool dock); + + private: + std::string waypoint_target_label; + + core::Entity *waypoint_target; + + std::string waypoint_buy_label; + + bool waypoint_dock; + }; + + typedef std::list<WayPoint *> WayPoints; + + Patrol(); + virtual ~Patrol(); + + inline const NPC::Profile profile() const { + return patrol_profile; + } + + void set_profile(const NPC::Profile profile); + + WayPoint *add_waypoint(); + + virtual void validate(); + + virtual void frame(const unsigned long elapsed); + +private: + WayPoints patrol_waypoints; + + NPC::Profile patrol_profile; +}; + +} // namespace game + +#endif // __INCLUDED_BASE_PATROL_H__
\ No newline at end of file |