Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base/game.cc')
-rw-r--r--src/game/base/game.cc62
1 files changed, 38 insertions, 24 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 295b2f1..fa83a0a 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -25,6 +25,7 @@
#include "base/racetrack.h"
#include "base/ship.h"
#include "base/star.h"
+#include "base/template.h"
#include "math/mathlib.h"
#include "sys/sys.h"
@@ -36,7 +37,6 @@ 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;
@@ -46,7 +46,6 @@ void Default::clear()
view = 0;
shipmodel = 0;
credits = 0;
- podmodel = 0;
}
/* -- class Game static members ----------------------------------- */
@@ -854,8 +853,14 @@ Game::Game() : core::Module("Project::OSiRiON", true)
// read factions.ini
if (!Faction::init()) {
- // not fatal
-
+ abort();
+ return;
+ }
+
+ // read templates.ini
+ if (!Template::init()) {
+ abort();
+ return;
}
// read cargo.ini
@@ -870,13 +875,13 @@ Game::Game() : core::Module("Project::OSiRiON", true)
return;
}
- // load world.ini and the zones it refers to
+ // read world.ini and the zones it refers to
if (!load_world()) {
abort();
return;
}
- // load game default settings
+ // read game.ini
if (!load_settings()) {
abort();
return;
@@ -1218,9 +1223,15 @@ bool Game::load_zone(core::Zone *zone)
if (!faction) {
zoneini.unknown_error("unkown faction '" + strval + "'");
} else {
- jumppoint->set_color(faction->color());
- jumppoint->set_color_second(faction->color_second());
- }
+ faction->apply(jumppoint);
+ }
+ } else if (zoneini.got_key_label("template", strval)) {
+ Template *entitytemplate = Template::find(strval);
+ if (!entitytemplate) {
+ zoneini.unknown_error("unkown template '" + strval + "'");
+ } else {
+ entitytemplate->apply(jumppoint);
+ }
} else if (zoneini.got_key_string("target", strval)) {
jumppoint->set_targetlabel(strval);
continue;
@@ -1251,8 +1262,7 @@ bool Game::load_zone(core::Zone *zone)
if (!faction) {
zoneini.unknown_error("unkown faction '" + strval + "'");
} else {
- planet->set_color(faction->color());
- planet->set_color_second(faction->color_second());
+ faction->apply(planet);
}
} else {
zoneini.unkown_key();
@@ -1270,8 +1280,14 @@ bool Game::load_zone(core::Zone *zone)
if (!faction) {
zoneini.unknown_error("unkown faction '" + strval + "'");
} else {
- station->set_color(faction->color());
- station->set_color_second(faction->color_second());
+ faction->apply(station);
+ }
+ } else if (zoneini.got_key_label("template", strval)) {
+ Template *entitytemplate = Template::find(strval);
+ if (!entitytemplate) {
+ zoneini.unknown_error("unkown template '" + strval + "'");
+ } else {
+ entitytemplate->apply(station);
}
} else {
zoneini.unkown_key();
@@ -1306,6 +1322,13 @@ bool Game::load_zone(core::Zone *zone)
entity->set_color(faction->color());
entity->set_color_second(faction->color_second());
}
+ } else if (zoneini.got_key_label("template", strval)) {
+ Template *entitytemplate = Template::find(strval);
+ if (!entitytemplate) {
+ zoneini.unknown_error("unkown template '" + strval + "'");
+ } else {
+ entitytemplate->apply(entity);
+ }
} else {
zoneini.unkown_key();
}
@@ -1445,11 +1468,10 @@ bool Game::generate_entity_menus(core::Entity *entity)
for (core::Inventory::Items::const_iterator it = entity->inventory()->items().begin(); it != entity->inventory()->items().end(); it++) {
core::Item *item = (*it);
- if (item->info()->type() == Cargo::cargo_infotype) {
-
+ if (item->info()->type() == Cargo::infotype()) {
nbcargo++;
- } else if (item->info()->type() == ShipModel::shipmodel_infotype) {
+ } else if (item->info()->type() == ShipModel::infotype()) {
if (!menu_dealer) {
menu_dealer = new MenuDescription();
menu_dealer->set_label("ships");
@@ -1540,14 +1562,6 @@ bool Game::load_settings()
} 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();
- }
}
}
}