diff options
author | Stijn Buys <ingar@osirion.org> | 2008-09-28 18:02:06 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-09-28 18:02:06 +0000 |
commit | f46be446304dcb2d609fcd2648fd36d3f2fda054 (patch) | |
tree | 36e194d6e2d9d8fc48d03c4b8bb56d63e12276cf /src/core/parser.cc | |
parent | fd778219e40c5fbb4d0af1839cbc313caaf10d9d (diff) |
intro module groundworks
Diffstat (limited to 'src/core/parser.cc')
-rw-r--r-- | src/core/parser.cc | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/core/parser.cc b/src/core/parser.cc new file mode 100644 index 0000000..99dc1d5 --- /dev/null +++ b/src/core/parser.cc @@ -0,0 +1,70 @@ +/* + core/parser.h + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#include "core/parser.h" +#include "auxiliary/functions.h" +#include "sys/sys.h" + +namespace core { + +bool Parser::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)) { + entity->set_label(strval); + return true; + } else if (inifile.got_key_string("name", strval)) { + entity->set_name(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; +} + +} |