From a1eb1b4dc4d81df724ee43fc4e895dd22e81760f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 9 Nov 2008 21:45:18 +0000 Subject: working jumpgates --- src/game/base/jumppoint.h | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/game/base/jumppoint.h') diff --git a/src/game/base/jumppoint.h b/src/game/base/jumppoint.h index 4680832..626a4ad 100644 --- a/src/game/base/jumppoint.h +++ b/src/game/base/jumppoint.h @@ -12,28 +12,50 @@ #include -namespace base { +namespace game { -/// a jump point +/// a jumppoint /** * jumppoints are used to define hyperspace routes between systems * when a ship actives the jump drive, a jump point will be opened * between the current system and the target of the nearest jumppoint. * */ -class JumpPoint : public core::Entity { +class JumpPoint : public core::EntityDynamic { public: JumpPoint(); ~JumpPoint(); inline std::string const & targetlabel() { return jumppoint_targetlabel; } + inline JumpPoint *target() { return jumppoint_target; } - std::string jumppoint_targetlabel; + /// set trget label + void set_targetlabel(const std::string &label); + + /// validate the targetlabel and set target() + void validate(); +private: + std::string jumppoint_targetlabel; JumpPoint *jumppoint_target; }; +/// a jumpgate +class JumpGate : public JumpPoint { +public: + JumpGate(); + virtual ~JumpGate(); + + inline bool activated() const { return (jumpgate_timer > 0); } + + void activate(); + + virtual void frame(float elapsed); +private: + float jumpgate_timer; +}; + } #endif // __INCLUDED_BASE_JUMPPOINT_H__ -- cgit v1.2.3