Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/base/game.cc4
-rw-r--r--src/game/base/npc.cc5
-rw-r--r--src/game/base/npc.h28
-rw-r--r--src/game/base/patrol.cc7
-rw-r--r--src/game/base/patrol.h19
5 files changed, 26 insertions, 37 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 46151f9..d5e541b 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -2100,9 +2100,9 @@ bool Game::load_zone(core::Zone *zone)
continue;
} else if (zoneini.got_key_label("profile", strval)) {
if (strval.compare("convoy")) {
- patrol->set_profile(NPC::ProfileConvoy);
+ patrol->set_profile(Patrol::ProfileConvoy);
} else if (strval.compare("patrol")) {
- patrol->set_profile(NPC::ProfilePatrol);
+ patrol->set_profile(Patrol::ProfilePatrol);
} else {
zoneini.unknown_error("unknown profile '" + strval + "'");
}
diff --git a/src/game/base/npc.cc b/src/game/base/npc.cc
index 0997ed2..fa0ef44 100644
--- a/src/game/base/npc.cc
+++ b/src/game/base/npc.cc
@@ -21,7 +21,7 @@ NPC *NPC::add_wingman(Ship *leader)
return 0;
}
- NPC *npc = new NPC(ProfileWingman, leader->shipmodel());
+ NPC *npc = new NPC(leader->shipmodel());
npc->set_leader(leader);
//npc->set_owner(leader->owner());
@@ -68,9 +68,8 @@ NPC *NPC::add_wingman(Ship *leader)
return npc;
}
-NPC::NPC(const Profile profile, const ShipModel *shipmodel) : Ship(0, shipmodel)
+NPC::NPC(const ShipModel *shipmodel) : Ship(0, shipmodel)
{
- npc_profile = profile;
npc_mood = MoodWander;
npc_destroyed_timestamp = 0;
diff --git a/src/game/base/npc.h b/src/game/base/npc.h
index 48fff35..8139c9a 100644
--- a/src/game/base/npc.h
+++ b/src/game/base/npc.h
@@ -18,39 +18,19 @@ class NPC : public Ship {
public:
/**
- * @brief Definse the general profile of the NPC
- * The NPC profile is set at creating time and can not be altered.
- *
- * Freelancer fallback value
- * Convoy Trade convoy member, prefers trade routes
- * Patrol Police or military, prefers patrol routes
- * Guard Guard an area
- * Wingman wingman, prefers protecting its leader
- * */
- enum Profile { ProfileFreelancer = 0, ProfileConvoy = 1, ProfilePatrol = 2, ProfileGuard = 3, ProfileWingman = 4 };
-
- /**
* @brief Defines the general moode of the NPC
* Wander Wamder around
* Formation Follow the leader in formation
+ * Attack Attack at will
* */
- enum Mood { MoodWander = 0, MoodFormation = 1 };
+ enum Mood { MoodWander = 0, MoodFormation = 1, MoodAttack = 2};
- NPC(const Profile profile, const ShipModel *shipmodel);
+ NPC(const ShipModel *shipmodel);
virtual ~NPC();
/* ---- inspectors ----------------------------------------- */
/**
- * @brief Treturns te general profile of the NPC
- * The NPC profile is set at creating time and can not be altered.
- * */
- inline const Profile profile() const
- {
- return npc_profile;
- }
-
- /**
* @brief returns the general moode of the NPC
* */
inline const Mood mood() const
@@ -103,8 +83,6 @@ public:
static NPC *add_wingman(Ship *leader);
private:
- Profile npc_profile;
-
Mood npc_mood;
Ship *npc_leader;
diff --git a/src/game/base/patrol.cc b/src/game/base/patrol.cc
index f3cfa07..fbe02df 100644
--- a/src/game/base/patrol.cc
+++ b/src/game/base/patrol.cc
@@ -62,7 +62,7 @@ Patrol::Patrol() : core::Entity()
patrol_faction = 0;
- patrol_profile = NPC::ProfilePatrol;
+ patrol_profile = ProfilePatrol;
patrol_waypoint_current == patrol_waypoints.end();
@@ -98,7 +98,7 @@ Patrol::~Patrol()
patrol_members.clear();
}
-void Patrol::set_profile(const NPC::Profile profile)
+void Patrol::set_profile(const Profile profile)
{
patrol_profile = profile;
}
@@ -302,7 +302,8 @@ void Patrol::frame(const unsigned long elapsed)
for (size_t i = 0; i < nbships; i++) {
// add NPC
- NPC *npc = new NPC(patrol_profile, npctype->shipmodel());
+ NPC *npc = new NPC(npctype->shipmodel());
+ npc->set_mood(NPC::MoodFormation);
// set NPC name
if (npctype->name().size()) {
diff --git a/src/game/base/patrol.h b/src/game/base/patrol.h
index e4ba19b..cc3bf61 100644
--- a/src/game/base/patrol.h
+++ b/src/game/base/patrol.h
@@ -27,6 +27,17 @@ namespace game
class Patrol: public core::Entity {
public:
+ /**
+ * @brief Definse the general profile of the patrol
+ * The NPC profile is set at creating time and can not be altered.
+ *
+ * Freelancer fallback value
+ * Convoy Trade convoy member, prefers trade routes
+ * Patrol Police or military, prefers patrol routes
+ * Guard Guard an area
+ * Wingman wingman, prefers protecting its leader
+ * */
+ enum Profile { ProfileFreelancer = 0, ProfileConvoy = 1, ProfilePatrol = 2, ProfileGuard = 3, ProfileWingman = 4 };
/* --- WayPoint -------------------------------------------- */
@@ -84,7 +95,7 @@ public:
Patrol();
virtual ~Patrol();
- inline const NPC::Profile profile() const {
+ inline const Profile profile() const {
return patrol_profile;
}
@@ -104,7 +115,7 @@ public:
return patrol_faction;
}
- void set_profile(const NPC::Profile profile);
+ void set_profile(const Profile profile);
void set_faction(Faction *faction);
@@ -118,7 +129,7 @@ public:
void add_member(NPC *npc);
- void erase_member(NPC *npc);
+ void erase_member(NPC *npc);
private:
void set_leader();
@@ -133,7 +144,7 @@ private:
NPCTypes patrol_npctypes;
- NPC::Profile patrol_profile;
+ Profile patrol_profile;
NPC *patrol_leader;