Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base')
-rw-r--r--src/game/base/shipmodel.cc7
-rw-r--r--src/game/base/template.cc43
-rw-r--r--src/game/base/template.h8
3 files changed, 42 insertions, 16 deletions
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc
index 7d54ee2..b0f29ef 100644
--- a/src/game/base/shipmodel.cc
+++ b/src/game/base/shipmodel.cc
@@ -138,10 +138,15 @@ bool ShipModel::init()
if (!entitytemplate) {
inifile.unknown_error("unkown template '" + str + "'");
} else {
+ // apply the template settings to the shipmodel
shipmodel->set_template(entitytemplate);
if (entitytemplate->radius()) {
shipmodel->set_radius(entitytemplate->radius());
}
+
+ if (entitytemplate->maxarmor()) {
+ shipmodel->set_maxarmor(entitytemplate->maxarmor());
+ }
}
} else {
inifile.unknown_key();
@@ -410,7 +415,7 @@ void ShipModel::apply(Ship *ship) const
ship->set_strafe_force(strafe_force());
ship->set_turn_force(turn_force());
ship->set_roll_force(roll_force());
- ship->set_jumpdrive(jumpdrive());
+ ship->set_jumpdrive(jumpdrive());
ship->set_maxarmor(maxarmor());
}
diff --git a/src/game/base/template.cc b/src/game/base/template.cc
index a2bf66c..03adc20 100644
--- a/src/game/base/template.cc
+++ b/src/game/base/template.cc
@@ -62,6 +62,9 @@ void Template::print() const {
// set secondary color
if (has_color_second())
con_print << " primary color " << color_second() << std::endl;
+
+ if (maxarmor())
+ con_print << " armor " << maxarmor() << std::endl;
}
void Template::list()
@@ -105,6 +108,11 @@ bool Template::got_template_key(filesystem::IniFile &inifile, Template *entityte
} else if (inifile.got_key_float("radius", floatvalue)) {
entitytemplate->set_radius(floatvalue);
return true;
+
+ } else if (inifile.got_key_float("armor", floatvalue)) {
+ entitytemplate->set_maxarmor(floatvalue);
+ return true;
+
} else {
return false;
}
@@ -215,6 +223,7 @@ Template::Template() :
template_radius = 0;
template_has_color = false;
template_has_color_second = false;
+ template_maxarmor = 0;
}
Template::~Template()
@@ -238,23 +247,27 @@ void Template::set_color_second(const math::Color &color_second)
template_has_color_second = true;
}
+void Template::set_maxarmor(const float maxarmor)
+{
+ template_maxarmor = maxarmor;
+}
void Template::apply(core::Entity *entity) const
{
- // set radius
- if (radius())
- entity->set_radius(radius());
-
- // set modelname
- if (modelname().size())
- entity->set_modelname(modelname());
-
- // set primary color
- if (has_color())
- entity->set_color(color());
-
- // set secondary color
- if (has_color_second())
- entity->set_color_second(color_second());
+ // set radius
+ if (radius())
+ entity->set_radius(radius());
+
+ // set modelname
+ if (modelname().size())
+ entity->set_modelname(modelname());
+
+ // set primary color
+ if (has_color())
+ entity->set_color(color());
+
+ // set secondary color
+ if (has_color_second())
+ entity->set_color_second(color_second());
}
} // namespace game
diff --git a/src/game/base/template.h b/src/game/base/template.h
index a89a092..1ae04ab 100644
--- a/src/game/base/template.h
+++ b/src/game/base/template.h
@@ -28,6 +28,10 @@ public:
return template_radius;
}
+ inline const float maxarmor() const {
+ return template_maxarmor;
+ }
+
inline const bool has_color() const {
return template_has_color;
}
@@ -67,6 +71,8 @@ protected:
void set_color(const math::Color &color);
void set_color_second(const math::Color &color_second);
+
+ void set_maxarmor(const float maxarmor);
public:
/* --- static ----------------------------------------------------- */
@@ -91,6 +97,8 @@ private:
math::Color template_color_second;
bool template_has_color_second;
+ float template_maxarmor;
+
/* --- static ----------------------------------------------------- */
static core::InfoType *template_infotype;