diff options
author | Stijn Buys <ingar@osirion.org> | 2014-12-07 16:12:49 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2014-12-07 16:12:49 +0000 |
commit | 2c98d3eef488233b99a76ca44d69c1c9d53404af (patch) | |
tree | 9259bad9533d1de7381b291eee19fd319b8366eb /src/core/slots.cc | |
parent | acb236d0df275394095ab43e8519aebc4811865d (diff) |
Cleanup of the slots code, unified model weapon and dock tags into a single slots list,
load dock tags into entity slots, represent entity slot locations in entity coordinate space,
have r_slots render fixed-size slot indicators regardless of model scale.
Diffstat (limited to 'src/core/slots.cc')
-rw-r--r-- | src/core/slots.cc | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/core/slots.cc b/src/core/slots.cc index 6d6096a..23fb7e1 100644 --- a/src/core/slots.cc +++ b/src/core/slots.cc @@ -19,12 +19,25 @@ Slots::~Slots() clear(); } -void Slots::load(model::Model *model) +void Slots::load(model::Model *model, const float modelscale) { - for (model::Model::Weapons::iterator it = model->weapons().begin(); it != model->weapons().end(); ++it) { - Slot *slot = new Slot(); - slot->load((*it)); - slots_container.push_back(slot); + for (model::Model::Slots::const_iterator slit = model->slots().begin(); slit != model->slots().end(); ++slit) { + + const model::Slot *tag_slot = (*slit); + Slot *slot = 0; + + switch (tag_slot->type()) { + case model::Slot::Cannon: + case model::Slot::Turret: + case model::Slot::Dock: + slot = new Slot(); + slot->load(tag_slot, modelscale); + slots_container.push_back(slot); + break; + + case model::Slot::None: + break; + } } //con_debug << " loaded " << slots_container.size() << " entity slots" << std::endl; } |