diff options
author | Stijn Buys <ingar@osirion.org> | 2008-12-27 12:42:25 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-12-27 12:42:25 +0000 |
commit | af5c44f97acf333a3c24467f6ccc7a83aea4a2fb (patch) | |
tree | 7839b2fb879d8d380e7c50a981875daf9800e744 /src/model | |
parent | 64d5acb1ef4c9ffc870bdb9defd40864b5412235 (diff) |
improved map loader error messages
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/map.cc | 31 | ||||
-rw-r--r-- | src/model/map.h | 7 |
2 files changed, 29 insertions, 9 deletions
diff --git a/src/model/map.cc b/src/model/map.cc index 549abff..955410f 100644 --- a/src/model/map.cc +++ b/src/model/map.cc @@ -802,6 +802,21 @@ void Map::load_fragmentgroup(Model *model, const FragmentGroup::Type class_type) model->add_group(group); } +void Map::unknown_value() const +{ + con_warn << name() << " unknown value '" << value() << "' for '" << classname() << ":" << key() << "' at line " << line() << std::endl; +} + +void Map::unknown_key() const +{ + con_warn << name() << " unknown key '" << classname() << ":" << key() << "' at line " << line() << std::endl; +} + +void Map::unknown_class() const +{ + con_warn << name() << " unknown class '" << classname() << "' at line " << line() << std::endl; +} + Model * Map::load(std::string const &name) { // open the .map file @@ -849,7 +864,7 @@ Model * Map::load(std::string const &name) continue; } else if (mapfile.got_key()) { - con_warn "Unknown key " << mapfile.classname() << ":" << mapfile.key() << std::endl; + mapfile.unknown_key(); } @@ -899,7 +914,7 @@ Model * Map::load(std::string const &name) continue; } else if (mapfile.got_key()) { - con_warn "Unknown key " << mapfile.classname() << ":" << mapfile.key() << std::endl; + mapfile.unknown_key(); } } else if (mapfile.got_classend()) { @@ -944,7 +959,7 @@ Model * Map::load(std::string const &name) continue; } else if (mapfile.got_key()) { - con_warn "Unknown key " << mapfile.classname() << ":" << mapfile.key() << std::endl; + mapfile.unknown_key(); } @@ -969,7 +984,7 @@ Model * Map::load(std::string const &name) continue; } else if (mapfile.got_key()) { - con_warn "Unknown key " << mapfile.classname() << ":" << mapfile.key() << std::endl; + mapfile.unknown_key(); } @@ -1042,7 +1057,7 @@ Model * Map::load(std::string const &name) flare->flare_axis.change_roll(angle); } else if (mapfile.got_key()) { - con_warn "Unknown key " << mapfile.classname() << ":" << mapfile.key() << std::endl; + mapfile.unknown_key(); } } else if (mapfile.got_classname("fx_particles")) { @@ -1084,12 +1099,10 @@ Model * Map::load(std::string const &name) particles->particles_radius *= LIGHTSCALE; */ } else if (mapfile.got_key()) { - con_warn << "Unknown key " << mapfile.classname() << ":" << mapfile.key() << std::endl; + mapfile.unknown_key(); } - } else if (mapfile.got_classname()) { - - con_warn << "Unkown class " << mapfile.classname() << std::endl; + mapfile.unknown_class(); } } diff --git a/src/model/map.h b/src/model/map.h index 86bada6..b46be7c 100644 --- a/src/model/map.h +++ b/src/model/map.h @@ -142,9 +142,16 @@ private: /// clear class bounding box void clear_bbox(); + + void unknown_class() const; + + void unknown_key() const; + + void unknown_value() const; /// list of planes for the current brush std::vector<Plane *> planes; + std::string classname_current; std::string key_current; |