Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/cargo.cc5
-rw-r--r--src/game/base/cargo.h2
-rw-r--r--src/game/base/faction.cc5
-rw-r--r--src/game/base/faction.h2
-rw-r--r--src/game/base/game.cc30
-rw-r--r--src/game/base/jumppoint.cc29
-rw-r--r--src/game/base/ship.cc2
-rw-r--r--src/game/base/shipmodel.cc11
-rw-r--r--src/game/base/shipmodel.h12
-rw-r--r--src/game/base/template.cc7
-rw-r--r--src/game/base/template.h2
11 files changed, 93 insertions, 14 deletions
diff --git a/src/game/base/cargo.cc b/src/game/base/cargo.cc
index 41cce1b..e75064e 100644
--- a/src/game/base/cargo.cc
+++ b/src/game/base/cargo.cc
@@ -104,6 +104,11 @@ bool Cargo::init()
return true;
}
+void Cargo::done()
+{
+ core::Func::remove("list_cargo");
+}
+
/* ---- class Cargo -------------------------------------------- */
Cargo::Cargo() : core::Info(cargo_infotype)
diff --git a/src/game/base/cargo.h b/src/game/base/cargo.h
index bee0502..4d90611 100644
--- a/src/game/base/cargo.h
+++ b/src/game/base/cargo.h
@@ -29,6 +29,8 @@ public:
static bool init();
+ static void done();
+
static void list();
static inline const core::InfoType *infotype() {
diff --git a/src/game/base/faction.cc b/src/game/base/faction.cc
index 2194844..6fb70cf 100644
--- a/src/game/base/faction.cc
+++ b/src/game/base/faction.cc
@@ -108,6 +108,11 @@ bool Faction::init()
return true;
}
+void Faction::done()
+{
+ core::Func::remove("list_faction");
+}
+
Faction::Faction() :
core::Info(faction_infotype),
faction_color(),
diff --git a/src/game/base/faction.h b/src/game/base/faction.h
index 608f7c7..997b6fc 100644
--- a/src/game/base/faction.h
+++ b/src/game/base/faction.h
@@ -54,6 +54,8 @@ public:
*/
static bool init();
+ static void done();
+
/**
* @brief list available factions
*/
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index fa83a0a..30970f9 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -887,7 +887,7 @@ Game::Game() : core::Module("Project::OSiRiON", true)
return;
}
- // add engine functions
+ // add game functions
core::Func *func = 0;
func = core::Func::add("join", Game::func_join);
@@ -966,8 +966,17 @@ Game::~Game()
// clear defaults
Default::clear();
+ // clear Cargo
+ Cargo::done();
+
+ // clear ShipModel
+ ShipModel::done();
+
+ // clear Templates
+ Template::done();
+
// clear Factions
- Faction::clear();
+ Faction::done();
}
bool Game::load_world()
@@ -1081,6 +1090,7 @@ bool Game::load_zone(core::Zone *zone)
while (zoneini.getline()) {
if (zoneini.got_section()) {
+
if (zoneini.got_section("zone")) {
continue;
@@ -1094,24 +1104,28 @@ bool Game::load_zone(core::Zone *zone)
navpoint = new NavPoint();
entity = navpoint;
navpoint->set_zone(zone);
+ navpoint->set_radius(0);
count ++;
} else if (zoneini.got_section("jumpgate")) {
jumppoint = new JumpGate();
entity = jumppoint;
jumppoint->set_zone(zone);
+ jumppoint->set_radius(0);
count ++;
} else if (zoneini.got_section("jumppoint")) {
jumppoint = new JumpPoint();
entity = jumppoint;
jumppoint->set_zone(zone);
+ jumppoint->set_radius(0);
count ++;
} else if (zoneini.got_section("racetrack")) {
racetrack = new RaceTrack();
entity = racetrack;
racetrack->set_zone(zone);
+ racetrack->set_radius(0);
} else if (zoneini.got_section("checkpoint")) {
checkpoint = new CheckPoint(racetrack);
@@ -1119,6 +1133,7 @@ bool Game::load_zone(core::Zone *zone)
if (!racetrack) {
zoneini.unknown_error("checkpoint without racetrack");
}
+ checkpoint->set_radius(0);
} else if (zoneini.got_section("planet")) {
planet = new Planet();
@@ -1130,11 +1145,13 @@ bool Game::load_zone(core::Zone *zone)
station = new Station();
entity = station;
station->set_zone(zone);
+ station->set_radius(0);
count ++;
} else if (zoneini.got_section("entity")) {
entity = new core::Entity();
entity->set_zone(zone);
+ entity->set_radius(0);
count ++;
} else if (zoneini.got_section("cargo")) {
@@ -1422,6 +1439,15 @@ bool Game::validate_zone(core::Zone *zone)
}
}
+ if (!entity->radius()) {
+ if (entity->model()) {
+ entity->set_radius(entity->model()->radius());
+ } else {
+ entity->set_radius(0.25f);
+ }
+ con_debug << " " << entity->label() << " radius set to " << entity->radius() << std::endl;
+ }
+
// initialize physics on planets and entities with a model
if ((entity->entity_moduletypeid == planet_enttype) || (entity->model())) {
entity->reset();
diff --git a/src/game/base/jumppoint.cc b/src/game/base/jumppoint.cc
index 82ed489..8af39b0 100644
--- a/src/game/base/jumppoint.cc
+++ b/src/game/base/jumppoint.cc
@@ -71,9 +71,22 @@ void JumpPoint::validate()
}
jumppoint_target = static_cast<JumpPoint *>(targetentity);
+
+ // overwrite name and info, remove the "system" part from the name
+ std::string name("Jumppoint " + zone()->name() + " -> " + target()->zone()->name());
+ for (size_t pos = name.find(" system"); pos != std::string::npos; pos = name.find(" system")) {
+ name.erase(pos, 7);
+ }
+ set_name(name);
+
+ if (!info()) {
+ set_info(new core::Info(core::Entity::infotype(), label().c_str()));
+ }
+ info()->clear_text();
+ info()->add_text("Jumppoint to the " + target()->zone()->name());
+
- con_debug << " jumppoint to " << targetzone->label() << std::endl;
- //con_debug << " Jumppoint " << zone->label() << ":" << label() << " with target " << targetlabel() << std::endl;
+ con_debug << " " << label() << " jumppoint to " << target()->zone()->label() << ":" << target()->label() << std::endl;
}
/* ---- class JumpGate --------------------------------------------- */
@@ -97,6 +110,18 @@ JumpGate::~JumpGate()
void JumpGate::validate()
{
JumpPoint::validate();
+
+ // overwrite name and info
+ // overwrite name and info, remove the "system" part from the name
+ std::string name("Jumpgate " + zone()->name() + " -> " + target()->zone()->name());
+ for (size_t pos = name.find(" system"); pos != std::string::npos; pos = name.find(" system")) {
+ name.erase(pos, 7);
+ }
+ set_name(name);
+
+ info()->clear_text();
+ info()->add_text("Jumpgate to the " + target()->zone()->name());
+
if (target()) {
set_flag(core::Entity::Dockable);
} else {
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 38ade38..0b31a91 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -68,7 +68,7 @@ Ship::Ship(core::Player *owner, ShipModel *shipmodel) : core::EntityControlable(
set_label(shipmodel->label());
}
- if (shipmodel->dock()) {
+ if (shipmodel->dockable()) {
using core::MenuDescription;
using core::ButtonDescription;
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc
index 4cf55bf..1cea640 100644
--- a/src/game/base/shipmodel.cc
+++ b/src/game/base/shipmodel.cc
@@ -73,7 +73,7 @@ bool ShipModel::init()
shipmodel->set_jumpdrive(b);
continue;
} else if (inifile.got_key_bool("dock", b)) {
- shipmodel->set_dock(b);
+ shipmodel->set_dockable(b);
continue;
} else if (inifile.got_key_float("maxspeed", f)) {
shipmodel->set_maxspeed(f * 0.01f);
@@ -145,6 +145,11 @@ bool ShipModel::init()
return true;
}
+void ShipModel::done()
+{
+ core::Func::remove("list_ship");
+}
+
ShipModel::ShipModel() : core::Info(shipmodel_infotype)
{
shipmodel_maxspeed = 0;
@@ -159,7 +164,7 @@ ShipModel::ShipModel() : core::Info(shipmodel_infotype)
shipmodel_maxcargo = 0.0f;
shipmodel_jumpdrive = false; // no jumpdrive capability
- shipmodel_dock = false; // not dockable
+ shipmodel_dockable = false; // not dockable
}
ShipModel::~ShipModel()
@@ -195,7 +200,7 @@ void ShipModel::generate_info()
add_text("^Bhyperspace jump drive");
}
- if (dock()) {
+ if (dockable()) {
add_text("^Bdockable");
}
}
diff --git a/src/game/base/shipmodel.h b/src/game/base/shipmodel.h
index 9da50a6..25473d4 100644
--- a/src/game/base/shipmodel.h
+++ b/src/game/base/shipmodel.h
@@ -34,8 +34,8 @@ public:
}
/// indicates if players can dock this ship model
- inline const bool dock() const {
- return shipmodel_dock;
+ inline const bool dockable() const {
+ return shipmodel_dockable;
}
/// default mass
@@ -139,8 +139,8 @@ protected:
}
/// set dock capability
- inline void set_dock(const bool dock) {
- shipmodel_dock = dock;
+ inline void set_dockable(const bool dockable) {
+ shipmodel_dockable = dockable;
}
/// set radius
@@ -166,6 +166,8 @@ public:
static bool init();
+ static void done();
+
static void list();
static inline const core::InfoType *infotype() {
@@ -187,7 +189,7 @@ private:
float shipmodel_maxcargo;
bool shipmodel_jumpdrive;
- bool shipmodel_dock;
+ bool shipmodel_dockable;
const Template *shipmodel_template;
diff --git a/src/game/base/template.cc b/src/game/base/template.cc
index 1cdac1a..7861538 100644
--- a/src/game/base/template.cc
+++ b/src/game/base/template.cc
@@ -116,7 +116,7 @@ bool Template::init()
entitytemplate = Template::find(std::string("navpoint"));
NavPoint::set_template(entitytemplate);
- if (entitytemplate) {
+ if (!entitytemplate) {
con_warn << "Template 'navpoint' not found!" << std::endl;
}
@@ -128,6 +128,11 @@ bool Template::init()
return true;
}
+void Template::done()
+{
+ core::Func::remove("list_template");
+}
+
Template::Template() :
core::Info(template_infotype),
template_color(),
diff --git a/src/game/base/template.h b/src/game/base/template.h
index 47c9ff3..5780e9c 100644
--- a/src/game/base/template.h
+++ b/src/game/base/template.h
@@ -66,6 +66,8 @@ public:
static bool init();
+ static void done();
+
static void list();
static Template *find(const std::string & label);