From ce62661012a167d48bd6117940a551355eb6773b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 15 Oct 2013 19:57:27 +0000 Subject: Added ship autopilot, removed entity_controlflags, added goto ui button. --- src/core/entity.cc | 8 ++------ src/core/entity.h | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 20 deletions(-) (limited to 'src/core') diff --git a/src/core/entity.cc b/src/core/entity.cc index 63fa4e8..e76f254 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -1073,7 +1073,6 @@ void EntityControlable::ActionInterface::debugDraw(btIDebugDraw* debugDrawer) EntityControlable::EntityControlable() : EntityDynamic() { entity_thrust = 0; - entity_controlflags = 0; target_direction = 0.0f; target_thrust = 0.0f; @@ -1086,7 +1085,6 @@ EntityControlable::EntityControlable() : EntityDynamic() entity_owner = 0; entity_actioninterface = 0; - entity_controlflags = 0; entity_health = 100.0f; } @@ -1094,7 +1092,6 @@ EntityControlable::EntityControlable(std::istream & is) : EntityDynamic(is) { entity_thrust = 0; - entity_controlflags = 0; target_direction = 0.0f; target_thrust = 0.0f; @@ -1107,7 +1104,6 @@ EntityControlable::EntityControlable(std::istream & is) : entity_owner = 0; entity_actioninterface = 0; - entity_controlflags = 0; entity_health = 100.0f; } @@ -1295,7 +1291,7 @@ void EntityControlable::set_target_controlflags(int controlflags) void EntityControlable::set_target_controlflag(const ControlFlags controlflag) { - if (!has_controlflag(controlflag)) { + if ((target_controlflags & controlflag) == 0) { target_controlflags = target_controlflags | controlflag; set_dirty(); } @@ -1303,7 +1299,7 @@ void EntityControlable::set_target_controlflag(const ControlFlags controlflag) void EntityControlable::unset_target_controlflag(const ControlFlags controlflag) { - if (has_controlflag(controlflag)) { + if ((target_controlflags & controlflag) == controlflag) { target_controlflags = target_controlflags & ~controlflag; set_dirty(); } diff --git a/src/core/entity.h b/src/core/entity.h index 140f6ca..6878f08 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -687,7 +687,7 @@ class EntityControlable : public EntityDynamic public: /// control flags - enum ControlFlags {ControlFlagNone = 0, ControlFlagFire = 1, ControlFlagAutoPilot = 2, ControlFlagAutoDock = 4, ControlFlagAutoLevel = 8 }; + enum ControlFlags {ControlFlagNone = 0, ControlFlagFire = 1, ControlFlagOverride = 2}; /// bullet action interface class class ActionInterface: public btActionInterface { @@ -728,16 +728,6 @@ public: return entity_thrust; } - /// control flags - inline int controlflags() const { - return entity_controlflags; - } - - /// returns true if the specified control flag is set - inline bool has_controlflag(ControlFlags controlflag) const { - return ((controlflag & entity_controlflags) == controlflag); - } - /// physics action inline ActionInterface *actioninterface() { return entity_actioninterface; @@ -751,6 +741,14 @@ public: return entity_health; } + /** + * @brief returns true if a specified control flag is set + * */ + inline bool has_target_controlflag(ControlFlags controlflag) + { + return ((target_controlflags & controlflag) == controlflag); + } + /*----- serializers ----------------------------------------------- */ /// serialize the entity to a stream @@ -837,9 +835,6 @@ protected: /// physics action interface callback virtual void action (btScalar seconds); - /// current control flags - int entity_controlflags; - /// current thrust float entity_thrust; -- cgit v1.2.3