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')
-rw-r--r--src/game/base/base.cc74
-rw-r--r--src/game/base/base.h2
2 files changed, 9 insertions, 67 deletions
diff --git a/src/game/base/base.cc b/src/game/base/base.cc
index 70d9335..d337391 100644
--- a/src/game/base/base.cc
+++ b/src/game/base/base.cc
@@ -9,6 +9,7 @@
#include "auxiliary/functions.h"
#include "core/gameserver.h"
+#include "core/parser.h"
#include "filesystem/filesystem.h"
#include "filesystem/inifile.h"
#include "base/base.h"
@@ -308,65 +309,6 @@ bool Base::load_world()
return true;
}
-bool Base::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
-{
- std::string shapename;
- std::string strval;
- float direction;
- float pitch;
- float roll;
-
- if (inifile.got_key_string("shape", shapename)) {
-
- if (shapename.compare("axis") == 0) {
- entity->entity_shape = core::Entity::Axis;
- return true;
- } else if (shapename.compare("cube") == 0) {
- entity->entity_shape = core::Entity::Cube;
- return true;
- } else if (shapename.compare("diamond") == 0) {
- entity->entity_shape = core::Entity::Diamond;
- return true;
- } else if (shapename.compare("sphere") == 0) {
- entity->entity_shape = core::Entity::Sphere;
- return true;
- } else {
- con_warn << inifile.name() << " unknown shape '" << shapename << "' at line " << inifile.line() << std::endl;
- return false;
- }
-
- } else if (inifile.got_key_string("label", strval)) {
- aux::to_label(strval);
- entity->entity_label.assign(strval);
- return true;
- } else if (inifile.got_key_string("name", strval)) {
- aux::strip_quotes(strval);
- entity->entity_name.assign(strval);
- return true;
- } else if (inifile.got_key_string("model", entity->entity_modelname)) {
- return true;
- } else if (inifile.got_key_angle("direction", direction)) {
- entity->axis().change_direction(direction);
- return true;
- } else if (inifile.got_key_angle("pitch", pitch)) {
- entity->axis().change_pitch(pitch);
- return true;
- } else if (inifile.got_key_angle("roll", roll)) {
- entity->axis().change_roll(roll);
- return true;
- } else if (inifile.got_key_angle("radius", entity->entity_radius)) {
- return true;
- } else if (inifile.got_key_vector3f("location", entity->entity_location)) {
- return true;
- } else if (inifile.got_key_color("color", entity->entity_color)) {
- return true;
- } else if (inifile.got_key_color("colorsecond", entity->entity_color_second)) {
- return true;
- }
-
- return false;
-}
-
bool Base::load_zone(core::Zone *zone)
{
using math::Vector3f;
@@ -417,7 +359,7 @@ bool Base::load_zone(core::Zone *zone)
con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
}
} else if (zoneini.section().compare("star") == 0) {
- if (got_entity_key(zoneini, star)) {
+ if (core::Parser::got_entity_key(zoneini, star)) {
continue;
} else if (zoneini.got_key_string("texture", star->entity_texture)) {
continue;
@@ -425,13 +367,13 @@ bool Base::load_zone(core::Zone *zone)
con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
}
} else if (zoneini.section().compare("navpoint") == 0) {
- if (got_entity_key(zoneini, 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;
}
} else if (zoneini.section().compare("jumppoint") == 0) {
- if (got_entity_key(zoneini, jumppoint)) {
+ if (core::Parser::got_entity_key(zoneini, jumppoint)) {
continue;
} else if (zoneini.got_key_string("target", jumppoint->jumppoint_targetlabel)) {
continue;
@@ -439,7 +381,7 @@ bool Base::load_zone(core::Zone *zone)
con_warn << zoneini.name() << " unknown key '" << zoneini.key() << "' at line " << zoneini.line() << std::endl;
}
} else if (zoneini.section().compare("planet") == 0) {
- if (got_entity_key(zoneini, planet)) {
+ if (core::Parser::got_entity_key(zoneini, planet)) {
continue;
} else if (zoneini.got_key_string("texture", planet->entity_texture)) {
continue;
@@ -450,21 +392,21 @@ bool Base::load_zone(core::Zone *zone)
}
} else if (zoneini.section().compare("racetrack") == 0) {
- if (got_entity_key(zoneini, 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;
}
} else if (zoneini.section().compare("checkpoint") == 0) {
- if (got_entity_key(zoneini, 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;
}
} else if (zoneini.section().compare("entity") == 0) {
- if (got_entity_key(zoneini, 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;
diff --git a/src/game/base/base.h b/src/game/base/base.h
index fea1919..db3e7d9 100644
--- a/src/game/base/base.h
+++ b/src/game/base/base.h
@@ -1,5 +1,5 @@
/*
- game/game.h
+ base/base.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/