diff options
Diffstat (limited to 'src/game/base')
-rw-r--r-- | src/game/base/patrol.cc | 2 | ||||
-rw-r--r-- | src/game/base/ship.h | 34 | ||||
-rw-r--r-- | src/game/base/shipmodel.cc | 4 | ||||
-rw-r--r-- | src/game/base/shipmodel.h | 16 |
4 files changed, 48 insertions, 8 deletions
diff --git a/src/game/base/patrol.cc b/src/game/base/patrol.cc index 797681d..78d2ebd 100644 --- a/src/game/base/patrol.cc +++ b/src/game/base/patrol.cc @@ -31,7 +31,7 @@ Patrol::Patrol() : core::Entity() patrol_profile = ProfilePatrol; - patrol_waypoint_current == patrol_waypoints.end(); + patrol_waypoint_current = patrol_waypoints.end(); patrol_launch_timeout = 0; } diff --git a/src/game/base/ship.h b/src/game/base/ship.h index d627295..4b4ae61 100644 --- a/src/game/base/ship.h +++ b/src/game/base/ship.h @@ -99,18 +99,30 @@ public: return ( (ship_autopilot_flags & flag) == flag); } - /// maximum amount of armor + /// maximal armor strength inline const float maxarmor() const { return ship_maxarmor; } - /// current amount of armor + /// current armor strength inline const float armor() const { return ship_armor; } + /// maximal armor strength + inline const float maxshield() const + { + return ship_maxshield; + } + + /// current armor strength + inline const float shield() const + { + return ship_shield; + } + virtual void print() const; /* -- mutators --------------------------------------------- */ @@ -160,19 +172,31 @@ public: ship_roll_force = roll; } - /// set maximal armor amount (100% health) + /// set maximal armor strength (100% health) inline void set_maxarmor(const float maxarmor) { ship_maxarmor = maxarmor; } - /// set current armor amount (current health) + /// set current armor strength (current health) inline void set_armor(const float armor) { ship_armor = armor; } - /// Initiate jump, departing from a jump point + /// set maximal shield strength + inline void set_maxshield(const float maxshield) + { + ship_maxshield = maxshield; + } + + /// set current shield strength + inline void set_shield(const float shield) + { + ship_shield = shield; + } + + /// initiate jump sequence, departing from a jump point void initiate_jump(JumpPoint *depart); /// reset physics state and ship controls diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc index 9489c91..f504107 100644 --- a/src/game/base/shipmodel.cc +++ b/src/game/base/shipmodel.cc @@ -116,6 +116,9 @@ bool ShipModel::init() } else if (inifile.got_key_float("armor", f)) { shipmodel->set_maxarmor(f); continue; + } else if (inifile.got_key_float("shield", f)) { + shipmodel->set_maxshield(f); + continue; } else if (inifile.got_key_float("radius", f)) { shipmodel->set_radius(f); continue; @@ -433,6 +436,7 @@ void ShipModel::apply(Ship *ship) const ship->set_roll_force(roll_force()); ship->set_jumpdrive(jumpdrive()); ship->set_maxarmor(maxarmor()); + ship->set_maxshield(maxshield()); } } diff --git a/src/game/base/shipmodel.h b/src/game/base/shipmodel.h index 64244fc..709a1d6 100644 --- a/src/game/base/shipmodel.h +++ b/src/game/base/shipmodel.h @@ -102,12 +102,18 @@ public: return shipmodel_maxcargo; } - /// maximum armor amount + /// maximal armor strength inline const float maxarmor() const { return shipmodel_maxarmor; } + /// maximal shield strength + inline const float maxshield() const + { + return shipmodel_maxshield; + } + /// ship radius inline const float radius() const { @@ -179,12 +185,18 @@ protected: // shipmodel_maxspeed = maxspeed; // } - /// set maximum armor amount + /// set maximal armor strength inline void set_maxarmor(const float maxarmor) { shipmodel_maxarmor = maxarmor; } + /// set maximal shield strength + inline void set_maxshield(const float maxshield) + { + shipmodel_maxshield = maxshield; + } + /// set size of the cargo hold inline void set_maxcargo(const float maxcargo) { |