Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/model.cc')
-rw-r--r--src/model/model.cc50
1 files changed, 37 insertions, 13 deletions
diff --git a/src/model/model.cc b/src/model/model.cc
index f29350f..304e151 100644
--- a/src/model/model.cc
+++ b/src/model/model.cc
@@ -5,6 +5,7 @@
*/
#include "sys/sys.h"
+#include "auxiliary/functions.h"
#include "model/model.h"
#include "model/asefile.h"
#include "model/mapfile.h"
@@ -129,6 +130,10 @@ void Model::add_weapon(Weapon *weapon)
model_weapons.push_back(weapon);
}
+void Model::print() const
+{
+}
+
Model *Model::find(const std::string & name)
{
Registry::iterator it = model_registry.find(name);
@@ -138,6 +143,27 @@ Model *Model::find(const std::string & name)
return (*it).second;
}
+Model *Model::search(const std::string & searchname)
+{
+ std::string strsearchkey(aux::lowercase(searchname));
+ std::stringstream str(strsearchkey);
+
+ if (strsearchkey.size() < 3) {
+ return 0;
+ }
+
+ for (Registry::iterator it = model_registry.begin(); it != model_registry.end(); it++) {
+ std::string label((*it).first);
+ Model *model= (*it).second;
+
+ if (label.size() && (label.find(strsearchkey) != std::string::npos)) {
+ return model;
+ }
+ }
+
+ return 0;
+}
+
Model *Model::load(const std::string & name)
{
Model *model = find(name);
@@ -178,22 +204,20 @@ void Model::clear()
VertexArray::instance()->clear();
}
-void Model::list_model(Model *model)
-{
- size_t frags = 0;
- for (Groups::iterator git = model->groups().begin(); git != model->groups().end(); git++) {
- frags += (*git)->size();
- }
-
- con_print << " " << model->name() << " " << frags << " frags " <<
- model->model_tris_detail_count << "/" << model->model_tris_count << " detail/tris " <<
- model->model_quad_detail_count << "/" << model->model_quad_count << " detail/quads" << std::endl;
-}
-
void Model::list()
{
for (Registry::iterator mit = model_registry.begin(); mit != model_registry.end(); mit++) {
- list_model((*mit).second);
+ Model *model = (*mit).second;
+ size_t frags = 0;
+
+ for (Groups::iterator git = model->groups().begin(); git != model->groups().end(); git++) {
+ frags += (*git)->size();
+ }
+
+ con_print << " " << model->name() << " " << frags << " frags " <<
+ model->model_tris_detail_count << "/" << model->model_tris_count << " detail/tris " <<
+ model->model_quad_detail_count << "/" << model->model_quad_count << " detail/quads " <<
+ "radius " << model->radius() << std::endl;
}