diff options
Diffstat (limited to 'src/game/base/shipmodel.cc')
-rw-r--r-- | src/game/base/shipmodel.cc | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc index 4c67e72..d9a9ed7 100644 --- a/src/game/base/shipmodel.cc +++ b/src/game/base/shipmodel.cc @@ -40,8 +40,12 @@ bool ShipModel::init() con_print << "^BLoading ships..." << std::endl; - size_t count = 0; + size_t shipmodel_count = 0; + size_t template_count = 0; + ShipModel *shipmodel = 0; + Template *entitytemplate = 0; + std::string str; long l; float f; @@ -49,11 +53,24 @@ bool ShipModel::init() while (inifile.getline()) { if (inifile.got_key()) { - if (inifile.section().compare("ship") == 0) { + + if (inifile.section().compare("template") == 0) { + + if (Template::got_template_key(inifile, entitytemplate)) { + continue; + } else { + inifile.unkown_key(); + } + + } else if (inifile.section().compare("ship") == 0) { + if (inifile.got_key_label("label", str)) { + if (find(str)) { + inifile.unknown_error("duplicate ship type '" + str + "'"); + } shipmodel->set_label(str); - count++; continue; + } else if (inifile.got_key_string("name", str)) { shipmodel->set_name(str); continue; @@ -110,6 +127,12 @@ bool ShipModel::init() inifile.unkown_key(); } } + + } else if (inifile.got_section("template")) { + + template_count++; + entitytemplate = new Template(); + } else if (inifile.got_section("ship")) { // generate info for the last loaded ship model @@ -124,6 +147,8 @@ bool ShipModel::init() if (!Default::shipmodel) { Default::shipmodel = shipmodel; } + + shipmodel_count++; } else if (inifile.got_section()) { inifile.unknown_section(); @@ -135,7 +160,9 @@ bool ShipModel::init() shipmodel->generate_info(); } - con_debug << " " << inifile.name() << " " << count << " ship types" << std::endl; + con_debug << " " << inifile.name() << " " << template_count << " entity templates" << std::endl; + con_debug << " " << inifile.name() << " " << shipmodel_count << " ship types" << std::endl; + inifile.close(); |