diff options
Diffstat (limited to 'src/game/base/npc.cc')
-rw-r--r-- | src/game/base/npc.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/game/base/npc.cc b/src/game/base/npc.cc index f8c27d9..0997ed2 100644 --- a/src/game/base/npc.cc +++ b/src/game/base/npc.cc @@ -67,7 +67,7 @@ NPC *NPC::add_wingman(Ship *leader) return npc; } - + NPC::NPC(const Profile profile, const ShipModel *shipmodel) : Ship(0, shipmodel) { npc_profile = profile; @@ -78,6 +78,13 @@ NPC::NPC(const Profile profile, const ShipModel *shipmodel) : Ship(0, shipmodel) npc_leader = 0; } +NPC::~NPC() +{ + if (npc_patrol) { + npc_patrol->erase_member(this); + } +} + void NPC::set_mood(const Mood mood) { npc_mood = mood; @@ -195,6 +202,28 @@ void NPC::frame(const unsigned long elapsed) unset_autopilot_flag(Ship::AutoPilotFormation); } } + + } else if (patrol()) { + // patrol leader behaviour + + // autopilot_target() is set by patrol + if (!autopilot_target()) { + + target_direction = 0; + target_pitch = 0; + target_roll = 0; + target_strafe = 0.0f; + target_vstrafe = 0.0f; + + target_afterburner = 0.0f; + target_thrust = 0; + + if (state() == core::Entity::Impulse) { + + func_impulse(); + } + + } } } |