From a3cfb9c4634e3ce7e052e72ce564d25e5367a430 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 15 Aug 2009 13:25:37 +0000 Subject: API cleanups, const optimizations, submodel lights/flares/particles import --- src/core/parser.cc | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'src/core/parser.cc') diff --git a/src/core/parser.cc b/src/core/parser.cc index 0cee506..fcca2e1 100644 --- a/src/core/parser.cc +++ b/src/core/parser.cc @@ -13,11 +13,18 @@ namespace core { bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity) { + math::Vector3f v; + math::Color color; + std::string shapename; std::string strval; + float direction; float pitch; float roll; + + float f; + bool blnval; if (inifile.got_key_string("shape", shapename)) { @@ -42,34 +49,48 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity) } 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", strval)) { entity->set_modelname(strval); return true; + } else if (inifile.got_key_bool("showonmap", blnval)) { if (blnval) entity->set_flag(Entity::ShowOnMap); else entity->unset_flag(Entity::ShowOnMap); return true; + } else if (inifile.got_key_angle("direction", direction)) { - entity->axis().change_direction(direction); + entity->get_axis().change_direction(direction); return true; + } else if (inifile.got_key_angle("pitch", pitch)) { - entity->axis().change_pitch(pitch); + entity->get_axis().change_pitch(pitch); return true; + } else if (inifile.got_key_angle("roll", roll)) { - entity->axis().change_roll(roll); + entity->get_axis().change_roll(roll); return true; - } else if (inifile.got_key_angle("radius", entity->entity_radius)) { + + } else if (inifile.got_key_angle("radius", f)) { + entity->entity_radius = f; return true; - } else if (inifile.got_key_vector3f("location", entity->entity_location)) { + + } else if (inifile.got_key_vector3f("location", v)) { + entity->get_location().assign(v); return true; - } else if (inifile.got_key_color("colorsecond", entity->entity_color_second)) { + + } else if (inifile.got_key_color("colorsecond", color)) { + entity->get_color_second().assign(color); return true; - } else if (inifile.got_key_color("color", entity->entity_color)) { + + } else if (inifile.got_key_color("color", color)) { + entity->get_color().assign(color); return true; } -- cgit v1.2.3