diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-28 22:12:28 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-28 22:12:28 +0000 |
commit | fa45b822bb8cdcd3fb3654ee099bdeddd2290a5c (patch) | |
tree | c47a52b6218d6531b546bccb1cbdc6200af65a12 /src/game | |
parent | 2acd2ce9ba60cd8c1535760d174e821ce345843d (diff) |
label protection
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/game/game.cc b/src/game/game.cc index 5a937ca..e5b13d2 100644 --- a/src/game/game.cc +++ b/src/game/game.cc @@ -268,8 +268,7 @@ bool Game::load_world() } else if (worldini.section().compare("world") == 0 ) { if (worldini.got_key_string("zone", label)) { - aux::trim(label); - aux::to_lowercase(label); + aux::to_label(label); zone = new core::Zone(label); core::Zone::add(zone); } @@ -347,9 +346,11 @@ bool Game::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 (zoneini.got_key_string("label", star->entity_label)) + if (zoneini.got_key_string("label", strval)) { + aux::to_label(strval); + star->entity_label.assign(strval); continue; - else if (zoneini.got_key_string("name", star->entity_name)) + } else if (zoneini.got_key_string("name", star->entity_name)) continue; else if (zoneini.got_key_vector3f("location", star->entity_location )) continue; @@ -361,9 +362,11 @@ bool Game::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 (zoneini.got_key_string("label", planet->entity_label)) + if (zoneini.got_key_string("label", strval)) { + aux::to_label(strval); + planet->entity_label.assign(strval); continue; - else if (zoneini.got_key_string("name", planet->entity_name)) + } else if (zoneini.got_key_string("name", planet->entity_name)) continue; else if (zoneini.got_key_string("texture", planet->entity_texture)) continue; @@ -391,7 +394,9 @@ bool Game::load_zone(core::Zone *zone) con_warn << zoneini.name() << " unknown shape '" << shapename << "' at line " << zoneini.line() << std::endl; } continue; - } else if (zoneini.got_key_string("label", entity->entity_label)) { + } else if (zoneini.got_key_string("label", strval)) { + aux::to_label(strval); + entity->entity_label.assign(strval); continue; } else if (zoneini.got_key_string("name", entity->entity_name)) { continue; @@ -464,12 +469,15 @@ bool Game::load_ships() } ShipModel *shipmodel = 0; + std::string label; bool b; while (shipsini.getline()) { if (shipsini.got_key()) { if (shipsini.section().compare("ship") == 0) { - if (shipsini.got_key_string("label", shipmodel->shipmodel_label)) { + if (shipsini.got_key_string("label", label)) { + aux::to_label(label); + shipmodel->shipmodel_label.assign(label); ShipModel::add(shipmodel); continue; } else if (shipsini.got_key_string("name",shipmodel->shipmodel_name)) { |