Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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