From d8be908233fd7b85492d7a9e87f07bb207173990 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 25 Nov 2012 12:06:13 +0000 Subject: Moved core::EntityGlobe into a separate file, added various methods to core::Item and core::Slot, added r_slots cvar to draw entity slots and docks, added game methods for mounting and umounting of weapons, added playerlist to chat window. --- src/model/model.cc | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) (limited to 'src/model/model.cc') 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; } -- cgit v1.2.3