diff options
Diffstat (limited to 'src/model/mapfile.cc')
-rw-r--r-- | src/model/mapfile.cc | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index aa0cb37..6bac44e 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -1274,12 +1274,37 @@ Model * MapFile::load(std::string const &name) // sound attributes if (mapfile.got_key_vector3f("origin", location)) { - tag_sound->get_location().assign(location * SCALE); + tag_sound->get_location().assign(location * SCALE); continue; - } else { + + } else if (mapfile.got_key_string("name", str)) { + // remove sounds/ prefix + if (str.substr(0, 7).compare("sounds/") == 0) + str.erase(0, 7); + // remove extension + if (str[str.size()-4] == '.') { + str.erase(str.size() - 4); + } + tag_sound->set_name(str); + continue; + + } else if (mapfile.got_key_string("noise", str)) { + // remove sounds/ prefix + if (str.substr(0, 7).compare("sounds/") == 0) + str.erase(0, 7); + // remove extension + if (str[str.size()-4] == '.') { + str.erase(str.size() - 4); + } + tag_sound->set_name(str); + continue; + + } else if (mapfile.got_key()) { mapfile.unknown_key(); + } + } else if (mapfile.got_classname("misc_model")) { // new submodel tag @@ -1316,8 +1341,13 @@ Model * MapFile::load(std::string const &name) } else { tag_submodel->set_scale(1.0f); } + + } else if (mapfile.got_key()) { + mapfile.unknown_key(); + } + } else if (mapfile.got_classname("location_dock")) { // new docking location |