Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-10-02 16:10:43 +0000
committerStijn Buys <ingar@osirion.org>2011-10-02 16:10:43 +0000
commit84eab812554d55f57f592d9af54c8c4b9b98a651 (patch)
tree0f413f3dfa3126b0d01f11fdd45a0cee104c97db /src/game/base
parent5ab99153e883e203d6f8f60e441948d0b0bd3149 (diff)
Added a print() method to list individual templates through the list_template command.
Diffstat (limited to 'src/game/base')
-rw-r--r--src/game/base/template.cc35
-rw-r--r--src/game/base/template.h2
2 files changed, 36 insertions, 1 deletions
diff --git a/src/game/base/template.cc b/src/game/base/template.cc
index 7ef4106..fd04402 100644
--- a/src/game/base/template.cc
+++ b/src/game/base/template.cc
@@ -17,7 +17,21 @@ core::InfoType *Template::template_infotype = 0;
void func_list_template(const std::string &args)
{
- Template::list();
+ std::stringstream argstr(args);
+ std::string label;
+ if (argstr >> label) {
+ aux::to_label(label);
+ Template *entitytemplate = Template::find(label);
+ if (entitytemplate) {
+ entitytemplate->print();
+
+ } else {
+ con_warn << "Unknown template '" << label << "'" << std::endl;
+ return;
+ }
+ } else {
+ Template::list();
+ }
}
Template *Template::find(const std::string & label)
@@ -29,6 +43,25 @@ Template *Template::find(const std::string & label)
}
}
+void Template::print() const {
+ con_print << "Template '" << label() << "' info id " << id() << std::endl;
+ // show radius if set
+ if (radius())
+ con_print << " radius " << radius() << std::endl;
+
+ // set modelname
+ if (modelname().size())
+ con_print << " model " << modelname() << std::endl;
+
+ // set primary color
+ if (has_color())
+ con_print << " primary color " << color() << std::endl;
+
+ // set secondary color
+ if (has_color_second())
+ con_print << " primary color " << color_second() << std::endl;
+}
+
void Template::list()
{
core::Info::list(template_infotype);
diff --git a/src/game/base/template.h b/src/game/base/template.h
index 7934a7f..a89a092 100644
--- a/src/game/base/template.h
+++ b/src/game/base/template.h
@@ -44,6 +44,8 @@ public:
return template_color_second;
}
+ virtual void print() const;
+
/* --- actors ----------------------------------------------------- */
/**