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

actorid
scrawl 11 years ago
parent 027f4152e4
commit 60bec03987

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

@ -78,12 +78,12 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
std::vector<int> slots;
std::vector<int> slots_;
if (ref->mBase->mData.mType==ESM::Clothing::Ring)
{
slots.push_back (int (MWWorld::InventoryStore::Slot_LeftRing));
slots.push_back (int (MWWorld::InventoryStore::Slot_RightRing));
slots_.push_back (int (MWWorld::InventoryStore::Slot_LeftRing));
slots_.push_back (int (MWWorld::InventoryStore::Slot_RightRing));
}
else
{
@ -105,12 +105,12 @@ namespace MWClass
for (int i=0; i<size; ++i)
if (sMapping[i][0]==ref->mBase->mData.mType)
{
slots.push_back (int (sMapping[i][1]));
slots_.push_back (int (sMapping[i][1]));
break;
}
}
return std::make_pair (slots, false);
return std::make_pair (slots_, false);
}
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
{
// 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;
for (std::vector<int>::const_iterator slot=slots.first.begin();
slot!=slots.first.end(); ++slot)
for (std::vector<int>::const_iterator slot=slots_.first.begin();
slot!=slots_.first.end(); ++slot)
{
// Beast races cannot equip shoes / boots, or full helms (head part vs hair part)

@ -121,12 +121,12 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
std::vector<int> slots;
std::vector<int> slots_;
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

@ -74,11 +74,11 @@ namespace MWClass
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

@ -73,11 +73,11 @@ namespace MWClass
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

@ -100,23 +100,23 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
std::vector<int> slots;
std::vector<int> slots_;
bool stack = false;
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;
}
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;
}
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
@ -384,11 +384,11 @@ namespace MWClass
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
for (std::vector<int>::const_iterator slot=slots.first.begin();
slot!=slots.first.end(); ++slot)
for (std::vector<int>::const_iterator slot=slots_.first.begin();
slot!=slots_.first.end(); ++slot)
{
if(*slot == MWWorld::InventoryStore::Slot_CarriedRight)
{

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

@ -40,7 +40,7 @@ namespace MWWorld
}
// 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
MWWorld::ContainerStoreIterator it = invStore.begin();
@ -57,12 +57,12 @@ namespace MWWorld
bool equipped = false;
// equip the item in the first free slot
for (std::vector<int>::const_iterator slot=slots.first.begin();
slot!=slots.first.end(); ++slot)
for (std::vector<int>::const_iterator slot=slots_.first.begin();
slot!=slots_.first.end(); ++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);
equipped = true;

@ -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)
slots.push_back (end());
slots_.push_back (end());
}
MWWorld::InventoryStore::InventoryStore() : mMagicEffectsUpToDate (false)
@ -90,12 +90,12 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
if (iterator.getContainerStore()!=this)
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())
{
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");
}
@ -103,7 +103,7 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
unequipSlot(slot, actor);
// 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
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);
MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc);
TSlots slots;
initSlots (slots);
TSlots slots_;
initSlots (slots_);
// Disable model update during auto-equip
mActorModelUpdateEnabled = false;
@ -167,11 +167,11 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& npc)
{
bool use = false;
if (slots.at (*iter2)==end())
if (slots_.at (*iter2)==end())
use = true; // slot was empty before -> skip all further checks
else
{
Ptr old = *slots.at (*iter2);
Ptr old = *slots_.at (*iter2);
if (!use)
{
@ -229,15 +229,15 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& npc)
}
}
slots[*iter2] = iter;
slots_[*iter2] = iter;
break;
}
}
bool changed = false;
for (std::size_t i=0; i<slots.size(); ++i)
if (slots[i]!=mSlots[i])
for (std::size_t i=0; i<slots_.size(); ++i)
if (slots_[i]!=mSlots[i])
{
changed = true;
}
@ -246,7 +246,7 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& npc)
if (changed)
{
mSlots.swap (slots);
mSlots.swap (slots_);
updateActorModel(npc);
flagAsModified();
}

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

Loading…
Cancel
Save