Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-10 12:19:01 +0000
committerStijn Buys <ingar@osirion.org>2013-11-10 12:19:01 +0000
commit7ddcc5fe68c58205ced08c596b74b74b85de2d4e (patch)
tree257fecf3dd21c2e1fb44d7f9cd7491d7ad07ab35 /src/game/base
parent714ca6fdf281e0a9503d3a0cfe683ac78fc1d30c (diff)
Separated the WayPoint class into its own files.
Diffstat (limited to 'src/game/base')
-rw-r--r--src/game/base/Makefile.am2
-rw-r--r--src/game/base/game.cc2
-rw-r--r--src/game/base/patrol.cc37
-rw-r--r--src/game/base/patrol.h52
-rw-r--r--src/game/base/waypoint.cc43
-rw-r--r--src/game/base/waypoint.h61
6 files changed, 111 insertions, 86 deletions
diff --git a/src/game/base/Makefile.am b/src/game/base/Makefile.am
index 7289545..7444b73 100644
--- a/src/game/base/Makefile.am
+++ b/src/game/base/Makefile.am
@@ -22,6 +22,7 @@ noinst_HEADERS = \
star.h \
station.h \
template.h \
+ waypoint.h \
weapon.h
libbase_la_SOURCES = \
@@ -43,6 +44,7 @@ libbase_la_SOURCES = \
star.cc \
station.cc \
template.cc \
+ waypoint.cc \
weapon.cc
libbase_la_LDFLAGS = -avoid-version -no-undefined
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index c4d6069..e34f9a3 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -1833,7 +1833,7 @@ bool Game::load_zone(core::Zone *zone)
CheckPoint *racetrack_checkpoint = 0;
Patrol *patrol = 0;
- Patrol::WayPoint *patrol_waypoint = 0;
+ WayPoint *patrol_waypoint = 0;
NPCType *patrol_npctype = 0;
bool b;
diff --git a/src/game/base/patrol.cc b/src/game/base/patrol.cc
index d1bbe15..6640cb8 100644
--- a/src/game/base/patrol.cc
+++ b/src/game/base/patrol.cc
@@ -10,41 +10,6 @@
namespace game {
-/* --- WayPoint atrol ------------------------------------------------------ */
-
-Patrol::WayPoint::WayPoint() {
- waypoint_target = 0;
- waypoint_cargo = 0;
- waypoint_dock = false;
-}
-
-Patrol::WayPoint::~WayPoint() {
- waypoint_target = 0;
- waypoint_cargo = 0;
-}
-
-void Patrol::WayPoint::set_target_label(const std::string &label)
-{
- waypoint_target_label.assign(label);
-}
-
-void Patrol::WayPoint::set_target(core::Entity *entity)
-{
- waypoint_target = entity;
-}
-
-void Patrol::WayPoint::set_dock(const bool dock)
-{
- waypoint_dock = dock;
-}
-
-void Patrol::WayPoint::set_cargo(Cargo *cargo)
-{
- waypoint_cargo = cargo;
-}
-
-/* --- Patrol ------------------------------------------------------ */
-
Patrol::Patrol() : core::Entity()
{
// this is a server-side only entity
@@ -224,7 +189,7 @@ void Patrol::print() const
con_print << " ^Nmembers ^B" << patrol_members.size() << std::endl;
}
-Patrol::WayPoint *Patrol::add_waypoint()
+WayPoint *Patrol::add_waypoint()
{
WayPoint *waypoint = new WayPoint();
diff --git a/src/game/base/patrol.h b/src/game/base/patrol.h
index c99c244..c9a309d 100644
--- a/src/game/base/patrol.h
+++ b/src/game/base/patrol.h
@@ -8,10 +8,11 @@
#define __INCLUDED_BASE_PATROL_H__
#include "core/entity.h"
+
#include "base/faction.h"
-#include "base/cargo.h"
#include "base/npc.h"
#include "base/npctype.h"
+#include "base/waypoint.h"
namespace game
{
@@ -39,53 +40,6 @@ public:
* */
enum Profile { ProfileFreelancer = 0, ProfileConvoy = 1, ProfilePatrol = 2, ProfileGuard = 3, ProfileWingman = 4 };
- /* --- WayPoint -------------------------------------------- */
-
- /**
- * @brief a node in the patrol's travel path
- * */
- class WayPoint {
- public:
- WayPoint();
- ~WayPoint();
-
- inline core::Entity *target()
- {
- return waypoint_target;
- }
-
- inline const std::string & target_label() const {
- return waypoint_target_label;
- }
-
- inline const bool dock() const {
- return waypoint_dock;
- }
-
- inline const Cargo *cargo() const {
- return waypoint_cargo;
- }
-
- void set_target(core::Entity *entity);
-
- void set_target_label(const std::string &label);
-
- void set_cargo(Cargo *cargo);
-
- void set_dock(const bool dock);
-
- private:
- std::string waypoint_target_label;
-
- core::Entity *waypoint_target;
-
- Cargo *waypoint_cargo;
-
- bool waypoint_dock;
- };
-
- /* --- Patrol ---------------------------------------------- */
-
typedef std::list<WayPoint *> WayPoints;
typedef std::list<NPCType *> NPCTypes;
@@ -159,4 +113,4 @@ private:
} // namespace game
-#endif // __INCLUDED_BASE_PATROL_H__ \ No newline at end of file
+#endif // __INCLUDED_BASE_PATROL_H__
diff --git a/src/game/base/waypoint.cc b/src/game/base/waypoint.cc
new file mode 100644
index 0000000..655dab3
--- /dev/null
+++ b/src/game/base/waypoint.cc
@@ -0,0 +1,43 @@
+/*
+ base/waypoint.cc
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+#include "base/waypoint.h"
+
+namespace game {
+
+WayPoint::WayPoint() {
+ waypoint_target = 0;
+ waypoint_cargo = 0;
+ waypoint_dock = false;
+}
+
+WayPoint::~WayPoint() {
+ waypoint_target = 0;
+ waypoint_cargo = 0;
+}
+
+void WayPoint::set_target_label(const std::string &label)
+{
+ waypoint_target_label.assign(label);
+}
+
+void WayPoint::set_target(core::Entity *entity)
+{
+ waypoint_target = entity;
+}
+
+void WayPoint::set_dock(const bool dock)
+{
+ waypoint_dock = dock;
+}
+
+void WayPoint::set_cargo(Cargo *cargo)
+{
+ waypoint_cargo = cargo;
+}
+
+} //namespace game
+
diff --git a/src/game/base/waypoint.h b/src/game/base/waypoint.h
new file mode 100644
index 0000000..ce18930
--- /dev/null
+++ b/src/game/base/waypoint.h
@@ -0,0 +1,61 @@
+/*
+ base/waypoint.h
+ This file is part of the Osirion project and is distributed under
+ the terms and conditions of the GNU General Public License version 2
+*/
+
+#ifndef __INCLUDED_BASE_WAYPOINT_H__
+#define __INCLUDED_BASE_WAYPOINT_H__
+
+#include "core/entity.h"
+#include "base/cargo.h"
+
+namespace game
+{
+
+/**
+* @brief a node in the patrol's travel path
+* */
+class WayPoint {
+public:
+ WayPoint();
+ ~WayPoint();
+
+ inline core::Entity *target()
+ {
+ return waypoint_target;
+ }
+
+ inline const std::string & target_label() const {
+ return waypoint_target_label;
+ }
+
+ inline const bool dock() const {
+ return waypoint_dock;
+ }
+
+ inline const Cargo *cargo() const {
+ return waypoint_cargo;
+ }
+
+ void set_target(core::Entity *entity);
+
+ void set_target_label(const std::string &label);
+
+ void set_cargo(Cargo *cargo);
+
+ void set_dock(const bool dock);
+
+private:
+ std::string waypoint_target_label;
+
+ core::Entity *waypoint_target;
+
+ Cargo *waypoint_cargo;
+
+ bool waypoint_dock;
+};
+
+} // namespace game
+
+#endif // __INCLUDED_BASE_WAYPOINT_H__