diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index a949cf6996..82e16bcfc8 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -169,7 +169,7 @@ namespace MWClass ++sound) { if (type == sound->mType && !sound->mCreature.empty() - && (ESM::RefId::ciEqual(*creatureId, sound->mCreature))) + && (*creatureId == sound->mCreature)) sounds.push_back(&*sound); if (type == sound->mType && sound->mCreature.empty()) fallbacksounds.push_back(&*sound); diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index 8ec988c52c..94ea269e5f 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -284,7 +284,7 @@ namespace MWClass const MWWorld::LiveCellRef* ref = ptr.get(); ESM::Armor newItem = *ref->mBase; - newItem.mId.clear(); + newItem.mId = ESM::RefId::sEmpty; newItem.mName = newName; newItem.mData.mEnchant = enchCharge; newItem.mEnchant = enchId; diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index d64aa748d1..55d5d29485 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -146,7 +146,7 @@ namespace MWClass const MWWorld::LiveCellRef* ref = ptr.get(); ESM::Book newItem = *ref->mBase; - newItem.mId.clear(); + newItem.mId = ESM::RefId::sEmpty; newItem.mName = newName; newItem.mData.mIsScroll = 1; newItem.mData.mEnchant = enchCharge; diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index c561db2c59..0a19ba6bec 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -192,7 +192,7 @@ namespace MWClass const MWWorld::LiveCellRef* ref = ptr.get(); ESM::Clothing newItem = *ref->mBase; - newItem.mId.clear(); + newItem.mId = ESM::RefId::sEmpty; newItem.mName = newName; newItem.mData.mEnchant = enchCharge; newItem.mEnchant = enchId; diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index 207ef634dc..825ca75213 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -266,7 +266,7 @@ namespace MWClass { text += MWGui::ToolTips::getCellRefString(ptr.getCellRef()); text += MWGui::ToolTips::getMiscString(ref->mBase->mScript.getRefIdString(), "Script"); - if (ESM::RefId::ciEqual(ptr.getCellRef().getRefId(), ESM::RefId::stringRefId("stolen_goods"))) + if (ptr.getCellRef().getRefId() == ESM::RefId::stringRefId("stolen_goods")) text += "\nYou can not use evidence chests"; } diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index d6f0e1659a..beecc2c8b2 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -649,7 +649,7 @@ namespace MWClass while (sound != store.get().end()) { if (type == sound->mType && !sound->mCreature.empty() - && ESM::RefId::ciEqual(ourId, sound->mCreature)) + && ourId == sound->mCreature) sounds.push_back(&*sound); if (type == sound->mType && sound->mCreature.empty()) fallbacksounds.push_back(&*sound); @@ -673,7 +673,7 @@ namespace MWClass while (sound != store.get().end()) { if (type == sound->mType && !sound->mCreature.empty() - && ESM::RefId::ciEqual(fallbackId, sound->mCreature)) + && fallbackId == sound->mCreature) sounds.push_back(&*sound); ++sound; } diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index df63b5c40d..702a9947a0 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -35,11 +35,11 @@ namespace MWClass bool Miscellaneous::isGold(const MWWorld::ConstPtr& ptr) const { - return ESM::RefId::ciEqual(ptr.getCellRef().getRefId(), ESM::RefId::stringRefId("gold_001")) - || ESM::RefId::ciEqual(ptr.getCellRef().getRefId(), ESM::RefId::stringRefId("gold_005")) - || ESM::RefId::ciEqual(ptr.getCellRef().getRefId(), ESM::RefId::stringRefId("gold_010")) - || ESM::RefId::ciEqual(ptr.getCellRef().getRefId(), ESM::RefId::stringRefId("gold_025")) - || ESM::RefId::ciEqual(ptr.getCellRef().getRefId(), ESM::RefId::stringRefId("gold_100")); + return ptr.getCellRef().getRefId() == ESM::RefId::stringRefId("gold_001") + || ptr.getCellRef().getRefId() == ESM::RefId::stringRefId("gold_005") + || ptr.getCellRef().getRefId() == ESM::RefId::stringRefId("gold_010") + || ptr.getCellRef().getRefId() == ESM::RefId::stringRefId("gold_025") + || ptr.getCellRef().getRefId() == ESM::RefId::stringRefId("gold_100"); } void Miscellaneous::insertObjectRendering( @@ -97,7 +97,7 @@ namespace MWClass float soulValue = 0.0001 * pow(soul, 3) + 2 * soul; // for Azura's star add the unfilled value - if (ESM::RefId::ciEqual(ptr.getCellRef().getRefId(), ESM::RefId::stringRefId("Misc_SoulGem_Azura"))) + if (ptr.getCellRef().getRefId() == ESM::RefId::stringRefId("Misc_SoulGem_Azura")) value += soulValue; else value = soulValue; diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 2c3c1db32f..832751adef 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -264,7 +264,7 @@ namespace MWClass const MWWorld::LiveCellRef* ref = ptr.get(); ESM::Weapon newItem = *ref->mBase; - newItem.mId.clear(); + newItem.mId = ESM::RefId::sEmpty; newItem.mName = newName; newItem.mData.mEnchant = enchCharge; newItem.mEnchant = enchId; diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 3e6dbf3c0c..2b2afcbcf2 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -138,7 +138,7 @@ namespace MWDialogue if (actor.getClass().getCreatureStats(actor).isDead()) return false; - mLastTopic.clear(); + mLastTopic = ESM::RefId::sEmpty; // Note that we intentionally don't reset mPermanentDispositionChange mChoice = -1; @@ -375,7 +375,7 @@ namespace MWDialogue if (!inJournal(topicId, answer->mId)) { // Does this dialogue contains some actor-specific answer? - if (ESM::RefId::ciEqual(answer->mActor, mActor.getCellRef().getRefId())) + if (answer->mActor == mActor.getCellRef().getRefId()) topicFlags |= MWBase::DialogueManager::TopicType::Specific; } else @@ -744,7 +744,7 @@ namespace MWDialogue auto it = faction->mReactions.begin(); for (; it != faction->mReactions.end(); ++it) { - if (ESM::RefId::ciEqual(it->first, faction2)) + if (it->first == faction2) return it->second; } return 0; diff --git a/apps/openmw/mwdialogue/filter.cpp b/apps/openmw/mwdialogue/filter.cpp index b2e2b723fc..df04e6b30f 100644 --- a/apps/openmw/mwdialogue/filter.cpp +++ b/apps/openmw/mwdialogue/filter.cpp @@ -84,7 +84,7 @@ bool MWDialogue::Filter::testActor(const ESM::DialInfo& info) const // actor id if (!info.mActor.empty()) { - if (!ESM::RefId::ciEqual(info.mActor, mActor.getCellRef().getRefId())) + if (!(info.mActor == mActor.getCellRef().getRefId())) return false; } else if (isCreature) @@ -101,7 +101,7 @@ bool MWDialogue::Filter::testActor(const ESM::DialInfo& info) const MWWorld::LiveCellRef* cellRef = mActor.get(); - if (!ESM::RefId::ciEqual(info.mRace, cellRef->mBase->mRace)) + if (!(info.mRace == cellRef->mBase->mRace)) return false; } @@ -113,7 +113,7 @@ bool MWDialogue::Filter::testActor(const ESM::DialInfo& info) const MWWorld::LiveCellRef* cellRef = mActor.get(); - if (!ESM::RefId::ciEqual(info.mClass, cellRef->mBase->mClass)) + if (!(info.mClass == cellRef->mBase->mClass)) return false; } @@ -131,7 +131,7 @@ bool MWDialogue::Filter::testActor(const ESM::DialInfo& info) const if (isCreature) return true; - if (!ESM::RefId::ciEqual(mActor.getClass().getPrimaryFaction(mActor), info.mFaction)) + if (!(mActor.getClass().getPrimaryFaction(mActor) == info.mFaction)) return false; // check rank @@ -536,19 +536,19 @@ bool MWDialogue::Filter::getSelectStructBoolean(const SelectWrapper& select) con case SelectWrapper::Function_NotId: - return !ESM::RefId::ciEqual(mActor.getCellRef().getRefId(), ESM::RefId::stringRefId(select.getName())); + return !(mActor.getCellRef().getRefId() == ESM::RefId::stringRefId(select.getName())); case SelectWrapper::Function_NotFaction: - return !ESM::RefId::ciEqual(mActor.getClass().getPrimaryFaction(mActor), ESM::RefId::stringRefId(select.getName())); + return !(mActor.getClass().getPrimaryFaction(mActor) == ESM::RefId::stringRefId(select.getName())); case SelectWrapper::Function_NotClass: - return !ESM::RefId::ciEqual(mActor.get()->mBase->mClass, ESM::RefId::stringRefId(select.getName())); + return !(mActor.get()->mBase->mClass == ESM::RefId::stringRefId(select.getName())); case SelectWrapper::Function_NotRace: - return !ESM::RefId::ciEqual(mActor.get()->mBase->mRace, ESM::RefId::stringRefId(select.getName())); + return !(mActor.get()->mBase->mRace == ESM::RefId::stringRefId(select.getName())); case SelectWrapper::Function_NotCell: { @@ -562,8 +562,7 @@ bool MWDialogue::Filter::getSelectStructBoolean(const SelectWrapper& select) con case SelectWrapper::Function_SameRace: - return ESM::RefId::ciEqual( - mActor.get()->mBase->mRace, player.get()->mBase->mRace); + return mActor.get()->mBase->mRace == player.get()->mBase->mRace; case SelectWrapper::Function_SameFaction: diff --git a/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp index 3212b42ecc..2620307806 100644 --- a/apps/openmw/mwgui/birth.cpp +++ b/apps/openmw/mwgui/birth.cpp @@ -96,7 +96,7 @@ namespace MWGui size_t count = mBirthList->getItemCount(); for (size_t i = 0; i < count; ++i) { - if (ESM::RefId::ciEqual(ESM::RefId::stringRefId(*mBirthList->getItemDataAt(i)), birthId)) + if (ESM::RefId::stringRefId(*mBirthList->getItemDataAt(i)) == birthId) { mBirthList->setIndexSelected(i); break; @@ -134,7 +134,7 @@ namespace MWGui return; const ESM::RefId birthId = ESM::RefId::stringRefId(*mBirthList->getItemDataAt(_index)); - if (ESM::RefId::ciEqual(mCurrentBirthId, birthId)) + if (mCurrentBirthId == birthId) return; mCurrentBirthId = birthId; @@ -168,7 +168,7 @@ namespace MWGui mBirthList->setIndexSelected(index); mCurrentBirthId = birthsignPair.first; } - else if (ESM::RefId::ciEqual(birthsignPair.first, mCurrentBirthId)) + else if (birthsignPair.first == mCurrentBirthId) { mBirthList->setIndexSelected(index); } diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index af0cbbdfa1..3b24c10b12 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -248,7 +248,7 @@ namespace MWGui break; case GM_ClassGenerate: mGenerateClassStep = 0; - mGenerateClass.clear(); + mGenerateClass = ESM::RefId::sEmpty; mGenerateClassSpecializations[0] = 0; mGenerateClassSpecializations[1] = 0; mGenerateClassSpecializations[2] = 0; diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index 3a3fafdbe1..94bf43948e 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -157,7 +157,7 @@ namespace MWGui size_t count = mClassList->getItemCount(); for (size_t i = 0; i < count; ++i) { - if (ESM::RefId::ciEqual(*mClassList->getItemDataAt(i), classId)) + if (*mClassList->getItemDataAt(i) == classId) { mClassList->setIndexSelected(i); break; @@ -195,7 +195,7 @@ namespace MWGui return; const ESM::RefId* classId = mClassList->getItemDataAt(_index); - if (ESM::RefId::ciEqual(mCurrentClassId, *classId)) + if (mCurrentClassId == *classId) return; mCurrentClassId = *classId; @@ -234,7 +234,7 @@ namespace MWGui mCurrentClassId = id; mClassList->setIndexSelected(index); } - else if (ESM::RefId::ciEqual(id, mCurrentClassId)) + else if (id == mCurrentClassId) { mClassList->setIndexSelected(index); } diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index d939f46ff7..0291fe5004 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -805,7 +805,7 @@ namespace MWGui // skip different stacks of the same item, or we will get stuck as stacking/unstacking them may change their // relative ordering - if (ESM::RefId::ciEqual(lastId, item.getCellRef().getRefId())) + if (lastId == item.getCellRef().getRefId()) continue; lastId = item.getCellRef().getRefId(); diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 506191b18e..f60d3afba5 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -422,7 +422,7 @@ namespace intptr_t topicId = 0; /// \todo get rid of intptr ids for (MWBase::Journal::TTopicIter i = journal->topicBegin(); i != journal->topicEnd(); ++i) { - if (ESM::RefId::ciEqual(i->first, topic)) + if (i->first == topic) topicId = intptr_t(&i->second); } diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index f7f061b652..7876013e64 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -144,7 +144,7 @@ namespace MWGui else { key->type = Type_Unassigned; - key->id.clear(); + key->id = ESM::RefId::sEmpty; key->name.clear(); MyGUI::TextBox* textBox = key->button->createWidgetReal( diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index de4617f449..ad227e9f5c 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -165,13 +165,13 @@ namespace MWGui for (unsigned int i = 0; i < mAvailableHeads.size(); ++i) { - if (ESM::RefId::ciEqual(mAvailableHeads[i], proto.mHead)) + if (mAvailableHeads[i] == proto.mHead) mFaceIndex = i; } for (unsigned int i = 0; i < mAvailableHairs.size(); ++i) { - if (ESM::RefId::ciEqual(mAvailableHairs[i], proto.mHair)) + if (mAvailableHairs[i] == proto.mHair) mHairIndex = i; } @@ -191,7 +191,7 @@ namespace MWGui size_t count = mRaceList->getItemCount(); for (size_t i = 0; i < count; ++i) { - if (ESM::RefId::ciEqual(ESM::RefId::stringRefId(*mRaceList->getItemDataAt(i)), raceId)) + if (ESM::RefId::stringRefId(*mRaceList->getItemDataAt(i)) == raceId) { mRaceList->setIndexSelected(i); break; @@ -293,7 +293,7 @@ namespace MWGui return; ESM::RefId raceId = ESM::RefId::stringRefId(*mRaceList->getItemDataAt(_index)); - if (ESM::RefId::ciEqual(mCurrentRaceId, raceId)) + if (mCurrentRaceId == raceId) return; mCurrentRaceId = raceId; @@ -334,7 +334,7 @@ namespace MWGui && idString[idString.size() - 2] == 's' && idString[idString.size() - 1] == 't'; if (firstPerson) continue; - if (ESM::RefId::ciEqual(bodypart.mRace, mCurrentRaceId)) + if (bodypart.mRace == mCurrentRaceId) out.push_back(bodypart.mId); } } @@ -393,7 +393,7 @@ namespace MWGui for (auto& item : items) { mRaceList->addItem(item.second, item.first); - if (ESM::RefId::ciEqual(item.first, mCurrentRaceId)) + if (item.first == mCurrentRaceId) mRaceList->setIndexSelected(index); ++index; } diff --git a/apps/openmw/mwgui/tradeitemmodel.cpp b/apps/openmw/mwgui/tradeitemmodel.cpp index e68e660f79..b89b60aca6 100644 --- a/apps/openmw/mwgui/tradeitemmodel.cpp +++ b/apps/openmw/mwgui/tradeitemmodel.cpp @@ -166,7 +166,7 @@ namespace MWGui if (!mMerchant.isEmpty()) { MWWorld::Ptr base = item.mBase; - if (ESM::RefId::ciEqual(base.getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId)) + if (base.getCellRef().getRefId() == MWWorld::ContainerStore::sGoldId) continue; if (!base.getClass().showsInInventory(base)) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index d3cc605509..620a1c3cf6 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1344,7 +1344,7 @@ namespace MWGui void WindowManager::setSelectedEnchantItem(const MWWorld::Ptr& item) { mSelectedEnchantItem = item; - mSelectedSpell.clear(); + mSelectedSpell = ESM::RefId::sEmpty; const ESM::Enchantment* ench = mStore->get().find(item.getClass().getEnchantment(item)); int chargePercent @@ -1377,7 +1377,7 @@ namespace MWGui void WindowManager::unsetSelectedSpell() { - mSelectedSpell.clear(); + mSelectedSpell = ESM::RefId::sEmpty; mSelectedEnchantItem = MWWorld::Ptr(); mHud->unsetSelectedSpell(); @@ -1770,7 +1770,7 @@ namespace MWGui mToolTips->clear(); - mSelectedSpell.clear(); + mSelectedSpell = ESM::RefId::sEmpty; mCustomMarkers.clear(); mForceHidden = GW_None; diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index 230da2ef69..5ec928f0ff 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -419,7 +419,7 @@ namespace MWMechanics bool ActiveSpells::isSpellActive(const ESM::RefId& id) const { return std::find_if(mSpells.begin(), mSpells.end(), [&](const auto& spell) { - return ESM::RefId::ciEqual(spell.mId, id); + return spell.mId == id; }) != mSpells.end(); } diff --git a/apps/openmw/mwmechanics/alchemy.cpp b/apps/openmw/mwmechanics/alchemy.cpp index 4f9c5b20ae..98769884a2 100644 --- a/apps/openmw/mwmechanics/alchemy.cpp +++ b/apps/openmw/mwmechanics/alchemy.cpp @@ -449,7 +449,7 @@ int MWMechanics::Alchemy::addIngredient(const MWWorld::Ptr& ingredient) for (TIngredientsIterator iter(mIngredients.begin()); iter != mIngredients.end(); ++iter) if (!iter->isEmpty() - && ESM::RefId::ciEqual(ingredient.getCellRef().getRefId(), iter->getCellRef().getRefId())) + && ingredient.getCellRef().getRefId() == iter->getCellRef().getRefId()) return -1; mIngredients[slot] = ingredient; diff --git a/apps/openmw/mwmechanics/autocalcspell.cpp b/apps/openmw/mwmechanics/autocalcspell.cpp index ec386c0add..b4c0480cc2 100644 --- a/apps/openmw/mwmechanics/autocalcspell.cpp +++ b/apps/openmw/mwmechanics/autocalcspell.cpp @@ -56,7 +56,7 @@ namespace MWMechanics caps.mLimit = iAutoSpellSchoolMax[i]; caps.mReachedLimit = iAutoSpellSchoolMax[i] <= 0; caps.mMinCost = std::numeric_limits::max(); - caps.mWeakestSpell.clear(); + caps.mWeakestSpell = ESM::RefId::sEmpty; schoolCaps[i] = caps; } diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index bb1c09accb..2b4ccc34bd 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -371,7 +371,7 @@ namespace MWMechanics void CreatureStats::clearLastHitObject() { - mLastHitObject.clear(); + mLastHitObject = ESM::RefId::sEmpty; } const ESM::RefId& CreatureStats::getLastHitObject() const @@ -386,7 +386,7 @@ namespace MWMechanics void CreatureStats::clearLastHitAttemptObject() { - mLastHitAttemptObject.clear(); + mLastHitAttemptObject = ESM::RefId::sEmpty; } const ESM::RefId& CreatureStats::getLastHitAttemptObject() const diff --git a/apps/openmw/mwmechanics/enchanting.cpp b/apps/openmw/mwmechanics/enchanting.cpp index 798b66e235..bd7024b5af 100644 --- a/apps/openmw/mwmechanics/enchanting.cpp +++ b/apps/openmw/mwmechanics/enchanting.cpp @@ -74,7 +74,7 @@ namespace MWMechanics // Exception for Azura Star, new one will be added after enchanting auto azurasStarId = ESM::RefId::stringRefId("Misc_SoulGem_Azura"); - if (ESM::RefId::ciEqual(mSoulGemPtr.get()->mBase->mId, azurasStarId)) + if (mSoulGemPtr.get()->mBase->mId == azurasStarId) store.add(azurasStarId, 1, player); if (mSelfEnchanting) diff --git a/apps/openmw/mwmechanics/inventory.hpp b/apps/openmw/mwmechanics/inventory.hpp index 178eb6d54a..b26d40f301 100644 --- a/apps/openmw/mwmechanics/inventory.hpp +++ b/apps/openmw/mwmechanics/inventory.hpp @@ -20,7 +20,7 @@ namespace MWMechanics T copy = *MWBase::Environment::get().getWorld()->getStore().get().find(actorId); for (auto& it : copy.mInventory.mList) { - if (ESM::RefId::ciEqual(it.mItem, itemId)) + if (it.mItem == itemId) { const int sign = it.mCount < 1 ? -1 : 1; it.mCount = sign * std::max(it.mCount * sign + amount, 0); diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index ea12a2af93..0a3f1b7a69 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -513,7 +513,7 @@ namespace MWMechanics const MWWorld::Store& gmst = MWBase::Environment::get().getWorld()->getStore().get(); static const float fDispRaceMod = gmst.find("fDispRaceMod")->mValue.getFloat(); - if (ESM::RefId::ciEqual(npc->mBase->mRace, player->mBase->mRace)) + if (npc->mBase->mRace == player->mBase->mRace) x += fDispRaceMod; static const float fDispPersonalityMult = gmst.find("fDispPersonalityMult")->mValue.getFloat(); @@ -913,7 +913,7 @@ namespace MWMechanics return false; // A special case for evidence chest - we should not allow to take items even if it is technically permitted - return !ESM::RefId::ciEqual(cellref.getRefId(), ESM::RefId::stringRefId("stolen_goods")); + return !(cellref.getRefId() == ESM::RefId::stringRefId("stolen_goods")); } bool MechanicsManager::sleepInBed(const MWWorld::Ptr& ptr, const MWWorld::Ptr& bed) @@ -1013,7 +1013,7 @@ namespace MWMechanics const ESM::RefId& victimFaction = victim.getClass().getPrimaryFaction(victim); if (!victimFaction.empty() - && ESM::RefId::ciEqual(item.getCellRef().getFaction(), victimFaction)) // Is the item faction-owned? + && item.getCellRef().getFaction() == victimFaction) // Is the item faction-owned? { owner.first = victimFaction; owner.second = true; @@ -1118,7 +1118,7 @@ namespace MWMechanics } } - if (!ESM::RefId::ciEqual(item.getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId)) + if (!(item.getCellRef().getRefId() == MWWorld::ContainerStore::sGoldId)) { if (victim.isEmpty() || (victim.getClass().isActor() && victim.getRefData().getCount() > 0 diff --git a/apps/openmw/mwmechanics/recharge.cpp b/apps/openmw/mwmechanics/recharge.cpp index d07b11b074..db5361ef69 100644 --- a/apps/openmw/mwmechanics/recharge.cpp +++ b/apps/openmw/mwmechanics/recharge.cpp @@ -99,7 +99,7 @@ namespace MWMechanics ESM::RefId soulGemAzura = ESM::RefId::stringRefId("Misc_SoulGem_Azura"); // special case: readd Azura's Star - if (ESM::RefId::ciEqual(gem.get()->mBase->mId, soulGemAzura)) + if (gem.get()->mBase->mId == soulGemAzura) player.getClass().getContainerStore(player).add(soulGemAzura, 1, player); } diff --git a/apps/openmw/mwmechanics/repair.cpp b/apps/openmw/mwmechanics/repair.cpp index 3d02bd6bb0..1a35bf3c66 100644 --- a/apps/openmw/mwmechanics/repair.cpp +++ b/apps/openmw/mwmechanics/repair.cpp @@ -100,7 +100,7 @@ namespace MWMechanics // try to find a new tool of the same ID for (MWWorld::ContainerStoreIterator iter(store.begin()); iter != store.end(); ++iter) { - if (ESM::RefId::ciEqual(iter->getCellRef().getRefId(), mTool.getCellRef().getRefId())) + if (iter->getCellRef().getRefId() == mTool.getCellRef().getRefId()) { mTool = *iter; diff --git a/apps/openmw/mwmechanics/spelleffects.cpp b/apps/openmw/mwmechanics/spelleffects.cpp index d8b9453e00..bc097aa215 100644 --- a/apps/openmw/mwmechanics/spelleffects.cpp +++ b/apps/openmw/mwmechanics/spelleffects.cpp @@ -207,7 +207,7 @@ namespace { MWWorld::InventoryStore& store = actor.getClass().getInventoryStore(actor); auto item = std::find_if(store.begin(), store.end(), - [&](const auto& it) { return ESM::RefId::ciEqual(it.getCellRef().getRefId(), itemId); }); + [&](const auto& it) { return it.getCellRef().getRefId() == itemId; }); if (item == store.end()) return; int slot = getBoundItemSlot(*item); @@ -215,7 +215,7 @@ namespace auto currentItem = store.getSlot(slot); bool wasEquipped - = currentItem != store.end() && ESM::RefId::ciEqual(currentItem->getCellRef().getRefId(), itemId); + = currentItem != store.end() && currentItem->getCellRef().getRefId() == itemId; if (wasEquipped) store.remove(*currentItem, 1, actor); diff --git a/apps/openmw/mwmechanics/spelllist.cpp b/apps/openmw/mwmechanics/spelllist.cpp index 0a9ee0a366..b0b87e07de 100644 --- a/apps/openmw/mwmechanics/spelllist.cpp +++ b/apps/openmw/mwmechanics/spelllist.cpp @@ -77,7 +77,7 @@ namespace MWMechanics bool changed = withBaseRecord([&](auto& spells) { for (const auto& it : spells) { - if (ESM::RefId::ciEqual(id, it)) + if (id == it) return false; } spells.push_back(id); @@ -96,7 +96,7 @@ namespace MWMechanics bool changed = withBaseRecord([&](auto& spells) { for (auto it = spells.begin(); it != spells.end(); it++) { - if (ESM::RefId::ciEqual(id, *it)) + if (id == *it) { spells.erase(it); return true; @@ -115,7 +115,7 @@ namespace MWMechanics { bool changed = withBaseRecord([&](auto& spells) { const auto it = std::remove_if(spells.begin(), spells.end(), [&](const auto& spell) { - const auto isSpell = [&](const auto& id) { return ESM::RefId::ciEqual(spell, id); }; + const auto isSpell = [&](const auto& id) { return spell == id; }; return ids.end() != std::find_if(ids.begin(), ids.end(), isSpell); }); if (it == spells.end()) diff --git a/apps/openmw/mwmechanics/spellpriority.cpp b/apps/openmw/mwmechanics/spellpriority.cpp index 3994957b88..eb3e865d3a 100644 --- a/apps/openmw/mwmechanics/spellpriority.cpp +++ b/apps/openmw/mwmechanics/spellpriority.cpp @@ -83,7 +83,7 @@ namespace int actorId = caster.getClass().getCreatureStats(caster).getActorId(); const auto& active = target.getClass().getCreatureStats(target).getActiveSpells(); return std::find_if(active.begin(), active.end(), [&](const auto& spell) { - return spell.getCasterActorId() == actorId && ESM::RefId::ciEqual(spell.getId(), id); + return spell.getCasterActorId() == actorId && spell.getId() == id; }) != active.end(); } } diff --git a/apps/openmw/mwmechanics/spells.cpp b/apps/openmw/mwmechanics/spells.cpp index 0afadb1d24..b856da9c97 100644 --- a/apps/openmw/mwmechanics/spells.cpp +++ b/apps/openmw/mwmechanics/spells.cpp @@ -82,8 +82,8 @@ namespace MWMechanics removeSpell(spell); mSpellList->remove(spell); - if (ESM::RefId::ciEqual(spellId, mSelectedSpell)) - mSelectedSpell.clear(); + if (spellId == mSelectedSpell) + mSelectedSpell = ESM::RefId::sEmpty; } void Spells::removeSpell(const ESM::Spell* spell) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 818929818f..3bb8840687 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -66,7 +66,7 @@ namespace continue; if (female != (bodypart.mData.mFlags & ESM::BodyPart::BPF_Female)) continue; - if (!ESM::RefId::ciEqual(bodypart.mRace, race)) + if (!(bodypart.mRace == race)) continue; sVampireMapping[thisCombination] = &bodypart; } @@ -1209,7 +1209,7 @@ namespace MWRender if (bodypart.mData.mType != ESM::BodyPart::MT_Skin) continue; - if (!ESM::RefId::ciEqual(bodypart.mRace, race)) + if (!(bodypart.mRace == race)) continue; bool partFirstPerson = isFirstPersonPart(&bodypart); diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index 7024058ed0..ab2ed41c68 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -104,9 +104,9 @@ namespace MWScript if (count == 0) return; - if (ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_005")) || ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_010")) - || ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_025")) || ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_100"))) - item = ESM::RefId::stringRefId("gold_001"); + if (item == ESM::RefId::stringRefId("gold_005") ||item == ESM::RefId::stringRefId("gold_010") + || item == ESM::RefId::stringRefId("gold_025") ||item == ESM::RefId::stringRefId("gold_100")) + item = ESM::RefId::stringRefId("gold_001"); // Check if "item" can be placed in a container MWWorld::ManualRef manualRef(MWBase::Environment::get().getWorld()->getStore(), item, 1); @@ -191,8 +191,8 @@ namespace MWScript ESM::RefId item = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger)); runtime.pop(); - if (ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_005")) || ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_010")) - || ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_025")) || ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_100"))) + if (item == ESM::RefId::stringRefId("gold_005") ||item == ESM::RefId::stringRefId("gold_010") + || item == ESM::RefId::stringRefId("gold_025") ||item == ESM::RefId::stringRefId("gold_100")) item = ESM::RefId::stringRefId("gold_001"); MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr); @@ -222,8 +222,8 @@ namespace MWScript if (count == 0) return; - if (ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_005")) || ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_010")) - || ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_025")) || ESM::RefId::ciEqual(item, ESM::RefId::stringRefId("gold_100"))) + if (item == ESM::RefId::stringRefId("gold_005") || item == ESM::RefId::stringRefId("gold_010") + || item == ESM::RefId::stringRefId("gold_025") || item == ESM::RefId::stringRefId("gold_100")) item = ESM::RefId::stringRefId("gold_001"); // Explicit calls to non-unique actors affect the base record @@ -260,7 +260,7 @@ namespace MWScript std::string_view itemName; for (MWWorld::ConstContainerStoreIterator iter(store.cbegin()); iter != store.cend(); ++iter) { - if (ESM::RefId::ciEqual(iter->getCellRef().getRefId(), item)) + if (iter->getCellRef().getRefId() == item) { itemName = iter->getClass().getName(*iter); break; @@ -309,7 +309,7 @@ namespace MWScript // With soul gems we prefer filled ones. for (auto it = invStore.begin(); it != invStore.end(); ++it) { - if (ESM::RefId::ciEqual(it->getCellRef().getRefId(), item)) + if (it->getCellRef().getRefId() == item) { found = it; const ESM::RefId& soul = it->getCellRef().getSoul(); @@ -425,7 +425,7 @@ namespace MWScript for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot) { MWWorld::ConstContainerStoreIterator it = invStore.getSlot(slot); - if (it != invStore.end() && ESM::RefId::ciEqual(it->getCellRef().getRefId(), item)) + if (it != invStore.end() && it->getCellRef().getRefId() == item) { runtime.push(1); return; @@ -452,7 +452,7 @@ namespace MWScript = invStore.cbegin(MWWorld::ContainerStore::Type_Miscellaneous); it != invStore.cend(); ++it) { - if (ESM::RefId::ciEqual(it->getCellRef().getSoul(), name)) + if (it->getCellRef().getSoul() == name) count += it->getRefData().getCount(); } runtime.push(count); diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index da88dac501..d30a542b44 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -99,7 +99,7 @@ namespace ++it; continue; } - if (ESM::RefId::ciEqual(itemId, it->mId)) + if (itemId == it->mId) it = list->mList.erase(it); else ++it; @@ -612,7 +612,7 @@ namespace MWScript MWWorld::InventoryStore& store = ptr.getClass().getInventoryStore(ptr); for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) { - if (ESM::RefId::ciEqual(it->getCellRef().getSoul(), soul)) + if (it->getCellRef().getSoul() == soul) { store.remove(*it, 1, ptr); return; @@ -655,7 +655,7 @@ namespace MWScript for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot) { MWWorld::ConstContainerStoreIterator it = store.getSlot(slot); - if (it != store.end() && ESM::RefId::ciEqual(it->getCellRef().getRefId(), item)) + if (it != store.end() && it->getCellRef().getRefId() == item) { numNotEquipped -= it->getRefData().getCount(); } @@ -664,7 +664,7 @@ namespace MWScript for (int slot = 0; slot < MWWorld::InventoryStore::Slots && amount > numNotEquipped; ++slot) { MWWorld::ContainerStoreIterator it = store.getSlot(slot); - if (it != store.end() && ESM::RefId::ciEqual(it->getCellRef().getRefId(), item)) + if (it != store.end() && it->getCellRef().getRefId() == item) { int numToRemove = std::min(amount - numNotEquipped, it->getRefData().getCount()); store.unequipItemQuantity(*it, ptr, numToRemove); @@ -674,7 +674,7 @@ namespace MWScript for (MWWorld::ContainerStoreIterator iter(store.begin()); iter != store.end(); ++iter) { - if (ESM::RefId::ciEqual(iter->getCellRef().getRefId(), item) + if (iter->getCellRef().getRefId() == item && !store.isEquipped(*iter)) { int removed = store.remove(*iter, amount, ptr); @@ -730,7 +730,7 @@ namespace MWScript for (MWWorld::ContainerStoreIterator iter(store.begin()); iter != store.end(); ++iter) { - if (ESM::RefId::ciEqual(iter->getCellRef().getSoul(), soul)) + if (iter->getCellRef().getSoul() == soul) { MWBase::Environment::get().getWorld()->dropObjectOnGround(ptr, *iter, 1); store.remove(*iter, 1, ptr); @@ -953,7 +953,7 @@ namespace MWScript runtime.pop(); MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr); - bool hit = ESM::RefId::ciEqual(objectID, stats.getLastHitObject()); + bool hit = objectID == stats.getLastHitObject(); runtime.push(hit); if (hit) stats.clearLastHitObject(); @@ -972,7 +972,7 @@ namespace MWScript runtime.pop(); MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr); - bool hit = ESM::RefId::ciEqual(objectID, stats.getLastHitAttemptObject()); + bool hit = objectID == stats.getLastHitAttemptObject(); runtime.push(hit); if (hit) stats.clearLastHitAttemptObject(); diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index a071aadba0..f99bae6833 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -255,7 +255,7 @@ namespace MWScript runtime.pop(); // workaround broken endgame scripts that kill dagoth ur - if (!R::implicit && ESM::RefId::ciEqual(ptr.getCellRef().getRefId(), ESM::RefId::stringRefId("dagoth_ur_1"))) + if (!R::implicit && ptr.getCellRef().getRefId() == ESM::RefId::stringRefId("dagoth_ur_1")) { runtime.push(peek); @@ -870,7 +870,7 @@ namespace MWScript const ESM::RefId& npcRace = ptr.get()->mBase->mRace; - runtime.push(ESM::RefId::ciEqual(race, npcRace)); + runtime.push(race == npcRace); } }; diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 4cdbfc9a4e..8975846ce4 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -169,7 +169,7 @@ namespace { for (auto& item : state.mInventory.mItems) { - if (item.mCount > 0 && ESM::RefId::ciEqual(baseItem.mItem, item.mRef.mRefID)) + if (item.mCount > 0 && baseItem.mItem == item.mRef.mRefID) item.mCount = -item.mCount; } } diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index e21817ab80..33b8894a54 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -61,7 +61,7 @@ namespace for (MWWorld::LiveCellRef& liveCellRef : list.mList) { - if (ESM::RefId::ciEqual(liveCellRef.mBase->mId, id) && liveCellRef.mData.getCount()) + if ((liveCellRef.mBase->mId == id) && liveCellRef.mData.getCount()) { MWWorld::Ptr ptr(&liveCellRef, nullptr); ptr.setContainerStore(store); @@ -187,7 +187,7 @@ int MWWorld::ContainerStore::count(const ESM::RefId& id) const { int total = 0; for (const auto&& iter : *this) - if (ESM::RefId::ciEqual(iter.getCellRef().getRefId(), id)) + if (iter.getCellRef().getRefId() == id) total += iter.getRefData().getCount(); return total; } @@ -252,7 +252,7 @@ bool MWWorld::ContainerStore::stacks(const ConstPtr& ptr1, const ConstPtr& ptr2) const MWWorld::Class& cls1 = ptr1.getClass(); const MWWorld::Class& cls2 = ptr2.getClass(); - if (!ESM::RefId::ciEqual(ptr1.getCellRef().getRefId(), ptr2.getCellRef().getRefId())) + if (!(ptr1.getCellRef().getRefId() == ptr2.getCellRef().getRefId())) return false; // If it has an enchantment, don't stack when some of the charge is already used @@ -372,7 +372,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp(const Ptr& ptr, for (MWWorld::ContainerStoreIterator iter(begin(type)); iter != end(); ++iter) { - if (ESM::RefId::ciEqual(iter->getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId)) + if (iter->getCellRef().getRefId() == MWWorld::ContainerStore::sGoldId) { iter->getRefData().setCount(addItems(iter->getRefData().getCount(false), realCount)); flagAsModified(); @@ -512,7 +512,7 @@ int MWWorld::ContainerStore::remove( int toRemove = count; for (ContainerStoreIterator iter(begin()); iter != end() && toRemove > 0; ++iter) - if (ESM::RefId::ciEqual(iter->getCellRef().getRefId(), itemId)) + if (iter->getCellRef().getRefId() == itemId) toRemove -= remove(*iter, toRemove, actor, equipReplacement, resolveFirst); flagAsModified(); @@ -789,7 +789,7 @@ MWWorld::Ptr MWWorld::ContainerStore::findReplacement(const ESM::RefId& id) for (auto&& iter : *this) { int iterHealth = iter.getClass().hasItemHealth(iter) ? iter.getClass().getItemHealth(iter) : 1; - if (ESM::RefId::ciEqual(iter.getCellRef().getRefId(), id)) + if (iter.getCellRef().getRefId() == id) { // Prefer the stack with the lowest remaining uses // Try to get item with zero durability only if there are no other items found diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 33a0ffab60..b4aacd6a1e 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -106,7 +106,7 @@ namespace { Log(Debug::Verbose) << "NPC '" << npc.mId << "' (" << npc.mName << ") has nonexistent faction '" << npc.mFaction << "', ignoring it."; - npc.mFaction.clear(); + npc.mFaction = ESM::RefId::sEmpty; npc.mNpdt.mRank = 0; changed = true; } @@ -138,7 +138,7 @@ namespace { if (!item.mScript.empty() && !scripts.search(item.mScript)) { - item.mScript.clear(); + item.mScript = ESM::RefId::sEmpty; Log(Debug::Verbose) << "Item '" << id << "' (" << item.mName << ") has nonexistent script '" << item.mScript << "', ignoring it."; } @@ -687,7 +687,7 @@ namespace MWWorld { auto& npcs = getWritable(); - if (ESM::RefId::ciEqual(npc.mId, ESM::RefId::stringRefId("player"))) + if (npc.mId == ESM::RefId::stringRefId("player")) { return npcs.insert(npc); } diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index ff79ae44eb..afe1f185b8 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -313,7 +313,7 @@ namespace MWWorld void Player::clear() { mCellStore = nullptr; - mSign.clear(); + mSign = ESM::RefId::sEmpty; mMarkedCell = nullptr; mAutoMove = false; mForwardBackward = 0; diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp index de768496b4..95e82bde46 100644 --- a/apps/openmw/mwworld/projectilemanager.cpp +++ b/apps/openmw/mwworld/projectilemanager.cpp @@ -544,7 +544,7 @@ namespace MWWorld MWWorld::InventoryStore& inv = caster.getClass().getInventoryStore(caster); MWWorld::ContainerStoreIterator invIt = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight); if (invIt != inv.end() - && ESM::RefId::ciEqual(invIt->getCellRef().getRefId(), projectileState.mBowId)) + && invIt->getCellRef().getRefId() == projectileState.mBowId) bow = *invIt; } if (projectile->getHitWater()) diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index c36e2d4258..f17d3838db 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -254,7 +254,7 @@ namespace MWWorld while (sharedIter != mShared.end() && sharedIter != end) { - if (ESM::RefId::ciEqual((*sharedIter)->mId, id)) + if ((*sharedIter)->mId == id) { mShared.erase(sharedIter); break; @@ -359,7 +359,7 @@ namespace MWWorld ESM::LandTexture* tex = const_cast(search(lt.mIndex, i)); if (tex) { - if (ESM::RefId::ciEqual(tex->mId, lt.mId)) + if (tex->mId == lt.mId) tex->mTexture = lt.mTexture; } } @@ -716,7 +716,7 @@ namespace MWWorld const ESM::Cell* cell = nullptr; for (const ESM::Cell* sharedCell : mSharedExt) { - if (ESM::RefId::ciEqual(ESM::RefId::stringRefId(sharedCell->mName), id)) + if (ESM::RefId::stringRefId(sharedCell->mName) == id) { if (cell == nullptr || (sharedCell->mData.mX > cell->mData.mX) || (sharedCell->mData.mX == cell->mData.mX && sharedCell->mData.mY > cell->mData.mY)) @@ -732,7 +732,7 @@ namespace MWWorld const ESM::Cell* cell = nullptr; for (const ESM::Cell* sharedCell : mSharedExt) { - if (ESM::RefId::ciEqual(sharedCell->mRegion, id)) + if (sharedCell->mRegion == id) { if (cell == nullptr || (sharedCell->mData.mX > cell->mData.mX) || (sharedCell->mData.mX == cell->mData.mX && sharedCell->mData.mY > cell->mData.mY)) diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index c96b0651da..d6f5a84f6b 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -203,8 +203,8 @@ namespace MWWorld else mAmbientLoopSoundID = ESM::RefId::stringRefId(Fallback::Map::getString("Weather_" + name + "_Ambient_Loop_Sound_ID")); - if (ESM::RefId::ciEqual(mAmbientLoopSoundID, ESM::RefId::stringRefId("None"))) - mAmbientLoopSoundID.clear(); + if (mAmbientLoopSoundID == ESM::RefId::stringRefId("None")) + mAmbientLoopSoundID = ESM::RefId::sEmpty; } float Weather::transitionDelta() const @@ -827,7 +827,7 @@ namespace MWWorld if (mAmbientSound) MWBase::Environment::get().getSoundManager()->stopSound(mAmbientSound); mAmbientSound = nullptr; - mPlayingSoundID.clear(); + mPlayingSoundID = ESM::RefId::sEmpty; } float WeatherManager::getWindSpeed() const @@ -959,7 +959,7 @@ namespace MWWorld { stopSounds(); - mCurrentRegion.clear(); + mCurrentRegion = ESM::RefId::sEmpty; mTimePassed = 0.0f; mWeatherUpdateTime = 0.0f; forceWeather(0); @@ -991,7 +991,7 @@ namespace MWWorld MWWorld::ConstPtr player = MWMechanics::getPlayer(); if (player.isInCell()) { - if (ESM::RefId::ciEqual(regionID, mCurrentRegion)) + if (regionID == mCurrentRegion) { addWeatherTransition(region.getWeather()); } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 89a43f5b98..4dcdb06364 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1759,13 +1759,13 @@ namespace MWWorld { bool update = false; - if (ESM::RefId::ciEqual(record.mId, ESM::RefId::stringRefId("player"))) + if (record.mId == ESM::RefId::stringRefId("player")) { const ESM::NPC* player = mPlayer->getPlayer().get()->mBase; - update = record.isMale() != player->isMale() || !ESM::RefId::ciEqual(record.mRace, player->mRace) - || !ESM::RefId::ciEqual(record.mHead, player->mHead) - || !ESM::RefId::ciEqual(record.mHair, player->mHair); + update = record.isMale() != player->isMale() || !(record.mRace == player->mRace) + || !(record.mHead == player->mHead) + || !(record.mHair == player->mHair); } const ESM::NPC* ret = mStore.insert(record); if (update) @@ -2719,7 +2719,7 @@ namespace MWWorld if (ptr.getClass().getCapacity(ptr) <= 0.f) return true; - if (ESM::RefId::ciEqual(ptr.getCellRef().getOwner(), mOwner.getCellRef().getRefId())) + if (ptr.getCellRef().getOwner() == mOwner.getCellRef().getRefId()) mOut.push_back(ptr); return true; @@ -2741,7 +2741,7 @@ namespace MWWorld { cellstore->forEach([&](const auto& ptr) { if (ptr.getRefData().getBaseNode() - && ESM::RefId::ciEqual(ptr.getCellRef().getOwner(), npc.getCellRef().getRefId())) + && ptr.getCellRef().getOwner() == npc.getCellRef().getRefId()) out.push_back(ptr); return true; }); diff --git a/components/esm/refid.cpp b/components/esm/refid.cpp index 6ab1b8cfc5..74a8c352d0 100644 --- a/components/esm/refid.cpp +++ b/components/esm/refid.cpp @@ -4,9 +4,9 @@ #include "components/misc/strings/algorithm.hpp" -bool ESM::RefId::ciEqual(const RefId & left, const RefId & right) +bool ESM::RefId::operator==(const RefId& rhs) const { - return Misc::StringUtils::ciEqual(left.mId, right.mId); + return Misc::StringUtils::ciEqual(this->mId, rhs.mId); } namespace ESM diff --git a/components/esm/refid.hpp b/components/esm/refid.hpp index a010704a8e..a36fe3165b 100644 --- a/components/esm/refid.hpp +++ b/components/esm/refid.hpp @@ -9,13 +9,11 @@ namespace ESM struct RefId { const static RefId sEmpty; - void clear() { mId.clear(); } bool empty() const { return mId.empty(); } void swap(RefId& rhs) { mId.swap(rhs.mId); } - bool operator==(const RefId& rhs) const { return ciEqual(*this, rhs); } + bool operator==(const RefId& rhs) const; bool operator<(const RefId& rhs) const { return mId < rhs.mId; } bool operator>(const RefId& rhs) const { return mId > rhs.mId; } - static bool ciEqual(const RefId& left, const RefId& right); friend std::ostream& operator<<(std::ostream& os, const RefId& dt); @@ -38,11 +36,7 @@ namespace std { std::size_t operator()(const ESM::RefId& k) const { - using std::hash; - using std::size_t; - using std::string; - - return hash()(k.getRefIdString()); + return std::hash()(k.getRefIdString()); } }; } diff --git a/components/esm3/cellref.cpp b/components/esm3/cellref.cpp index bf7ae77142..179541bb1f 100644 --- a/components/esm3/cellref.cpp +++ b/components/esm3/cellref.cpp @@ -149,7 +149,7 @@ namespace ESM if (cellRef.mLockLevel == 0 && !cellRef.mKey.empty()) { cellRef.mLockLevel = UnbreakableLock; - cellRef.mTrap.clear(); + cellRef.mTrap = ESM::RefId::sEmpty; } } } @@ -260,12 +260,12 @@ namespace ESM void CellRef::blank() { mRefNum.unset(); - mRefID.clear(); + mRefID = ESM::RefId::sEmpty; mScale = 1; - mOwner.clear(); + mOwner = ESM::RefId::sEmpty; mGlobalVariable.clear(); - mSoul.clear(); - mFaction.clear(); + mSoul = ESM::RefId::sEmpty; + mFaction = ESM::RefId::sEmpty; mFactionRank = -2; mChargeInt = -1; mChargeIntRemainder = 0.0f; @@ -273,8 +273,8 @@ namespace ESM mGoldValue = 1; mDestCell.clear(); mLockLevel = 0; - mKey.clear(); - mTrap.clear(); + mKey = ESM::RefId::sEmpty; + mTrap = ESM::RefId::sEmpty; mReferenceBlocked = -1; mTeleport = false; diff --git a/components/esm3/inventorystate.cpp b/components/esm3/inventorystate.cpp index c8a9b1bba6..a59a963d74 100644 --- a/components/esm3/inventorystate.cpp +++ b/components/esm3/inventorystate.cpp @@ -120,7 +120,7 @@ namespace ESM const int count = entry.second; for (auto& item : mItems) { - if (item.mCount == count && ESM::RefId::ciEqual(id, item.mRef.mRefID)) + if (item.mCount == count && id == item.mRef.mRefID) item.mCount = -count; } } diff --git a/components/esm3/loadacti.cpp b/components/esm3/loadacti.cpp index 86c7f87c5a..c233f50dcc 100644 --- a/components/esm3/loadacti.cpp +++ b/components/esm3/loadacti.cpp @@ -61,7 +61,7 @@ namespace ESM { mRecordFlags = 0; mName.clear(); - mScript.clear(); + mScript = ESM::RefId::sEmpty; mModel.clear(); } } diff --git a/components/esm3/loadalch.cpp b/components/esm3/loadalch.cpp index 91d857798c..76b153f05a 100644 --- a/components/esm3/loadalch.cpp +++ b/components/esm3/loadalch.cpp @@ -84,7 +84,7 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mScript.clear(); + mScript = ESM::RefId::sEmpty; mEffects.mList.clear(); } } diff --git a/components/esm3/loadappa.cpp b/components/esm3/loadappa.cpp index 6b231a91a3..f80ae9781b 100644 --- a/components/esm3/loadappa.cpp +++ b/components/esm3/loadappa.cpp @@ -79,7 +79,7 @@ namespace ESM mData.mValue = 0; mModel.clear(); mIcon.clear(); - mScript.clear(); + mScript = ESM::RefId::sEmpty; mName.clear(); } } diff --git a/components/esm3/loadarmo.cpp b/components/esm3/loadarmo.cpp index 4139988e6d..16039f39dd 100644 --- a/components/esm3/loadarmo.cpp +++ b/components/esm3/loadarmo.cpp @@ -122,7 +122,7 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mScript.clear(); - mEnchant.clear(); + mScript = ESM::RefId::sEmpty; + mEnchant = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadbody.cpp b/components/esm3/loadbody.cpp index 68c19fc161..3165a76548 100644 --- a/components/esm3/loadbody.cpp +++ b/components/esm3/loadbody.cpp @@ -71,6 +71,6 @@ namespace ESM mData.mType = 0; mModel.clear(); - mRace.clear(); + mRace = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadbook.cpp b/components/esm3/loadbook.cpp index 62b9e26806..259b7e99a8 100644 --- a/components/esm3/loadbook.cpp +++ b/components/esm3/loadbook.cpp @@ -88,8 +88,8 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mScript.clear(); - mEnchant.clear(); + mScript = ESM::RefId::sEmpty; + mEnchant = ESM::RefId::sEmpty; mText.clear(); } } diff --git a/components/esm3/loadcell.cpp b/components/esm3/loadcell.cpp index 9e2d813621..e354f71651 100644 --- a/components/esm3/loadcell.cpp +++ b/components/esm3/loadcell.cpp @@ -315,7 +315,7 @@ namespace ESM void Cell::blank() { mName.clear(); - mRegion.clear(); + mRegion = ESM::RefId::sEmpty; mWater = 0; mWaterInt = false; mMapColor = 0; diff --git a/components/esm3/loadclot.cpp b/components/esm3/loadclot.cpp index 00f8cb2e20..45b5405f5b 100644 --- a/components/esm3/loadclot.cpp +++ b/components/esm3/loadclot.cpp @@ -94,7 +94,7 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mEnchant.clear(); - mScript.clear(); + mEnchant = ESM::RefId::sEmpty; + mScript = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadcont.cpp b/components/esm3/loadcont.cpp index b648310fde..f52cfbc557 100644 --- a/components/esm3/loadcont.cpp +++ b/components/esm3/loadcont.cpp @@ -113,7 +113,7 @@ namespace ESM mRecordFlags = 0; mName.clear(); mModel.clear(); - mScript.clear(); + mScript = ESM::RefId::sEmpty; mWeight = 0; mFlags = 0x8; // set default flag value mInventory.mList.clear(); diff --git a/components/esm3/loadcrea.cpp b/components/esm3/loadcrea.cpp index f9e317e7dd..f4314254e0 100644 --- a/components/esm3/loadcrea.cpp +++ b/components/esm3/loadcrea.cpp @@ -152,8 +152,8 @@ namespace ESM mScale = 1.f; mModel.clear(); mName.clear(); - mScript.clear(); - mOriginal.clear(); + mScript = ESM::RefId::sEmpty; + mOriginal = ESM::RefId::sEmpty; mInventory.mList.clear(); mSpells.mList.clear(); mAiData.blank(); diff --git a/components/esm3/loaddoor.cpp b/components/esm3/loaddoor.cpp index 1d3e49383a..a3a02030e4 100644 --- a/components/esm3/loaddoor.cpp +++ b/components/esm3/loaddoor.cpp @@ -71,8 +71,8 @@ namespace ESM mRecordFlags = 0; mName.clear(); mModel.clear(); - mScript.clear(); - mOpenSound.clear(); - mCloseSound.clear(); + mScript = ESM::RefId::sEmpty; + mOpenSound = ESM::RefId::sEmpty; + mCloseSound = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadinfo.cpp b/components/esm3/loadinfo.cpp index 36a6dd241e..b6ef11d9f8 100644 --- a/components/esm3/loadinfo.cpp +++ b/components/esm3/loadinfo.cpp @@ -140,15 +140,15 @@ namespace ESM mData = {}; mSelects.clear(); - mPrev.clear(); - mNext.clear(); - mActor.clear(); - mRace.clear(); - mClass.clear(); - mFaction.clear(); - mPcFaction.clear(); - mCell.clear(); - mSound.clear(); + mPrev = ESM::RefId::sEmpty; + mNext = ESM::RefId::sEmpty; + mActor = ESM::RefId::sEmpty; + mRace = ESM::RefId::sEmpty; + mClass = ESM::RefId::sEmpty; + mFaction = ESM::RefId::sEmpty; + mPcFaction = ESM::RefId::sEmpty; + mCell = ESM::RefId::sEmpty; + mSound = ESM::RefId::sEmpty; mResponse.clear(); mResultScript.clear(); mFactionLess = false; diff --git a/components/esm3/loadingr.cpp b/components/esm3/loadingr.cpp index 11101fb51d..09240218b8 100644 --- a/components/esm3/loadingr.cpp +++ b/components/esm3/loadingr.cpp @@ -102,6 +102,6 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mScript.clear(); + mScript = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadligh.cpp b/components/esm3/loadligh.cpp index 510b51dd7f..54b53ebc9a 100644 --- a/components/esm3/loadligh.cpp +++ b/components/esm3/loadligh.cpp @@ -82,8 +82,8 @@ namespace ESM mData.mRadius = 0; mData.mColor = 0; mData.mFlags = 0; - mSound.clear(); - mScript.clear(); + mSound = ESM::RefId::sEmpty; + mScript = ESM::RefId::sEmpty; mModel.clear(); mIcon.clear(); mName.clear(); diff --git a/components/esm3/loadlock.cpp b/components/esm3/loadlock.cpp index cdec3ff925..1f2756bb8d 100644 --- a/components/esm3/loadlock.cpp +++ b/components/esm3/loadlock.cpp @@ -81,6 +81,6 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mScript.clear(); + mScript = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadltex.cpp b/components/esm3/loadltex.cpp index a8e0a575c2..0234c6c257 100644 --- a/components/esm3/loadltex.cpp +++ b/components/esm3/loadltex.cpp @@ -57,7 +57,7 @@ namespace ESM void LandTexture::blank() { - mId.clear(); + mId = ESM::RefId::sEmpty; mTexture.clear(); } } diff --git a/components/esm3/loadmgef.cpp b/components/esm3/loadmgef.cpp index 47bc868bb4..f3858b6c8a 100644 --- a/components/esm3/loadmgef.cpp +++ b/components/esm3/loadmgef.cpp @@ -581,14 +581,14 @@ namespace ESM mIcon.clear(); mParticle.clear(); - mCasting.clear(); - mHit.clear(); - mArea.clear(); - mBolt.clear(); - mCastSound.clear(); - mBoltSound.clear(); - mHitSound.clear(); - mAreaSound.clear(); + mCasting = ESM::RefId::sEmpty; + mHit = ESM::RefId::sEmpty; + mArea = ESM::RefId::sEmpty; + mBolt = ESM::RefId::sEmpty; + mCastSound = ESM::RefId::sEmpty; + mBoltSound = ESM::RefId::sEmpty; + mHitSound = ESM::RefId::sEmpty; + mAreaSound = ESM::RefId::sEmpty; mDescription.clear(); } diff --git a/components/esm3/loadmisc.cpp b/components/esm3/loadmisc.cpp index 49bd18ecca..613eacbfa8 100644 --- a/components/esm3/loadmisc.cpp +++ b/components/esm3/loadmisc.cpp @@ -79,6 +79,6 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mScript.clear(); + mScript = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadnpc.cpp b/components/esm3/loadnpc.cpp index 2788c77d04..bd8b58a93d 100644 --- a/components/esm3/loadnpc.cpp +++ b/components/esm3/loadnpc.cpp @@ -202,12 +202,12 @@ namespace ESM mAiPackage.mList.clear(); mName.clear(); mModel.clear(); - mRace.clear(); - mClass.clear(); - mFaction.clear(); - mScript.clear(); - mHair.clear(); - mHead.clear(); + mRace = ESM::RefId::sEmpty; + mClass = ESM::RefId::sEmpty; + mFaction = ESM::RefId::sEmpty; + mScript = ESM::RefId::sEmpty; + mHair = ESM::RefId::sEmpty; + mHead = ESM::RefId::sEmpty; } void NPC::blankNpdt() diff --git a/components/esm3/loadpgrd.cpp b/components/esm3/loadpgrd.cpp index aac9b866d8..8fd822036f 100644 --- a/components/esm3/loadpgrd.cpp +++ b/components/esm3/loadpgrd.cpp @@ -186,7 +186,7 @@ namespace ESM void Pathgrid::blank() { - mCell.clear(); + mCell = ESM::RefId::sEmpty; mData.mX = 0; mData.mY = 0; mData.mS1 = 0; diff --git a/components/esm3/loadprob.cpp b/components/esm3/loadprob.cpp index 00f782b41b..2b69657aef 100644 --- a/components/esm3/loadprob.cpp +++ b/components/esm3/loadprob.cpp @@ -81,6 +81,6 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mScript.clear(); + mScript = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadregn.cpp b/components/esm3/loadregn.cpp index 361119d562..a4470eac9f 100644 --- a/components/esm3/loadregn.cpp +++ b/components/esm3/loadregn.cpp @@ -110,7 +110,7 @@ namespace ESM mMapColor = 0; mName.clear(); - mSleepList.clear(); + mSleepList = ESM::RefId::sEmpty; mSoundList.clear(); } } diff --git a/components/esm3/loadrepa.cpp b/components/esm3/loadrepa.cpp index 76b7fde15a..41914311e3 100644 --- a/components/esm3/loadrepa.cpp +++ b/components/esm3/loadrepa.cpp @@ -81,6 +81,6 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mScript.clear(); + mScript = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadsndg.cpp b/components/esm3/loadsndg.cpp index 515a9abb9e..3e46832f1f 100644 --- a/components/esm3/loadsndg.cpp +++ b/components/esm3/loadsndg.cpp @@ -66,7 +66,7 @@ namespace ESM { mRecordFlags = 0; mType = LeftFoot; - mCreature.clear(); - mSound.clear(); + mCreature = ESM::RefId::sEmpty; + mSound = ESM::RefId::sEmpty; } } diff --git a/components/esm3/loadweap.cpp b/components/esm3/loadweap.cpp index 5080fa8bcd..782366816a 100644 --- a/components/esm3/loadweap.cpp +++ b/components/esm3/loadweap.cpp @@ -91,7 +91,7 @@ namespace ESM mName.clear(); mModel.clear(); mIcon.clear(); - mEnchant.clear(); - mScript.clear(); + mEnchant = ESM::RefId::sEmpty; + mScript = ESM::RefId::sEmpty; } } diff --git a/components/esm3/spelllist.cpp b/components/esm3/spelllist.cpp index a2625fc7b3..6a78700b95 100644 --- a/components/esm3/spelllist.cpp +++ b/components/esm3/spelllist.cpp @@ -24,7 +24,7 @@ namespace ESM bool SpellList::exists(const ESM::RefId& spell) const { for (auto it = mList.begin(); it != mList.end(); ++it) - if (ESM::RefId::ciEqual(*it, spell)) + if (*it == spell) return true; return false; }