Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-10-25 12:40:53 +0000
committerStijn Buys <ingar@osirion.org>2010-10-25 12:40:53 +0000
commit787002ec11bf41bba01b899c53a38830768fc260 (patch)
tree5a4b4e60617b0167a9e32a3882342a85f0fde4ab /src/game
parent6a86e7f0f9e021498c1df44653a42643bd79dfbf (diff)
directory prefix is no required for ini files, merge ui.ini and menu.ini
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/cargo.cc4
-rw-r--r--src/game/base/cargopod.cc5
-rw-r--r--src/game/base/game.cc34
-rw-r--r--src/game/base/game.h3
-rw-r--r--src/game/base/shipmodel.cc2
-rw-r--r--src/game/intro/intro.cc2
6 files changed, 35 insertions, 15 deletions
diff --git a/src/game/base/cargo.cc b/src/game/base/cargo.cc
index daf4ac2..c7f2492 100644
--- a/src/game/base/cargo.cc
+++ b/src/game/base/cargo.cc
@@ -27,7 +27,7 @@ bool Cargo::init()
Cargo::cargo_infotype = new core::InfoType("cargo");
filesystem::IniFile cargoini;
- cargoini.open("cargo");
+ cargoini.open("ini/cargo");
if (!cargoini.is_open()) {
con_error << "Could not open " << cargoini.name() << "!" << std::endl;
return false;
@@ -80,7 +80,7 @@ bool Cargo::init()
if (cargoini.got_section("cargo")) {
cargo = new Cargo();
-
+
} else if (cargoini.got_section()) {
cargoini.unknown_section();
}
diff --git a/src/game/base/cargopod.cc b/src/game/base/cargopod.cc
index 6581b75..5ea4105 100644
--- a/src/game/base/cargopod.cc
+++ b/src/game/base/cargopod.cc
@@ -19,9 +19,8 @@ CargoPod::CargoPod() : EntityDynamic()
set_flag(core::Entity::KeepAlive);
set_keepalive_timeout(Game::g_keepalive ? Game::g_keepalive->value() : 0);
- // FIXME hardcoded modelname
- set_modelname("maps/cargo/pod");
-
+ if (Default::podmodel)
+ set_modelname(Default::podmodel->name());
set_mass(radius());
// activate physics
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 9d2dcd0..73fd9ad 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -34,6 +34,7 @@ namespace game
// default player settings
core::Zone *Default::zone = 0;
core::Entity *Default::view = 0;
+model::Model *Default::podmodel = 0;
ShipModel *Default::shipmodel = 0;
long Default::credits = 0;
@@ -43,6 +44,7 @@ void Default::clear()
view = 0;
shipmodel = 0;
credits = 0;
+ podmodel = 0;
}
/* -- class Game static members ----------------------------------- */
@@ -827,7 +829,7 @@ Game::Game() : core::Module("Project::OSiRiON", true)
}
// load game default settings
- if (!load_defaults()) {
+ if (!load_settings()) {
abort();
return;
}
@@ -900,15 +902,22 @@ Game::Game() : core::Module("Project::OSiRiON", true)
Game::~Game()
{
g_impulsespeed = 0;
+ g_jumppointrange = 0;
+ g_devel = 0;
+ g_damping = 0;
+ g_keepalive = 0;
// game functions are automaticly removed
+ // FIXME move cleanup sequence to core::
// we explicity clear game data to prevent bullet from beeing confused
core::game()->clear();
+
+ Default::clear();
}
bool Game::load_world()
{
- std::string inifilename("world");
+ std::string inifilename("ini/world");
filesystem::IniFile worldini;
worldini.open(inifilename);
@@ -977,7 +986,7 @@ bool Game::load_zone(core::Zone *zone)
using math::Vector3f;
using math::Color;
- std::string inifilename("zones/");
+ std::string inifilename("ini/zones/");
inifilename.append(zone->label());
filesystem::IniFile zoneini;
@@ -1394,12 +1403,10 @@ bool Game::generate_entity_menus(core::Entity *entity)
}
// load game defaults settings
-bool Game::load_defaults()
+bool Game::load_settings()
{
- Default::clear();
-
filesystem::IniFile inifile;
- inifile.open("game");
+ inifile.open("ini/game");
if (!inifile.is_open()) {
con_error << "Could not open " << inifile.name() << "!" << std::endl;
return false;
@@ -1414,6 +1421,8 @@ bool Game::load_defaults()
if (inifile.got_section("player")) {
continue;
+ } else if (inifile.got_section("cargo")) {
+ continue;
} else {
inifile.unknown_section();
}
@@ -1421,6 +1430,7 @@ bool Game::load_defaults()
} else if (inifile.got_key()) {
if (inifile.in_section("player")) {
+
if (inifile.got_key_long("credits", l)) {
Default::credits = l;
} else if (inifile.got_key_string("zone", str)) {
@@ -1429,6 +1439,16 @@ bool Game::load_defaults()
} else if (inifile.got_key_string("ship", str)) {
aux::to_label(str);
Default::shipmodel = ShipModel::find(str);
+ } else {
+ inifile.unkown_key();
+ }
+
+ } else if (inifile.in_section("cargo")) {
+
+ if (inifile.got_key_string("model", str)) {
+ Default::podmodel = model::Model::load(str);
+ } else {
+ inifile.unkown_key();
}
}
}
diff --git a/src/game/base/game.h b/src/game/base/game.h
index 1042367..d879a30 100644
--- a/src/game/base/game.h
+++ b/src/game/base/game.h
@@ -52,6 +52,7 @@ public:
static core::Zone *zone;
static core::Entity *view;
static ShipModel *shipmodel;
+ static model::Model *podmodel;
static long credits;
static void clear();
@@ -104,7 +105,7 @@ private:
bool load_ships();
- bool load_defaults();
+ bool load_settings();
/* ---- engine functions ----------------------------------- */
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc
index de68413..cd69c5b 100644
--- a/src/game/base/shipmodel.cc
+++ b/src/game/base/shipmodel.cc
@@ -26,7 +26,7 @@ bool ShipModel::init()
using math::Color;
filesystem::IniFile shipsini;
- shipsini.open("ships");
+ shipsini.open("ini/ships");
if (!shipsini.is_open()) {
con_error << "Could not open " << shipsini.name() << "!" << std::endl;
return false;
diff --git a/src/game/intro/intro.cc b/src/game/intro/intro.cc
index f2da493..8d5577b 100644
--- a/src/game/intro/intro.cc
+++ b/src/game/intro/intro.cc
@@ -35,7 +35,7 @@ Intro::Intro() : core::Module("Project::OSiRiON", false)
bool Intro::load_world()
{
- std::string filename("intro");
+ std::string filename("ini/intro");
filesystem::IniFile ini;
ini.open(filename);