Remove ESM::RefId::sEmpty

This variable is only required to return empty RefId as const reference. There
is no point in doing so for a type cheap to copy.
cxxopts_mwiniimporter_ci_debug
elsid 2 years ago
parent 2e45c80ac2
commit 0601d7213e
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -84,7 +84,7 @@ namespace MWClass
return ref->mBase->mName;
}
const ESM::RefId& Activator::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Activator::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Activator>* ref = ptr.get<ESM::Activator>();
@ -140,7 +140,7 @@ namespace MWClass
return MWWorld::Ptr(cell.insert(ref), &cell);
}
const ESM::RefId& Activator::getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const
ESM::RefId Activator::getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const
{
const std::string model
= getModel(ptr); // Assume it's not empty, since we wouldn't have gotten the soundgen otherwise
@ -191,7 +191,7 @@ namespace MWClass
return fallbacksounds[Misc::Rng::rollDice(fallbacksounds.size(), prng)]->mSound;
}
return ESM::RefId::sEmpty;
return ESM::RefId();
}
int Activator::getSndGenTypeFromName(std::string_view name)

@ -35,7 +35,7 @@ namespace MWClass
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
std::unique_ptr<MWWorld::Action> activate(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const override;
@ -48,7 +48,7 @@ namespace MWClass
bool isActivator() const override;
const ESM::RefId& getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const override;
ESM::RefId getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const override;
};
}

@ -53,7 +53,7 @@ namespace MWClass
return defaultItemActivate(ptr, actor);
}
const ESM::RefId& Apparatus::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Apparatus::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Apparatus>* ref = ptr.get<ESM::Apparatus>();

@ -28,7 +28,7 @@ namespace MWClass
std::unique_ptr<MWWorld::Action> activate(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const override;
///< Generate action for activation
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
int getValue(const MWWorld::ConstPtr& ptr) const override;

@ -75,7 +75,7 @@ namespace MWClass
return ref->mBase->mData.mHealth;
}
const ESM::RefId& Armor::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Armor::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Armor>* ref = ptr.get<ESM::Armor>();
@ -272,7 +272,7 @@ namespace MWClass
return info;
}
const ESM::RefId& Armor::getEnchantment(const MWWorld::ConstPtr& ptr) const
ESM::RefId Armor::getEnchantment(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Armor>* ref = ptr.get<ESM::Armor>();

@ -34,7 +34,7 @@ namespace MWClass
int getItemMaxHealth(const MWWorld::ConstPtr& ptr) const override;
///< Return item max health or throw an exception, if class does not have item health
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
std::pair<std::vector<int>, bool> getEquipmentSlots(const MWWorld::ConstPtr& ptr) const override;
@ -60,7 +60,7 @@ namespace MWClass
const std::string& getInventoryIcon(const MWWorld::ConstPtr& ptr) const override;
///< Return name of inventory icon.
const ESM::RefId& getEnchantment(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getEnchantment(const MWWorld::ConstPtr& ptr) const override;
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
const ESM::RefId& applyEnchantment(const MWWorld::ConstPtr& ptr, const ESM::RefId& enchId, int enchCharge,

@ -72,7 +72,7 @@ namespace MWClass
return std::make_unique<MWWorld::ActionRead>(ptr);
}
const ESM::RefId& Book::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Book::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Book>* ref = ptr.get<ESM::Book>();
@ -133,7 +133,7 @@ namespace MWClass
return info;
}
const ESM::RefId& Book::getEnchantment(const MWWorld::ConstPtr& ptr) const
ESM::RefId Book::getEnchantment(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Book>* ref = ptr.get<ESM::Book>();

@ -26,7 +26,7 @@ namespace MWClass
std::unique_ptr<MWWorld::Action> activate(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const override;
///< Generate action for activation
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
@ -44,7 +44,7 @@ namespace MWClass
const std::string& getInventoryIcon(const MWWorld::ConstPtr& ptr) const override;
///< Return name of inventory icon.
const ESM::RefId& getEnchantment(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getEnchantment(const MWWorld::ConstPtr& ptr) const override;
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
const ESM::RefId& applyEnchantment(const MWWorld::ConstPtr& ptr, const ESM::RefId& enchId, int enchCharge,

@ -58,7 +58,7 @@ namespace MWClass
return defaultItemActivate(ptr, actor);
}
const ESM::RefId& Clothing::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Clothing::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Clothing>* ref = ptr.get<ESM::Clothing>();
@ -179,7 +179,7 @@ namespace MWClass
return info;
}
const ESM::RefId& Clothing::getEnchantment(const MWWorld::ConstPtr& ptr) const
ESM::RefId Clothing::getEnchantment(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Clothing>* ref = ptr.get<ESM::Clothing>();

@ -26,7 +26,7 @@ namespace MWClass
std::unique_ptr<MWWorld::Action> activate(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const override;
///< Generate action for activation
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
std::pair<std::vector<int>, bool> getEquipmentSlots(const MWWorld::ConstPtr& ptr) const override;
@ -52,7 +52,7 @@ namespace MWClass
const std::string& getInventoryIcon(const MWWorld::ConstPtr& ptr) const override;
///< Return name of inventory icon.
const ESM::RefId& getEnchantment(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getEnchantment(const MWWorld::ConstPtr& ptr) const override;
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
const ESM::RefId& applyEnchantment(const MWWorld::ConstPtr& ptr, const ESM::RefId& enchId, int enchCharge,

@ -229,7 +229,7 @@ namespace MWClass
return data.mStore;
}
const ESM::RefId& Container::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Container::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Container>* ref = ptr.get<ESM::Container>();

@ -66,7 +66,7 @@ namespace MWClass
MWWorld::ContainerStore& getContainerStore(const MWWorld::Ptr& ptr) const override;
///< Return container store
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
float getCapacity(const MWWorld::Ptr& ptr) const override;

@ -526,7 +526,7 @@ namespace MWClass
return isFlagBitSet(ptr, ESM::Creature::Weapon);
}
const ESM::RefId& Creature::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Creature::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Creature>* ref = ptr.get<ESM::Creature>();
@ -634,11 +634,11 @@ namespace MWClass
return (ref->mBase->mRecordFlags & ESM::FLAG_Persistent) != 0;
}
const ESM::RefId& Creature::getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const
ESM::RefId Creature::getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const
{
int type = getSndGenTypeFromName(ptr, name);
if (type < 0)
return ESM::RefId::sEmpty;
return ESM::RefId();
std::vector<const ESM::SoundGenerator*> sounds;
std::vector<const ESM::SoundGenerator*> fallbacksounds;
@ -690,7 +690,7 @@ namespace MWClass
if (!fallbacksounds.empty())
return fallbacksounds[Misc::Rng::rollDice(fallbacksounds.size(), prng)]->mSound;
return ESM::RefId::sEmpty;
return ESM::RefId();
}
MWWorld::Ptr Creature::copyToCellImpl(const MWWorld::ConstPtr& ptr, MWWorld::CellStore& cell) const

@ -80,7 +80,7 @@ namespace MWClass
bool hasInventoryStore(const MWWorld::Ptr& ptr) const override;
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
float getCapacity(const MWWorld::Ptr& ptr) const override;
@ -97,7 +97,7 @@ namespace MWClass
bool isPersistent(const MWWorld::ConstPtr& ptr) const override;
const ESM::RefId& getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const override;
ESM::RefId getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const override;
MWMechanics::Movement& getMovementSettings(const MWWorld::Ptr& ptr) const override;
///< Return desired movement.

@ -256,7 +256,7 @@ namespace MWClass
return true;
}
const ESM::RefId& Door::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Door::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Door>* ref = ptr.get<ESM::Door>();

@ -48,7 +48,7 @@ namespace MWClass
bool allowTelekinesis(const MWWorld::ConstPtr& ptr) const override;
///< Return whether this class of object can be activated with telekinesis
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
std::string getModel(const MWWorld::ConstPtr& ptr) const override;

@ -57,7 +57,7 @@ namespace MWClass
return defaultItemActivate(ptr, actor);
}
const ESM::RefId& Ingredient::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Ingredient::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Ingredient>* ref = ptr.get<ESM::Ingredient>();

@ -29,7 +29,7 @@ namespace MWClass
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
int getValue(const MWWorld::ConstPtr& ptr) const override;

@ -103,7 +103,7 @@ namespace MWClass
return defaultItemActivate(ptr, actor);
}
const ESM::RefId& Light::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Light::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Light>* ref = ptr.get<ESM::Light>();
@ -244,7 +244,7 @@ namespace MWClass
return { 1, {} };
}
const ESM::RefId& Light::getSound(const MWWorld::ConstPtr& ptr) const
ESM::RefId Light::getSound(const MWWorld::ConstPtr& ptr) const
{
return ptr.get<ESM::Light>()->mBase->mSound;
}

@ -41,7 +41,7 @@ namespace MWClass
std::unique_ptr<MWWorld::Action> activate(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const override;
///< Generate action for activation
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
std::pair<std::vector<int>, bool> getEquipmentSlots(const MWWorld::ConstPtr& ptr) const override;
@ -78,7 +78,7 @@ namespace MWClass
std::pair<int, std::string_view> canBeEquipped(
const MWWorld::ConstPtr& ptr, const MWWorld::Ptr& npc) const override;
const ESM::RefId& getSound(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getSound(const MWWorld::ConstPtr& ptr) const override;
};
}

@ -56,7 +56,7 @@ namespace MWClass
return defaultItemActivate(ptr, actor);
}
const ESM::RefId& Lockpick::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Lockpick::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Lockpick>* ref = ptr.get<ESM::Lockpick>();

@ -34,7 +34,7 @@ namespace MWClass
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
std::pair<std::vector<int>, bool> getEquipmentSlots(const MWWorld::ConstPtr& ptr) const override;

@ -68,7 +68,7 @@ namespace MWClass
return defaultItemActivate(ptr, actor);
}
const ESM::RefId& Miscellaneous::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Miscellaneous::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Miscellaneous>* ref = ptr.get<ESM::Miscellaneous>();

@ -29,7 +29,7 @@ namespace MWClass
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
int getValue(const MWWorld::ConstPtr& ptr) const override;

@ -989,7 +989,7 @@ namespace MWClass
return store;
}
const ESM::RefId& Npc::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Npc::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::NPC>* ref = ptr.get<ESM::NPC>();
@ -1278,7 +1278,7 @@ namespace MWClass
return npc->mAiData.mServices;
}
const ESM::RefId& Npc::getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const
ESM::RefId Npc::getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const
{
static const ESM::RefId swimLeft = ESM::RefId::stringRefId("Swim Left");
static const ESM::RefId swimRight = ESM::RefId::stringRefId("Swim Right");
@ -1297,7 +1297,7 @@ namespace MWClass
{
MWBase::World* world = MWBase::Environment::get().getWorld();
if (world->isFlying(ptr))
return ESM::RefId::sEmpty;
return ESM::RefId();
osg::Vec3f pos(ptr.getRefData().getPosition().asVec3());
if (world->isSwimming(ptr))
return (name == "left") ? swimLeft : swimRight;
@ -1311,7 +1311,7 @@ namespace MWClass
int weaponType = ESM::Weapon::None;
MWMechanics::getActiveWeapon(ptr, &weaponType);
if (weaponType == ESM::Weapon::None)
return ESM::RefId::sEmpty;
return ESM::RefId();
}
const MWWorld::InventoryStore& inv = Npc::getInventoryStore(ptr);
@ -1332,12 +1332,12 @@ namespace MWClass
break;
}
}
return ESM::RefId::sEmpty;
return ESM::RefId();
}
// Morrowind ignores land soundgen for NPCs
if (name == "land")
return ESM::RefId::sEmpty;
return ESM::RefId();
if (name == "swimleft")
return swimLeft;
if (name == "swimright")
@ -1347,11 +1347,11 @@ namespace MWClass
// only for biped creatures?
if (name == "moan")
return ESM::RefId::sEmpty;
return ESM::RefId();
if (name == "roar")
return ESM::RefId::sEmpty;
return ESM::RefId();
if (name == "scream")
return ESM::RefId::sEmpty;
return ESM::RefId();
throw std::runtime_error("Unexpected soundgen type: " + std::string(name));
}
@ -1501,7 +1501,7 @@ namespace MWClass
return true;
}
const ESM::RefId& Npc::getPrimaryFaction(const MWWorld::ConstPtr& ptr) const
ESM::RefId Npc::getPrimaryFaction(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::NPC>* ref = ptr.get<ESM::NPC>();
return ref->mBase->mFaction;

@ -91,7 +91,7 @@ namespace MWClass
std::unique_ptr<MWWorld::Action> activate(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const override;
///< Generate action for activation
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
float getMaxSpeed(const MWWorld::Ptr& ptr) const override;
@ -130,7 +130,7 @@ namespace MWClass
bool isPersistent(const MWWorld::ConstPtr& ptr) const override;
const ESM::RefId& getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const override;
ESM::RefId getSoundIdFromSndGen(const MWWorld::Ptr& ptr, std::string_view name) const override;
std::string getModel(const MWWorld::ConstPtr& ptr) const override;
@ -161,7 +161,8 @@ namespace MWClass
int getBaseFightRating(const MWWorld::ConstPtr& ptr) const override;
const ESM::RefId& getPrimaryFaction(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getPrimaryFaction(const MWWorld::ConstPtr& ptr) const override;
int getPrimaryFactionRank(const MWWorld::ConstPtr& ptr) const override;
void setBaseAISetting(const ESM::RefId& id, MWMechanics::AiSetting setting, int value) const override;

@ -56,7 +56,7 @@ namespace MWClass
return defaultItemActivate(ptr, actor);
}
const ESM::RefId& Potion::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Potion::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Potion>* ref = ptr.get<ESM::Potion>();

@ -29,7 +29,7 @@ namespace MWClass
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
int getValue(const MWWorld::ConstPtr& ptr) const override;

@ -55,7 +55,7 @@ namespace MWClass
return defaultItemActivate(ptr, actor);
}
const ESM::RefId& Probe::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Probe::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Probe>* ref = ptr.get<ESM::Probe>();

@ -29,7 +29,7 @@ namespace MWClass
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
std::pair<std::vector<int>, bool> getEquipmentSlots(const MWWorld::ConstPtr& ptr) const override;

@ -54,7 +54,7 @@ namespace MWClass
return defaultItemActivate(ptr, actor);
}
const ESM::RefId& Repair::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Repair::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Repair>* ref = ptr.get<ESM::Repair>();

@ -29,7 +29,7 @@ namespace MWClass
MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const override;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
int getValue(const MWWorld::ConstPtr& ptr) const override;

@ -77,7 +77,7 @@ namespace MWClass
return ref->mBase->mData.mHealth;
}
const ESM::RefId& Weapon::getScript(const MWWorld::ConstPtr& ptr) const
ESM::RefId Weapon::getScript(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Weapon>* ref = ptr.get<ESM::Weapon>();
@ -251,7 +251,7 @@ namespace MWClass
return info;
}
const ESM::RefId& Weapon::getEnchantment(const MWWorld::ConstPtr& ptr) const
ESM::RefId Weapon::getEnchantment(const MWWorld::ConstPtr& ptr) const
{
const MWWorld::LiveCellRef<ESM::Weapon>* ref = ptr.get<ESM::Weapon>();

@ -35,7 +35,7 @@ namespace MWClass
int getItemMaxHealth(const MWWorld::ConstPtr& ptr) const override;
///< Return item max health or throw an exception, if class does not have item health
const ESM::RefId& getScript(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getScript(const MWWorld::ConstPtr& ptr) const override;
///< Return name of the script attached to ptr
std::pair<std::vector<int>, bool> getEquipmentSlots(const MWWorld::ConstPtr& ptr) const override;
@ -58,7 +58,7 @@ namespace MWClass
const std::string& getInventoryIcon(const MWWorld::ConstPtr& ptr) const override;
///< Return name of inventory icon.
const ESM::RefId& getEnchantment(const MWWorld::ConstPtr& ptr) const override;
ESM::RefId getEnchantment(const MWWorld::ConstPtr& ptr) const override;
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
const ESM::RefId& applyEnchantment(const MWWorld::ConstPtr& ptr, const ESM::RefId& enchId, int enchCharge,

@ -775,9 +775,9 @@ namespace MWGui
int incr = next ? 1 : -1;
bool found = false;
const ESM::RefId* lastId = &ESM::RefId::sEmpty;
ESM::RefId lastId;
if (selected != -1)
lastId = &model.getItem(selected).mBase.getCellRef().getRefId();
lastId = model.getItem(selected).mBase.getCellRef().getRefId();
ItemModel::ModelIndex cycled = selected;
for (unsigned int i = 0; i < model.getItemCount(); ++i)
{
@ -788,10 +788,10 @@ namespace MWGui
// skip different stacks of the same item, or we will get stuck as stacking/unstacking them may change their
// relative ordering
if (*lastId == item.getCellRef().getRefId())
if (lastId == item.getCellRef().getRefId())
continue;
lastId = &item.getCellRef().getRefId();
lastId = item.getCellRef().getRefId();
if (item.getClass().getType() == ESM::Weapon::sRecordId && isRightHandWeapon(item)
&& item.getClass().canBeEquipped(item, player).first)

@ -1025,7 +1025,7 @@ namespace MWMechanics
}
}
const auto& sound = charClass.getSoundIdFromSndGen(mPtr, soundgen);
const ESM::RefId sound = charClass.getSoundIdFromSndGen(mPtr, soundgen);
if (!sound.empty())
{
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
@ -1485,7 +1485,7 @@ namespace MWMechanics
= MWBase::Environment::get().getWindowManager()->getSelectedSpell();
stats.getSpells().setSelectedSpell(selectedSpell);
}
const ESM::RefId* spellid = &stats.getSpells().getSelectedSpell();
ESM::RefId spellid = stats.getSpells().getSelectedSpell();
bool isMagicItem = false;
// Play hand VFX and allow castSpell use (assuming an animation is going to be played) if
@ -1495,13 +1495,13 @@ namespace MWMechanics
spellCastResult = world->startSpellCast(mPtr);
mCanCast = spellCastResult == MWWorld::SpellCastState::Success;
if (spellid->empty() && cls.hasInventoryStore(mPtr))
if (spellid.empty() && cls.hasInventoryStore(mPtr))
{
MWWorld::InventoryStore& inv = cls.getInventoryStore(mPtr);
if (inv.getSelectedEnchantItem() != inv.end())
{
const MWWorld::Ptr& enchantItem = *inv.getSelectedEnchantItem();
spellid = &enchantItem.getClass().getEnchantment(enchantItem);
spellid = enchantItem.getClass().getEnchantment(enchantItem);
isMagicItem = true;
}
}
@ -1520,7 +1520,7 @@ namespace MWMechanics
}
// Play the spellcasting animation/VFX if the spellcasting was successful or failed due to
// insufficient magicka. Used up powers are exempt from this from some reason.
else if (!spellid->empty() && spellCastResult != MWWorld::SpellCastState::PowerAlreadyUsed)
else if (!spellid.empty() && spellCastResult != MWWorld::SpellCastState::PowerAlreadyUsed)
{
world->breakInvisibility(mPtr);
MWMechanics::CastSpell cast(mPtr, {}, false, mCastingManualSpell);
@ -1529,13 +1529,13 @@ namespace MWMechanics
const MWWorld::ESMStore& store = world->getStore();
if (isMagicItem)
{
const ESM::Enchantment* enchantment = store.get<ESM::Enchantment>().find(*spellid);
const ESM::Enchantment* enchantment = store.get<ESM::Enchantment>().find(spellid);
effects = &enchantment->mEffects.mList;
cast.playSpellCastingEffects(enchantment);
}
else
{
const ESM::Spell* spell = store.get<ESM::Spell>().find(*spellid);
const ESM::Spell* spell = store.get<ESM::Spell>().find(spellid);
effects = &spell->mEffects.mList;
cast.playSpellCastingEffects(spell);
}

@ -45,8 +45,7 @@ namespace MWMechanics
bool applyOnStrikeEnchantment(const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, const MWWorld::Ptr& object,
const osg::Vec3f& hitPosition, const bool fromProjectile)
{
const ESM::RefId& enchantmentName
= !object.isEmpty() ? object.getClass().getEnchantment(object) : ESM::RefId::sEmpty;
const ESM::RefId enchantmentName = !object.isEmpty() ? object.getClass().getEnchantment(object) : ESM::RefId();
if (!enchantmentName.empty())
{
const ESM::Enchantment* enchantment

@ -7,7 +7,6 @@
#include "../mwworld/ptr.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "actorutil.hpp"
#include "creaturestats.hpp"
@ -16,7 +15,7 @@
namespace MWMechanics
{
const ESM::RefId& getLevelledItem(const ESM::LevelledListBase* levItem, bool creature, Misc::Rng::Generator& prng)
ESM::RefId getLevelledItem(const ESM::LevelledListBase* levItem, bool creature, Misc::Rng::Generator& prng)
{
const std::vector<ESM::LevelledListBase::LevelItem>& items = levItem->mList;
@ -24,7 +23,7 @@ namespace MWMechanics
int playerLevel = player.getClass().getCreatureStats(player).getLevel();
if (Misc::Rng::roll0to99(prng) < levItem->mChanceNone)
return ESM::RefId::sEmpty;
return ESM::RefId();
std::vector<const ESM::RefId*> candidates;
int highestLevel = 0;
@ -45,7 +44,7 @@ namespace MWMechanics
candidates.push_back(&levelledItem.mId);
}
if (candidates.empty())
return ESM::RefId::sEmpty;
return ESM::RefId();
const ESM::RefId& item = *candidates[Misc::Rng::rollDice(candidates.size(), prng)];
// Vanilla doesn't fail on nonexistent items in levelled lists
@ -53,7 +52,7 @@ namespace MWMechanics
{
Log(Debug::Warning) << "Warning: ignoring nonexistent item " << item << " in levelled list "
<< levItem->mId;
return ESM::RefId::sEmpty;
return ESM::RefId();
}
// Is this another levelled item or a real item?

@ -13,7 +13,7 @@ namespace MWMechanics
{
/// @return ID of resulting item, or empty if none
const ESM::RefId& getLevelledItem(const ESM::LevelledListBase* levItem, bool creature, Misc::Rng::Generator& prng);
ESM::RefId getLevelledItem(const ESM::LevelledListBase* levItem, bool creature, Misc::Rng::Generator& prng);
}

@ -69,7 +69,7 @@ namespace MWMechanics
return summonMap;
}
const ESM::RefId& getSummonedCreature(int effectId)
ESM::RefId getSummonedCreature(int effectId)
{
const auto& summonMap = getSummonMap();
auto it = summonMap.find(effectId);
@ -77,7 +77,7 @@ namespace MWMechanics
{
return it->second;
}
return ESM::RefId::sEmpty;
return ESM::RefId();
}
int summonCreature(int effectId, const MWWorld::Ptr& summoner)

@ -16,7 +16,7 @@ namespace MWMechanics
{
bool isSummoningEffect(int effectId);
const ESM::RefId& getSummonedCreature(int effectId);
ESM::RefId getSummonedCreature(int effectId);
void purgeSummonEffect(const MWWorld::Ptr& summoner, const std::pair<int, int>& summon);

@ -52,25 +52,25 @@ namespace MWScript
std::pair<char, bool> CompilerContext::getMemberType(const std::string& name, const ESM::RefId& id) const
{
const ESM::RefId* script = nullptr;
ESM::RefId script;
bool reference = false;
if (const ESM::Script* scriptRecord = MWBase::Environment::get().getESMStore()->get<ESM::Script>().search(id))
{
script = &scriptRecord->mId;
script = scriptRecord->mId;
}
else
{
MWWorld::ManualRef ref(*MWBase::Environment::get().getESMStore(), id);
script = &ref.getPtr().getClass().getScript(ref.getPtr());
script = ref.getPtr().getClass().getScript(ref.getPtr());
reference = true;
}
char type = ' ';
if (script && !script->empty())
type = MWBase::Environment::get().getScriptManager()->getLocals(*script).getType(
if (!script.empty())
type = MWBase::Environment::get().getScriptManager()->getLocals(script).getType(
Misc::StringUtils::lowerCase(name));
return std::make_pair(type, reference);

@ -85,14 +85,14 @@ namespace
struct IdGettingVisitor
{
const ESM::RefId& operator()(const MWWorld::Ptr& ptr) const
ESM::RefId operator()(const MWWorld::Ptr& ptr) const
{
if (ptr.isEmpty())
return ESM::RefId::sEmpty;
return ESM::RefId();
return ptr.mRef->mRef.getRefId();
}
const ESM::RefId& operator()(const std::pair<ESM::RefNum, ESM::RefId>& pair) const { return pair.second; }
ESM::RefId operator()(const std::pair<ESM::RefNum, ESM::RefId>& pair) const { return pair.second; }
};
}
@ -115,7 +115,7 @@ namespace MWScript
return ptr;
}
const ESM::RefId& GlobalScriptDesc::getId() const
ESM::RefId GlobalScriptDesc::getId() const
{
return std::visit(IdGettingVisitor{}, mTarget);
}

@ -49,7 +49,7 @@ namespace MWScript
MWWorld::Ptr getPtr(); // Resolves mTarget to a Ptr and caches the (potentially empty) result
const ESM::RefId& getId() const; // Returns the target's ID -- if any
ESM::RefId getId() const; // Returns the target's ID -- if any
};
class GlobalScripts

@ -44,7 +44,7 @@ namespace MWScript
}
}
const Locals& InterpreterContext::getMemberLocals(std::reference_wrapper<const ESM::RefId>& id, bool global) const
const Locals& InterpreterContext::getMemberLocals(bool global, ESM::RefId& id) const
{
if (global)
{
@ -54,7 +54,7 @@ namespace MWScript
{
const MWWorld::Ptr ptr = getReferenceImp(id, false);
id = std::ref(ptr.getClass().getScript(ptr));
id = ptr.getClass().getScript(ptr);
ptr.getRefData().setLocals(*MWBase::Environment::get().getESMStore()->get<ESM::Script>().find(id));
@ -62,7 +62,7 @@ namespace MWScript
}
}
Locals& InterpreterContext::getMemberLocals(std::reference_wrapper<const ESM::RefId>& id, bool global)
Locals& InterpreterContext::getMemberLocals(bool global, ESM::RefId& id)
{
if (global)
{
@ -72,7 +72,7 @@ namespace MWScript
{
const MWWorld::Ptr ptr = getReferenceImp(id, false);
id = std::ref(ptr.getClass().getScript(ptr));
id = ptr.getClass().getScript(ptr);
ptr.getRefData().setLocals(*MWBase::Environment::get().getESMStore()->get<ESM::Script>().find(id));
@ -133,13 +133,13 @@ namespace MWScript
mGlobalScriptDesc = globalScriptDesc;
}
const ESM::RefId& InterpreterContext::getTarget() const
ESM::RefId InterpreterContext::getTarget() const
{
if (!mReference.isEmpty())
return mReference.mRef->mRef.getRefId();
else if (mGlobalScriptDesc)
return mGlobalScriptDesc->getId();
return ESM::RefId::sEmpty;
return ESM::RefId();
}
int InterpreterContext::getLocalShort(int index) const
@ -435,52 +435,46 @@ namespace MWScript
#endif
}
int InterpreterContext::getMemberShort(const ESM::RefId& id, std::string_view name, bool global) const
int InterpreterContext::getMemberShort(ESM::RefId id, std::string_view name, bool global) const
{
auto idRefWrapper = std::ref(id);
const Locals& locals = getMemberLocals(idRefWrapper, global);
const Locals& locals = getMemberLocals(global, id);
return locals.mShorts[findLocalVariableIndex(idRefWrapper, name, 's')];
return locals.mShorts[findLocalVariableIndex(id, name, 's')];
}
int InterpreterContext::getMemberLong(const ESM::RefId& id, std::string_view name, bool global) const
int InterpreterContext::getMemberLong(ESM::RefId id, std::string_view name, bool global) const
{
auto idRefWrapper = std::ref(id);
const Locals& locals = getMemberLocals(idRefWrapper, global);
const Locals& locals = getMemberLocals(global, id);
return locals.mLongs[findLocalVariableIndex(idRefWrapper, name, 'l')];
return locals.mLongs[findLocalVariableIndex(id, name, 'l')];
}
float InterpreterContext::getMemberFloat(const ESM::RefId& id, std::string_view name, bool global) const
float InterpreterContext::getMemberFloat(ESM::RefId id, std::string_view name, bool global) const
{
auto idRefWrapper = std::ref(id);
const Locals& locals = getMemberLocals(idRefWrapper, global);
const Locals& locals = getMemberLocals(global, id);
return locals.mFloats[findLocalVariableIndex(idRefWrapper, name, 'f')];
return locals.mFloats[findLocalVariableIndex(id, name, 'f')];
}
void InterpreterContext::setMemberShort(const ESM::RefId& id, std::string_view name, int value, bool global)
void InterpreterContext::setMemberShort(ESM::RefId id, std::string_view name, int value, bool global)
{
auto idRefWrapper = std::ref(id);
Locals& locals = getMemberLocals(idRefWrapper, global);
Locals& locals = getMemberLocals(global, id);
locals.mShorts[findLocalVariableIndex(idRefWrapper, name, 's')] = value;
locals.mShorts[findLocalVariableIndex(id, name, 's')] = value;
}
void InterpreterContext::setMemberLong(const ESM::RefId& id, std::string_view name, int value, bool global)
void InterpreterContext::setMemberLong(ESM::RefId id, std::string_view name, int value, bool global)
{
auto idRefWrapper = std::ref(id);
Locals& locals = getMemberLocals(idRefWrapper, global);
Locals& locals = getMemberLocals(global, id);
locals.mLongs[findLocalVariableIndex(idRefWrapper, name, 'l')] = value;
locals.mLongs[findLocalVariableIndex(id, name, 'l')] = value;
}
void InterpreterContext::setMemberFloat(const ESM::RefId& id, std::string_view name, float value, bool global)
void InterpreterContext::setMemberFloat(ESM::RefId id, std::string_view name, float value, bool global)
{
auto idRefWrapper = std::ref(id);
Locals& locals = getMemberLocals(idRefWrapper, global);
Locals& locals = getMemberLocals(global, id);
locals.mFloats[findLocalVariableIndex(idRefWrapper, name, 'f')] = value;
locals.mFloats[findLocalVariableIndex(id, name, 'f')] = value;
}
MWWorld::Ptr InterpreterContext::getReference(bool required) const

@ -32,10 +32,10 @@ namespace MWScript
const MWWorld::Ptr getReferenceImp(
const ESM::RefId& id = ESM::RefId(), bool activeOnly = false, bool doThrow = true) const;
const Locals& getMemberLocals(std::reference_wrapper<const ESM::RefId>& id, bool global) const;
const Locals& getMemberLocals(bool global, ESM::RefId& id) const;
///< \a id is changed to the respective script ID, if \a id wasn't a script ID before
Locals& getMemberLocals(std::reference_wrapper<const ESM::RefId>& id, bool global);
Locals& getMemberLocals(bool global, ESM::RefId& id);
///< \a id is changed to the respective script ID, if \a id wasn't a script ID before
/// Throws an exception if local variable can't be found.
@ -47,7 +47,7 @@ namespace MWScript
InterpreterContext(MWScript::Locals* locals, const MWWorld::Ptr& reference);
///< The ownership of \a locals is not transferred. 0-pointer allowed.
const ESM::RefId& getTarget() const override;
ESM::RefId getTarget() const override;
int getLocalShort(int index) const override;
@ -113,17 +113,17 @@ namespace MWScript
void executeActivation(const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor);
///< Execute the activation action for this ptr. If ptr is mActivated, mark activation as handled.
int getMemberShort(const ESM::RefId& id, std::string_view name, bool global) const override;
int getMemberShort(ESM::RefId id, std::string_view name, bool global) const override;
int getMemberLong(const ESM::RefId& id, std::string_view name, bool global) const override;
int getMemberLong(ESM::RefId id, std::string_view name, bool global) const override;
float getMemberFloat(const ESM::RefId& id, std::string_view name, bool global) const override;
float getMemberFloat(ESM::RefId id, std::string_view name, bool global) const override;
void setMemberShort(const ESM::RefId& id, std::string_view name, int value, bool global) override;
void setMemberShort(ESM::RefId id, std::string_view name, int value, bool global) override;
void setMemberLong(const ESM::RefId& id, std::string_view name, int value, bool global) override;
void setMemberLong(ESM::RefId id, std::string_view name, int value, bool global) override;
void setMemberFloat(const ESM::RefId& id, std::string_view name, float value, bool global) override;
void setMemberFloat(ESM::RefId id, std::string_view name, float value, bool global) override;
MWWorld::Ptr getReference(bool required = true) const;
///< Reference, that the script is running from (can be empty)

@ -33,9 +33,9 @@
namespace
{
const ESM::RefId& getDialogueActorFaction(const MWWorld::ConstPtr& actor)
ESM::RefId getDialogueActorFaction(const MWWorld::ConstPtr& actor)
{
const ESM::RefId& factionId = actor.getClass().getPrimaryFaction(actor);
ESM::RefId factionId = actor.getClass().getPrimaryFaction(actor);
if (factionId.empty())
throw std::runtime_error("failed to determine dialogue actors faction (because actor is factionless)");

@ -97,12 +97,12 @@ namespace MWWorld
};
auto esm4Visit = [&](const ESM4::Reference& ref) -> ESM::RefId {
if (ref.mDoor.destDoor.isZeroOrUnset())
return ESM::RefId::sEmpty;
return ESM::RefId();
const ESM4::Reference* refDest
= MWBase::Environment::get().getESMStore()->get<ESM4::Reference>().searchStatic(ref.mDoor.destDoor);
if (refDest)
return refDest->mParent;
return ESM::RefId::sEmpty;
return ESM::RefId();
};
return std::visit(ESM::VisitOverload{ esm3Visit, esm4Visit }, mCellRef.mVariant);

@ -38,12 +38,12 @@ namespace MWWorld
bool hasContentFile() const { return getRefNum().hasContentFile(); }
// Id of object being referenced
const ESM::RefId& getRefId() const
ESM::RefId getRefId() const
{
struct Visitor
{
const ESM::RefId& operator()(const ESM::CellRef& ref) { return ref.mRefID; }
const ESM::RefId& operator()(const ESM4::Reference& ref) { return ref.mBaseObj; }
ESM::RefId operator()(const ESM::CellRef& ref) { return ref.mRefID; }
ESM::RefId operator()(const ESM4::Reference& ref) { return ref.mBaseObj; }
};
return std::visit(Visitor(), mCellRef.mVariant);
}
@ -115,12 +115,12 @@ namespace MWWorld
void applyChargeRemainderToBeSubtracted(float chargeRemainder); // Stores remainders and applies if > 1
// The NPC that owns this object (and will get angry if you steal it)
const ESM::RefId& getOwner() const
ESM::RefId getOwner() const
{
struct Visitor
{
const ESM::RefId& operator()(const ESM::CellRef& ref) { return ref.mOwner; }
const ESM::RefId& operator()(const ESM4::Reference& /*ref*/) { return ESM::RefId::sEmpty; }
ESM::RefId operator()(const ESM::CellRef& ref) { return ref.mOwner; }
ESM::RefId operator()(const ESM4::Reference& /*ref*/) { return ESM::RefId(); }
};
return std::visit(Visitor(), mCellRef.mVariant);
}
@ -134,12 +134,12 @@ namespace MWWorld
void resetGlobalVariable();
// ID of creature trapped in this soul gem
const ESM::RefId& getSoul() const
ESM::RefId getSoul() const
{
struct Visitor
{
const ESM::RefId& operator()(const ESM::CellRef& ref) { return ref.mSoul; }
const ESM::RefId& operator()(const ESM4::Reference& /*ref*/) { return ESM::RefId::sEmpty; }
ESM::RefId operator()(const ESM::CellRef& ref) { return ref.mSoul; }
ESM::RefId operator()(const ESM4::Reference& /*ref*/) { return ESM::RefId(); }
};
return std::visit(Visitor(), mCellRef.mVariant);
}
@ -147,12 +147,12 @@ namespace MWWorld
// The faction that owns this object (and will get angry if
// you take it and are not a faction member)
const ESM::RefId& getFaction() const
ESM::RefId getFaction() const
{
struct Visitor
{
const ESM::RefId& operator()(const ESM::CellRef& ref) { return ref.mFaction; }
const ESM::RefId& operator()(const ESM4::Reference& /*ref*/) { return ESM::RefId::sEmpty; }
ESM::RefId operator()(const ESM::CellRef& ref) { return ref.mFaction; }
ESM::RefId operator()(const ESM4::Reference& /*ref*/) { return ESM::RefId(); }
};
return std::visit(Visitor(), mCellRef.mVariant);
}
@ -176,16 +176,17 @@ namespace MWWorld
void lock(int lockLevel);
void unlock();
// Key and trap ID names, if any
const ESM::RefId& getKey() const
ESM::RefId getKey() const
{
return std::visit([](auto&& ref) -> const ESM::RefId& { return ref.mKey; }, mCellRef.mVariant);
}
const ESM::RefId& getTrap() const
ESM::RefId getTrap() const
{
struct Visitor
{
const ESM::RefId& operator()(const ESM::CellRef& ref) { return ref.mTrap; }
const ESM::RefId& operator()(const ESM4::Reference& /*ref*/) { return ESM::RefId::sEmpty; }
ESM::RefId operator()(const ESM::CellRef& ref) { return ref.mTrap; }
ESM::RefId operator()(const ESM4::Reference& /*ref*/) { return ESM::RefId(); }
};
return std::visit(Visitor(), mCellRef.mVariant);
}

@ -169,9 +169,9 @@ namespace MWWorld
return -1;
}
const ESM::RefId& Class::getScript(const ConstPtr& ptr) const
ESM::RefId Class::getScript(const ConstPtr& ptr) const
{
return ESM::RefId::sEmpty;
return ESM::RefId();
}
float Class::getMaxSpeed(const Ptr& ptr) const
@ -275,7 +275,7 @@ namespace MWWorld
throw std::runtime_error("class does not have an down sound");
}
const ESM::RefId& Class::getSoundIdFromSndGen(const Ptr& ptr, std::string_view type) const
ESM::RefId Class::getSoundIdFromSndGen(const Ptr& ptr, std::string_view type) const
{
throw std::runtime_error("class does not support soundgen look up");
}
@ -303,9 +303,9 @@ namespace MWWorld
return true;
}
const ESM::RefId& Class::getEnchantment(const ConstPtr& ptr) const
ESM::RefId Class::getEnchantment(const ConstPtr& ptr) const
{
return ESM::RefId::sEmpty;
return ESM::RefId();
}
void Class::adjustScale(const MWWorld::ConstPtr& ptr, osg::Vec3f& scale, bool rendering) const {}
@ -476,9 +476,9 @@ namespace MWWorld
return encumbrance / capacity;
}
const ESM::RefId& Class::getSound(const MWWorld::ConstPtr&) const
ESM::RefId Class::getSound(const MWWorld::ConstPtr&) const
{
return ESM::RefId::sEmpty;
return ESM::RefId();
}
int Class::getBaseFightRating(const ConstPtr& ptr) const
@ -486,9 +486,9 @@ namespace MWWorld
throw std::runtime_error("class does not support fight rating");
}
const ESM::RefId& Class::getPrimaryFaction(const MWWorld::ConstPtr& ptr) const
ESM::RefId Class::getPrimaryFaction(const MWWorld::ConstPtr& ptr) const
{
return ESM::RefId::sEmpty;
return ESM::RefId();
}
int Class::getPrimaryFactionRank(const MWWorld::ConstPtr& ptr) const
{

@ -179,7 +179,7 @@ namespace MWWorld
///< Returns the remaining duration of the object, such as an equippable light
/// source. (default implementation: -1, i.e. infinite)
virtual const ESM::RefId& getScript(const ConstPtr& ptr) const;
virtual ESM::RefId getScript(const ConstPtr& ptr) const;
///< Return name of the script attached to ptr (default implementation: return an empty
/// string).
@ -252,7 +252,7 @@ namespace MWWorld
///< Return the down sound ID of \a ptr or throw an exception, if class does not support ID retrieval
/// (default implementation: throw an exception)
virtual const ESM::RefId& getSoundIdFromSndGen(const Ptr& ptr, std::string_view type) const;
virtual ESM::RefId getSoundIdFromSndGen(const Ptr& ptr, std::string_view type) const;
///< Returns the sound ID for \a ptr of the given soundgen \a type.
virtual float getArmorRating(const MWWorld::Ptr& ptr) const;
@ -261,7 +261,7 @@ namespace MWWorld
virtual const std::string& getInventoryIcon(const MWWorld::ConstPtr& ptr) const;
///< Return name of inventory icon.
virtual const ESM::RefId& getEnchantment(const MWWorld::ConstPtr& ptr) const;
virtual ESM::RefId getEnchantment(const MWWorld::ConstPtr& ptr) const;
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
/// (default implementation: return empty string)
@ -359,11 +359,11 @@ namespace MWWorld
virtual void respawn(const MWWorld::Ptr& ptr) const {}
/// Returns sound id
virtual const ESM::RefId& getSound(const MWWorld::ConstPtr& ptr) const;
virtual ESM::RefId getSound(const MWWorld::ConstPtr& ptr) const;
virtual int getBaseFightRating(const MWWorld::ConstPtr& ptr) const;
virtual const ESM::RefId& getPrimaryFaction(const MWWorld::ConstPtr& ptr) const;
virtual ESM::RefId getPrimaryFaction(const MWWorld::ConstPtr& ptr) const;
virtual int getPrimaryFactionRank(const MWWorld::ConstPtr& ptr) const;
/// Get the effective armor rating, factoring in the actor's skills, for the given armor.

@ -2738,7 +2738,7 @@ namespace MWWorld
return cellId;
}
return ESM::RefId::sEmpty;
return ESM::RefId();
}
ESM::RefId World::findExteriorPosition(std::string_view nameId, ESM::Position& pos)
@ -2785,7 +2785,7 @@ namespace MWWorld
return ext->getId();
}
return ESM::RefId::sEmpty;
return ESM::RefId();
}
void World::enableTeleporting(bool enable)

@ -155,8 +155,8 @@ void MWWorld::WorldModel::writeCell(ESM::ESMWriter& writer, CellStore& cell) con
MWWorld::WorldModel::WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCache& readers)
: mStore(store)
, mReaders(readers)
, mIdCache(std::clamp(Settings::Manager::getInt("pointers cache size", "Cells"), 40, 1000),
{ ESM::RefId::sEmpty, nullptr })
, mIdCache(
std::clamp(Settings::Manager::getInt("pointers cache size", "Cells"), 40, 1000), { ESM::RefId(), nullptr })
{
}

@ -147,7 +147,7 @@ namespace
std::map<ESM::RefId, GlobalVariables> mMembers;
public:
const ESM::RefId& getTarget() const override { return ESM::RefId::sEmpty; }
ESM::RefId getTarget() const override { return ESM::RefId(); }
int getLocalShort(int index) const override { return mLocals.getShort(index); }
@ -207,7 +207,7 @@ namespace
std::string_view getCurrentCellName() const override { return {}; }
int getMemberShort(const ESM::RefId& id, std::string_view name, bool global) const override
int getMemberShort(ESM::RefId id, std::string_view name, bool global) const override
{
auto it = mMembers.find(id);
if (it != mMembers.end())
@ -215,7 +215,7 @@ namespace
return {};
}
int getMemberLong(const ESM::RefId& id, std::string_view name, bool global) const override
int getMemberLong(ESM::RefId id, std::string_view name, bool global) const override
{
auto it = mMembers.find(id);
if (it != mMembers.end())
@ -223,7 +223,7 @@ namespace
return {};
}
float getMemberFloat(const ESM::RefId& id, std::string_view name, bool global) const override
float getMemberFloat(ESM::RefId id, std::string_view name, bool global) const override
{
auto it = mMembers.find(id);
if (it != mMembers.end())
@ -231,17 +231,17 @@ namespace
return {};
}
void setMemberShort(const ESM::RefId& id, std::string_view name, int value, bool global) override
void setMemberShort(ESM::RefId id, std::string_view name, int value, bool global) override
{
mMembers[id].setShort(name, value);
}
void setMemberLong(const ESM::RefId& id, std::string_view name, int value, bool global) override
void setMemberLong(ESM::RefId id, std::string_view name, int value, bool global) override
{
mMembers[id].setLong(name, value);
}
void setMemberFloat(const ESM::RefId& id, std::string_view name, float value, bool global) override
void setMemberFloat(ESM::RefId id, std::string_view name, float value, bool global) override
{
mMembers[id].setFloat(name, value);
}

@ -124,8 +124,6 @@ namespace ESM
};
}
const RefId RefId::sEmpty = {};
std::string EmptyRefId::toString() const
{
return std::string();

@ -48,8 +48,6 @@ namespace ESM
class RefId
{
public:
const static RefId sEmpty;
using Value
= std::variant<EmptyRefId, StringRefId, FormIdRefId, GeneratedRefId, IndexRefId, ESM3ExteriorCellRefId>;

@ -149,7 +149,7 @@ namespace ESM
{
if (isNextSub(name))
return getRefId();
return ESM::RefId::sEmpty;
return ESM::RefId();
}
void ESMReader::skipHNORefId(NAME name)

@ -13,7 +13,7 @@ namespace Interpreter
public:
virtual ~Context() {}
virtual const ESM::RefId& getTarget() const = 0;
virtual ESM::RefId getTarget() const = 0;
virtual int getLocalShort(int index) const = 0;
@ -79,17 +79,17 @@ namespace Interpreter
virtual std::string_view getCurrentCellName() const = 0;
virtual int getMemberShort(const ESM::RefId& id, std::string_view name, bool global) const = 0;
virtual int getMemberShort(ESM::RefId id, std::string_view name, bool global) const = 0;
virtual int getMemberLong(const ESM::RefId& id, std::string_view name, bool global) const = 0;
virtual int getMemberLong(ESM::RefId id, std::string_view name, bool global) const = 0;
virtual float getMemberFloat(const ESM::RefId& id, std::string_view name, bool global) const = 0;
virtual float getMemberFloat(ESM::RefId id, std::string_view name, bool global) const = 0;
virtual void setMemberShort(const ESM::RefId& id, std::string_view name, int value, bool global) = 0;
virtual void setMemberShort(ESM::RefId id, std::string_view name, int value, bool global) = 0;
virtual void setMemberLong(const ESM::RefId& id, std::string_view name, int value, bool global) = 0;
virtual void setMemberLong(ESM::RefId id, std::string_view name, int value, bool global) = 0;
virtual void setMemberFloat(const ESM::RefId& id, std::string_view name, float value, bool global) = 0;
virtual void setMemberFloat(ESM::RefId id, std::string_view name, float value, bool global) = 0;
};
}

Loading…
Cancel
Save