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/base.cc145
-rw-r--r--src/game/intro/intro.cc47
2 files changed, 109 insertions, 83 deletions
diff --git a/src/game/base/base.cc b/src/game/base/base.cc
index d337391..dee303b 100644
--- a/src/game/base/base.cc
+++ b/src/game/base/base.cc
@@ -269,17 +269,24 @@ bool Base::load_world()
if (worldini.got_section("world")) {
continue;
} else {
- con_warn << worldini.name() << " unknown section '" << worldini.section() << "' at line " << worldini.line() << std::endl;
+ worldini.unknown_section();
}
- } else if (worldini.section().compare("world") == 0 ) {
- if (worldini.got_key_string("zone", label)) {
- aux::to_label(label);
- zone = new core::Zone(label);
- core::Zone::add(zone);
+ } else if (worldini.got_key()) {
+
+ if (worldini.in_section("world")) {
+
+ if (worldini.got_key_string("zone", label)) {
+ aux::to_label(label);
+ zone = new core::Zone(label);
+ core::Zone::add(zone);
+ } else {
+ worldini.unkown_key();
+ }
}
}
}
+
worldini.close();
if (!core::Zone::registry().size()) {
@@ -343,8 +350,54 @@ bool Base::load_zone(core::Zone *zone)
zone->set_sky("sky");
while (zoneini.getline()) {
- if (zoneini.got_key()) {
- if (zoneini.section().compare("zone") == 0) {
+
+ if (zoneini.got_section()) {
+ if (zoneini.got_section("zone")) {
+ continue;
+
+ } else if (zoneini.got_section("star")) {
+ star = new Star();
+ star->set_zone(zone);
+ count ++;
+
+ } else if (zoneini.got_section("navpoint")) {
+ navpoint = new NavPoint();
+ navpoint->set_zone(zone);
+ count ++;
+
+ } else if (zoneini.got_section("jumppoint")) {
+ jumppoint = new JumpPoint();
+ jumppoint->set_zone(zone);
+ count ++;
+
+ } else if(zoneini.got_section("racetrack")) {
+ racetrack = new RaceTrack();
+ racetrack->set_zone(zone);
+
+ } else if(zoneini.got_section("checkpoint")) {
+ checkpoint = new CheckPoint(racetrack);
+ if (!racetrack) {
+ con_warn << zoneini.name() << " checkpoint without racetrack at line " << zoneini.line() << std::endl;
+ }
+
+ } else if (zoneini.got_section("planet")) {
+ planet = new Planet();
+ planet->set_zone(zone);
+ count ++;
+
+ } else if (zoneini.got_section("entity")) {
+ entity = new core::Entity();
+ entity->entity_flags += core::Entity::Static;
+ entity->set_zone(zone);
+ count ++;
+
+ } else {
+ zoneini.unknown_section();
+ }
+
+ } else if (zoneini.got_key()) {
+
+ if (zoneini.in_section("zone")) {
if (zoneini.got_key_string("name", strval)) {
aux::strip_quotes(strval);
zone->set_name(strval);
@@ -356,31 +409,35 @@ bool Base::load_zone(core::Zone *zone)
if (b) default_zone = zone;
continue;
} else {
- con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
+ zoneini.unkown_key();
}
- } else if (zoneini.section().compare("star") == 0) {
+
+ } else if (zoneini.in_section("star")) {
if (core::Parser::got_entity_key(zoneini, star)) {
continue;
} else if (zoneini.got_key_string("texture", star->entity_texture)) {
continue;
} else {
- con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
+ zoneini.unkown_key();
}
- } else if (zoneini.section().compare("navpoint") == 0) {
+
+ } else if (zoneini.in_section("navpoint")) {
if (core::Parser::got_entity_key(zoneini, navpoint)) {
continue;
} else {
- con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
+ zoneini.unkown_key();
}
- } else if (zoneini.section().compare("jumppoint") == 0) {
+
+ } else if (zoneini.in_section("jumppoint")) {
if (core::Parser::got_entity_key(zoneini, jumppoint)) {
continue;
} else if (zoneini.got_key_string("target", jumppoint->jumppoint_targetlabel)) {
continue;
} else {
- con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
+ zoneini.unkown_key();
}
- } else if (zoneini.section().compare("planet") == 0) {
+
+ } else if (zoneini.in_section("planet")) {
if (core::Parser::got_entity_key(zoneini, planet)) {
continue;
} else if (zoneini.got_key_string("texture", planet->entity_texture)) {
@@ -388,71 +445,31 @@ bool Base::load_zone(core::Zone *zone)
} else if (zoneini.got_key_float("rotationspeed", planet->entity_rotationspeed)) {
continue;
} else {
- con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
+ zoneini.unkown_key();
}
- } else if (zoneini.section().compare("racetrack") == 0) {
+ } else if (zoneini.in_section("racetrack")) {
if (core::Parser::got_entity_key(zoneini, racetrack)) {
continue;
} else {
- con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
+ zoneini.unkown_key();
}
- } else if (zoneini.section().compare("checkpoint") == 0) {
+ } else if (zoneini.in_section("checkpoint")) {
if (core::Parser::got_entity_key(zoneini, checkpoint)) {
continue;
} else {
- con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
+ zoneini.unkown_key();
}
- } else if (zoneini.section().compare("entity") == 0) {
+ } else if (zoneini.in_section("entity")) {
if (core::Parser::got_entity_key(zoneini, entity)) {
continue;
} else {
- con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
+ zoneini.unkown_key();
}
}
- } else if (zoneini.got_section("zone")) {
- continue;
-
- } else if (zoneini.got_section("star")) {
- star = new Star();
- star->set_zone(zone);
- count ++;
-
- } else if (zoneini.got_section("navpoint")) {
- navpoint = new NavPoint();
- navpoint->set_zone(zone);
- count ++;
-
- } else if (zoneini.got_section("jumppoint")) {
- jumppoint = new JumpPoint();
- jumppoint->set_zone(zone);
- count ++;
-
- } else if(zoneini.got_section("racetrack")) {
- racetrack = new RaceTrack();
- racetrack->set_zone(zone);
-
- } else if(zoneini.got_section("checkpoint")) {
- checkpoint = new CheckPoint(racetrack);
- if (!racetrack) {
- con_warn << zoneini.name() << " checkpoint without racetrack at line " << zoneini.line() << std::endl;
- }
-
- } else if (zoneini.got_section("planet")) {
- planet = new Planet();
- planet->set_zone(zone);
- count ++;
-
- } else if (zoneini.got_section("entity")) {
- entity = new core::Entity();
- entity->entity_flags += core::Entity::Static;
- entity->set_zone(zone);
- count ++;
-
- } else if (zoneini.got_section()) {
- con_warn << zoneini.name() << " unknown section '" << zoneini.section() << "' at line " << zoneini.line() << std::endl;
+
}
}
zoneini.close();
diff --git a/src/game/intro/intro.cc b/src/game/intro/intro.cc
index 4ad183f..4eb9a10 100644
--- a/src/game/intro/intro.cc
+++ b/src/game/intro/intro.cc
@@ -61,14 +61,33 @@ bool Intro::load_world()
bool b;
while (ini.getline()) {
- if (ini.got_key()) {
- if (ini.section().compare("intro") == 0) {
+ if (ini.got_section()) {
+ if (ini.got_section("intro")) {
+ continue;
+
+ } else if (ini.got_section("convoy")) {
+ continue;
+
+ } else if (ini.got_section("globe")) {
+ globe = new core::EntityGlobe();
+ globe->set_zone(intro_zone);
+
+ } else {
+ ini.unknown_section();
+ }
+ } else if (ini.got_key()) {
+
+ if (ini.in_section("intro")) {
if (ini.got_key_string("sky", strval)) {
intro_zone->set_sky(strval);
continue;
+
+ } else if (ini.got_key()) {
+ ini.unkown_key();
}
- } else if (ini.section().compare("convoy") == 0) {
+
+ } else if (ini.in_section("convoy")) {
if (ini.got_key_color("color", color)) {
intro_convoy->set_color(color);
@@ -77,9 +96,12 @@ bool Intro::load_world()
} else if (ini.got_key_string("ship", strval)) {
intro_convoy->add(strval);
+
+ } else if (ini.got_key()) {
+ ini.unkown_key();
}
- } else if (ini.section().compare("globe") == 0) {
+ } else if (ini.in_section("globe")) {
if (core::Parser::got_entity_key(ini, globe)) {
continue;
} else if (ini.got_key_string("texture", globe->entity_texture)) {
@@ -88,23 +110,10 @@ bool Intro::load_world()
continue;
} else if (ini.got_key_bool("bright", b)) {
if (b) { globe->entity_flags |= core::Entity::Bright; }
- } else {
- con_warn << ini.name() << " unknown key '" << ini.key() << "' at line " << ini.line() << std::endl;
+ } else if (ini.got_key()) {
+ ini.unkown_key();
}
}
-
- } else if (ini.got_section("intro")) {
- continue;
-
- } else if (ini.got_section("convoy")) {
- continue;
-
- } else if (ini.got_section("globe")) {
- globe = new core::EntityGlobe();
- globe->set_zone(intro_zone);
-
- } else if (ini.got_section()) {
- con_warn << ini.name() << " unknown section '" << ini.section() << "' at line " << ini.line() << std::endl;
}
}