Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-06-01 13:03:45 +0000
committerStijn Buys <ingar@osirion.org>2008-06-01 13:03:45 +0000
commit190cede795ac4c7fcd6865a6c2083b5ce53a154a (patch)
treef1d05ebec665b0fb66ef2448a81ab2ed718ee279 /src/game/game.cc
parent2a41efa0d43b573e1c8851086268b8a64d51c511 (diff)
entity and shipmodel labels, fixes sort order of shipmodels
Diffstat (limited to 'src/game/game.cc')
-rw-r--r--src/game/game.cc27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/game/game.cc b/src/game/game.cc
index 15ae029..6d85f0f 100644
--- a/src/game/game.cc
+++ b/src/game/game.cc
@@ -77,15 +77,15 @@ void func_buy(core::Player *player, std::string const &args)
aux::to_lowercase(shipname);
ShipModel *shipmodel = 0;
- for (std::list<ShipModel *>::iterator smit = ShipModel::registry.begin(); smit != ShipModel::registry.end(); smit++) {
- if (shipname == (*smit)->modelname()) {
- shipmodel = (*smit);
+ for (ShipModel::iterator smit = ShipModel::registry.begin(); smit != ShipModel::registry.end(); smit++) {
+ if (shipname == (*smit).first) {
+ shipmodel = (*smit).second;
break;
}
if (helpstr.size())
helpstr.append("^N|^B");
- helpstr.append((*smit)->modelname());
+ helpstr.append((*smit).second->label());
}
if (shipmodel) {
@@ -168,7 +168,9 @@ void Game::init()
while (worldini.getline()) {
if (worldini.got_key()) {
if (worldini.section().compare("star") == 0) {
- if (worldini.got_key_string("name", star->entity_name))
+ if (worldini.got_key_string("label", star->entity_label))
+ continue;
+ else if (worldini.got_key_string("name", star->entity_name))
continue;
else if (worldini.got_key_vector3f("location", star->entity_location ))
continue;
@@ -180,7 +182,9 @@ void Game::init()
con_warn << worldini.name() << " unknown key '" << worldini.key() << "' at line " << worldini.line() << std::endl;
} else if (worldini.section().compare("planet") == 0) {
- if (worldini.got_key_string("name", planet->entity_name))
+ if (worldini.got_key_string("label", planet->entity_label))
+ continue;
+ else if (worldini.got_key_string("name", planet->entity_name))
continue;
else if (worldini.got_key_string("texture", planet->entity_texture))
continue;
@@ -196,7 +200,6 @@ void Game::init()
} else if (worldini.section().compare("entity") == 0) {
std::string shapename;
-
if (worldini.got_key_string("shape", shapename)) {
if (shapename.compare("axis") == 0) {
entity->entity_shape = core::Entity::Axis;
@@ -210,7 +213,9 @@ void Game::init()
con_warn << worldini.name() << " unknown shape '" << shapename << "' at line " << worldini.line() << std::endl;
}
continue;
- } else if (worldini.got_key_string("name", entity->entity_name))
+ } else if (worldini.got_key_string("label", entity->entity_label))
+ continue;
+ else if (worldini.got_key_string("name", entity->entity_name))
continue;
else if (worldini.got_key_string("model", entity->entity_modelname))
continue;
@@ -265,8 +270,10 @@ void Game::init()
while (shipsini.getline()) {
if (shipsini.got_key()) {
if (shipsini.section().compare("ship") == 0) {
-
- if (shipsini.got_key_string("name",shipmodel->shipmodel_name)) {
+ if (shipsini.got_key_string("label", shipmodel->shipmodel_label)) {
+ ShipModel::add(shipmodel);
+ continue;
+ } else if (shipsini.got_key_string("name",shipmodel->shipmodel_name)) {
continue;
} else if (shipsini.got_key_string("model", shipmodel->shipmodel_modelname)) {
continue;