1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 05:15:33 +00:00

Rename variables called 'slots' to work around wrong code parsing in QT Creator.

This commit is contained in:
scrawl 2013-11-12 23:23:19 +01:00
parent 027f4152e4
commit 60bec03987
10 changed files with 53 additions and 53 deletions

View file

@ -94,7 +94,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref = MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>(); ptr.get<ESM::Armor>();
std::vector<int> slots; std::vector<int> slots_;
const int size = 11; const int size = 11;
@ -116,11 +116,11 @@ namespace MWClass
for (int i=0; i<size; ++i) for (int i=0; i<size; ++i)
if (sMapping[i][0]==ref->mBase->mData.mType) if (sMapping[i][0]==ref->mBase->mData.mType)
{ {
slots.push_back (int (sMapping[i][1])); slots_.push_back (int (sMapping[i][1]));
break; break;
} }
return std::make_pair (slots, false); return std::make_pair (slots_, false);
} }
int Armor::getEquipmentSkill (const MWWorld::Ptr& ptr) const int Armor::getEquipmentSkill (const MWWorld::Ptr& ptr) const
@ -288,12 +288,12 @@ namespace MWClass
MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc); MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc);
// slots that this item can be equipped in // slots that this item can be equipped in
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(ptr).getEquipmentSlots(ptr); std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace; std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace;
for (std::vector<int>::const_iterator slot=slots.first.begin(); for (std::vector<int>::const_iterator slot=slots_.first.begin();
slot!=slots.first.end(); ++slot) slot!=slots_.first.end(); ++slot)
{ {
// Beast races cannot equip shoes / boots, or full helms (head part vs hair part) // Beast races cannot equip shoes / boots, or full helms (head part vs hair part)

View file

@ -78,12 +78,12 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref = MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>(); ptr.get<ESM::Clothing>();
std::vector<int> slots; std::vector<int> slots_;
if (ref->mBase->mData.mType==ESM::Clothing::Ring) if (ref->mBase->mData.mType==ESM::Clothing::Ring)
{ {
slots.push_back (int (MWWorld::InventoryStore::Slot_LeftRing)); slots_.push_back (int (MWWorld::InventoryStore::Slot_LeftRing));
slots.push_back (int (MWWorld::InventoryStore::Slot_RightRing)); slots_.push_back (int (MWWorld::InventoryStore::Slot_RightRing));
} }
else else
{ {
@ -105,12 +105,12 @@ namespace MWClass
for (int i=0; i<size; ++i) for (int i=0; i<size; ++i)
if (sMapping[i][0]==ref->mBase->mData.mType) if (sMapping[i][0]==ref->mBase->mData.mType)
{ {
slots.push_back (int (sMapping[i][1])); slots_.push_back (int (sMapping[i][1]));
break; break;
} }
} }
return std::make_pair (slots, false); return std::make_pair (slots_, false);
} }
int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr) const int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr) const
@ -232,12 +232,12 @@ namespace MWClass
std::pair<int, std::string> Clothing::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const std::pair<int, std::string> Clothing::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
{ {
// slots that this item can be equipped in // slots that this item can be equipped in
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(ptr).getEquipmentSlots(ptr); std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace; std::string npcRace = npc.get<ESM::NPC>()->mBase->mRace;
for (std::vector<int>::const_iterator slot=slots.first.begin(); for (std::vector<int>::const_iterator slot=slots_.first.begin();
slot!=slots.first.end(); ++slot) slot!=slots_.first.end(); ++slot)
{ {
// Beast races cannot equip shoes / boots, or full helms (head part vs hair part) // Beast races cannot equip shoes / boots, or full helms (head part vs hair part)

View file

@ -121,12 +121,12 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref = MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>(); ptr.get<ESM::Light>();
std::vector<int> slots; std::vector<int> slots_;
if (ref->mBase->mData.mFlags & ESM::Light::Carry) if (ref->mBase->mData.mFlags & ESM::Light::Carry)
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedLeft)); slots_.push_back (int (MWWorld::InventoryStore::Slot_CarriedLeft));
return std::make_pair (slots, false); return std::make_pair (slots_, false);
} }
int Light::getValue (const MWWorld::Ptr& ptr) const int Light::getValue (const MWWorld::Ptr& ptr) const

View file

@ -74,11 +74,11 @@ namespace MWClass
std::pair<std::vector<int>, bool> Lockpick::getEquipmentSlots (const MWWorld::Ptr& ptr) const std::pair<std::vector<int>, bool> Lockpick::getEquipmentSlots (const MWWorld::Ptr& ptr) const
{ {
std::vector<int> slots; std::vector<int> slots_;
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight)); slots_.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight));
return std::make_pair (slots, false); return std::make_pair (slots_, false);
} }
int Lockpick::getValue (const MWWorld::Ptr& ptr) const int Lockpick::getValue (const MWWorld::Ptr& ptr) const

View file

@ -73,11 +73,11 @@ namespace MWClass
std::pair<std::vector<int>, bool> Probe::getEquipmentSlots (const MWWorld::Ptr& ptr) const std::pair<std::vector<int>, bool> Probe::getEquipmentSlots (const MWWorld::Ptr& ptr) const
{ {
std::vector<int> slots; std::vector<int> slots_;
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight)); slots_.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight));
return std::make_pair (slots, false); return std::make_pair (slots_, false);
} }
int Probe::getValue (const MWWorld::Ptr& ptr) const int Probe::getValue (const MWWorld::Ptr& ptr) const

View file

@ -100,23 +100,23 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref = MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>(); ptr.get<ESM::Weapon>();
std::vector<int> slots; std::vector<int> slots_;
bool stack = false; bool stack = false;
if (ref->mBase->mData.mType==ESM::Weapon::Arrow || ref->mBase->mData.mType==ESM::Weapon::Bolt) if (ref->mBase->mData.mType==ESM::Weapon::Arrow || ref->mBase->mData.mType==ESM::Weapon::Bolt)
{ {
slots.push_back (int (MWWorld::InventoryStore::Slot_Ammunition)); slots_.push_back (int (MWWorld::InventoryStore::Slot_Ammunition));
stack = true; stack = true;
} }
else if (ref->mBase->mData.mType==ESM::Weapon::MarksmanThrown) else if (ref->mBase->mData.mType==ESM::Weapon::MarksmanThrown)
{ {
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight)); slots_.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight));
stack = true; stack = true;
} }
else else
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight)); slots_.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight));
return std::make_pair (slots, stack); return std::make_pair (slots_, stack);
} }
int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr) const int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr) const
@ -384,11 +384,11 @@ namespace MWClass
std::pair<int, std::string> Weapon::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const std::pair<int, std::string> Weapon::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
{ {
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(ptr).getEquipmentSlots(ptr); std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
// equip the item in the first free slot // equip the item in the first free slot
for (std::vector<int>::const_iterator slot=slots.first.begin(); for (std::vector<int>::const_iterator slot=slots_.first.begin();
slot!=slots.first.end(); ++slot) slot!=slots_.first.end(); ++slot)
{ {
if(*slot == MWWorld::InventoryStore::Slot_CarriedRight) if(*slot == MWWorld::InventoryStore::Slot_CarriedRight)
{ {

View file

@ -110,9 +110,9 @@ namespace MWGui
allowSelectedItem = false; allowSelectedItem = false;
// if the selected item can be equipped, make sure that it actually is equipped // if the selected item can be equipped, make sure that it actually is equipped
std::pair<std::vector<int>, bool> slots; std::pair<std::vector<int>, bool> slots_;
slots = MWWorld::Class::get(selectedItem).getEquipmentSlots(selectedItem); slots_ = MWWorld::Class::get(selectedItem).getEquipmentSlots(selectedItem);
if (!slots.first.empty()) if (!slots_.first.empty())
{ {
bool equipped = false; bool equipped = false;
for (int i=0; i < MWWorld::InventoryStore::Slots; ++i) for (int i=0; i < MWWorld::InventoryStore::Slots; ++i)

View file

@ -40,7 +40,7 @@ namespace MWWorld
} }
// slots that this item can be equipped in // slots that this item can be equipped in
std::pair<std::vector<int>, bool> slots = MWWorld::Class::get(getTarget()).getEquipmentSlots(getTarget()); std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(getTarget()).getEquipmentSlots(getTarget());
// retrieve ContainerStoreIterator to the item // retrieve ContainerStoreIterator to the item
MWWorld::ContainerStoreIterator it = invStore.begin(); MWWorld::ContainerStoreIterator it = invStore.begin();
@ -57,12 +57,12 @@ namespace MWWorld
bool equipped = false; bool equipped = false;
// equip the item in the first free slot // equip the item in the first free slot
for (std::vector<int>::const_iterator slot=slots.first.begin(); for (std::vector<int>::const_iterator slot=slots_.first.begin();
slot!=slots.first.end(); ++slot) slot!=slots_.first.end(); ++slot)
{ {
// if all slots are occupied, replace the last slot // if all slots are occupied, replace the last slot
if (slot == --slots.first.end()) if (slot == --slots_.first.end())
{ {
invStore.equip(*slot, it, actor); invStore.equip(*slot, it, actor);
equipped = true; equipped = true;

View file

@ -33,10 +33,10 @@ void MWWorld::InventoryStore::copySlots (const InventoryStore& store)
} }
} }
void MWWorld::InventoryStore::initSlots (TSlots& slots) void MWWorld::InventoryStore::initSlots (TSlots& slots_)
{ {
for (int i=0; i<Slots; ++i) for (int i=0; i<Slots; ++i)
slots.push_back (end()); slots_.push_back (end());
} }
MWWorld::InventoryStore::InventoryStore() : mMagicEffectsUpToDate (false) MWWorld::InventoryStore::InventoryStore() : mMagicEffectsUpToDate (false)
@ -90,12 +90,12 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
if (iterator.getContainerStore()!=this) if (iterator.getContainerStore()!=this)
throw std::runtime_error ("attempt to equip an item that is not in the inventory"); throw std::runtime_error ("attempt to equip an item that is not in the inventory");
std::pair<std::vector<int>, bool> slots; std::pair<std::vector<int>, bool> slots_;
if (iterator!=end()) if (iterator!=end())
{ {
slots = Class::get (*iterator).getEquipmentSlots (*iterator); slots_ = Class::get (*iterator).getEquipmentSlots (*iterator);
if (std::find (slots.first.begin(), slots.first.end(), slot)==slots.first.end()) if (std::find (slots_.first.begin(), slots_.first.end(), slot)==slots_.first.end())
throw std::runtime_error ("invalid slot"); throw std::runtime_error ("invalid slot");
} }
@ -103,7 +103,7 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
unequipSlot(slot, actor); unequipSlot(slot, actor);
// unstack item pointed to by iterator if required // unstack item pointed to by iterator if required
if (iterator!=end() && !slots.second && iterator->getRefData().getCount() > 1) // if slots.second is true, item can stay stacked when equipped if (iterator!=end() && !slots_.second && iterator->getRefData().getCount() > 1) // if slots.second is true, item can stay stacked when equipped
{ {
// add the item again with a count of count-1, then set the count of the original (that will be equipped) to 1 // add the item again with a count of count-1, then set the count of the original (that will be equipped) to 1
int count = iterator->getRefData().getCount(); int count = iterator->getRefData().getCount();
@ -148,8 +148,8 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& npc)
const MWMechanics::NpcStats& stats = MWWorld::Class::get(npc).getNpcStats(npc); const MWMechanics::NpcStats& stats = MWWorld::Class::get(npc).getNpcStats(npc);
MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc); MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc);
TSlots slots; TSlots slots_;
initSlots (slots); initSlots (slots_);
// Disable model update during auto-equip // Disable model update during auto-equip
mActorModelUpdateEnabled = false; mActorModelUpdateEnabled = false;
@ -167,11 +167,11 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& npc)
{ {
bool use = false; bool use = false;
if (slots.at (*iter2)==end()) if (slots_.at (*iter2)==end())
use = true; // slot was empty before -> skip all further checks use = true; // slot was empty before -> skip all further checks
else else
{ {
Ptr old = *slots.at (*iter2); Ptr old = *slots_.at (*iter2);
if (!use) if (!use)
{ {
@ -229,15 +229,15 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& npc)
} }
} }
slots[*iter2] = iter; slots_[*iter2] = iter;
break; break;
} }
} }
bool changed = false; bool changed = false;
for (std::size_t i=0; i<slots.size(); ++i) for (std::size_t i=0; i<slots_.size(); ++i)
if (slots[i]!=mSlots[i]) if (slots_[i]!=mSlots[i])
{ {
changed = true; changed = true;
} }
@ -246,7 +246,7 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& npc)
if (changed) if (changed)
{ {
mSlots.swap (slots); mSlots.swap (slots_);
updateActorModel(npc); updateActorModel(npc);
flagAsModified(); flagAsModified();
} }

View file

@ -56,7 +56,7 @@ namespace MWWorld
void copySlots (const InventoryStore& store); void copySlots (const InventoryStore& store);
void initSlots (TSlots& slots); void initSlots (TSlots& slots_);
void updateActorModel (const Ptr& actor); void updateActorModel (const Ptr& actor);