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>2012-04-22 19:48:27 +0000
committerStijn Buys <ingar@osirion.org>2012-04-22 19:48:27 +0000
commit8f124fabdfd6761cefbcc2c4120ba325692f5d0b (patch)
tree21d38bdc6088654802d736dcb905429c42bd591a /src/core/slots.cc
parentd1931b1ebbe79cbd0f41290acbf9cb6d4c462878 (diff)
Initial support for per-entity weapon slots.
Diffstat (limited to 'src/core/slots.cc')
-rw-r--r--src/core/slots.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/core/slots.cc b/src/core/slots.cc
index 6ef1d29..afbc29f 100644
--- a/src/core/slots.cc
+++ b/src/core/slots.cc
@@ -4,6 +4,7 @@
the terms of the GNU General Public License version 2.
*/
+#include "sys/sys.h"
#include "core/slots.h"
namespace core
@@ -15,6 +16,27 @@ Slots::Slots()
Slots::~Slots()
{
+ clear();
+}
+
+void Slots::load(model::Model *model)
+{
+ for (model::Model::Weapons::iterator it = model->weapons().begin(); it != model->weapons().end(); ++it) {
+ Slot *slot = new Slot((*it)->location());
+ slots_container.push_back(slot);
+ }
+ con_debug << " loaded " << slots_container.size() << " entity slots" << std::endl;
+}
+
+void Slots::clear()
+{
+ for (iterator it = slots_container.begin(); it != slots_container.end(); ++it)
+ {
+ Slot *slot = (*it);
+ delete slot;
+ (*it) = 0;
+ }
+ slots_container.clear();
}
} // namespace core