Remove redundant getId function

openmw-38
scrawl 9 years ago
parent 266fbbef48
commit 04f7a8f8eb

@ -26,10 +26,6 @@
namespace MWClass
{
std::string Activator::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Activator>()->mBase->mId;
}
void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -12,9 +12,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -20,10 +20,6 @@
namespace MWClass
{
std::string Apparatus::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Apparatus>()->mBase->mId;
}
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -12,9 +12,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;

@ -26,10 +26,6 @@
namespace MWClass
{
std::string Armor::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Armor>()->mBase->mId;
}
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual float getWeight (const MWWorld::ConstPtr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;

@ -23,10 +23,6 @@
namespace MWClass
{
std::string Book::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Book>()->mBase->mId;
}
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -22,10 +22,6 @@
namespace MWClass
{
std::string Clothing::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Clothing>()->mBase->mId;
}
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -47,11 +47,6 @@ namespace MWClass
return new ContainerCustomData (*this);
}
std::string Container::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Container>()->mBase->mId;
}
void Container::ensureCustomData (const MWWorld::Ptr& ptr) const
{
if (!ptr.getRefData().getCustomData())

@ -14,9 +14,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -154,21 +154,13 @@ namespace MWClass
// store
ptr.getRefData().setCustomData(data.release());
getContainerStore(ptr).fill(ref->mBase->mInventory, getId(ptr));
getContainerStore(ptr).fill(ref->mBase->mInventory, ptr.getCellRef().getRefId());
if (hasInventory)
getInventoryStore(ptr).autoEquip(ptr);
}
}
std::string Creature::getId (const MWWorld::Ptr& ptr) const
{
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->mBase->mId;
}
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
MWRender::Objects& objects = renderingInterface.getObjects();
@ -335,7 +327,7 @@ namespace MWClass
}
if(!object.isEmpty())
getCreatureStats(ptr).setLastHitAttemptObject(object.getClass().getId(object));
getCreatureStats(ptr).setLastHitAttemptObject(object.getCellRef().getRefId());
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWMechanics::getPlayer())
{
@ -353,7 +345,7 @@ namespace MWClass
}
if(!object.isEmpty())
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
getCreatureStats(ptr).setLastHitObject(object.getCellRef().getRefId());
if (damage > 0.0f && !object.isEmpty())
MWMechanics::resistNormalWeapon(ptr, attacker, object, damage);
@ -571,7 +563,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature>* ref = ptr.get<ESM::Creature>();
const std::string& ourId = (ref->mBase->mOriginal.empty()) ? getId(ptr) : ref->mBase->mOriginal;
const std::string& ourId = (ref->mBase->mOriginal.empty()) ? ptr.getCellRef().getRefId() : ref->mBase->mOriginal;
MWWorld::Store<ESM::SoundGenerator>::iterator sound = store.begin();
while(sound != store.end())

@ -40,9 +40,6 @@ namespace MWClass
public:
virtual std::string getId (const MWWorld::Ptr& ptr) const;
///< Return ID of \a ptr
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -29,11 +29,6 @@ namespace MWClass
return new CreatureLevListCustomData (*this);
}
std::string CreatureLevList::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::CreatureLevList>()->mBase->mId;
}
std::string CreatureLevList::getName (const MWWorld::ConstPtr& ptr) const
{
return "";

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.

@ -48,11 +48,6 @@ namespace MWClass
return new DoorCustomData (*this);
}
std::string Door::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Door>()->mBase->mId;
}
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
if (!model.empty()) {

@ -15,9 +15,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -23,13 +23,6 @@
namespace MWClass
{
std::string Ingredient::getId (const MWWorld::Ptr& ptr) const
{
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->mBase->mId;
}
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
virtual std::string getId (const MWWorld::Ptr& ptr) const;
///< Return ID of \a ptr
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -4,10 +4,6 @@
namespace MWClass
{
std::string ItemLevList::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::ItemLevList>()->mBase->mId;
}
std::string ItemLevList::getName (const MWWorld::ConstPtr& ptr) const
{

@ -9,9 +9,6 @@ namespace MWClass
{
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.

@ -27,10 +27,6 @@
namespace MWClass
{
std::string Light::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Light>()->mBase->mId;
}
void Light::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,10 +11,7 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;

@ -21,10 +21,6 @@
namespace MWClass
{
std::string Lockpick::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Lockpick>()->mBase->mId;
}
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -34,10 +34,6 @@ namespace MWClass
|| Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "gold_025")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "gold_100");
}
std::string Miscellaneous::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Miscellaneous>()->mBase->mId;
}
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -395,7 +395,7 @@ namespace MWClass
// inventory
// setting ownership is used to make the NPC auto-equip his initial equipment only, and not bartered items
data->mInventoryStore.fill(ref->mBase->mInventory, getId(ptr));
data->mInventoryStore.fill(ref->mBase->mInventory, ptr.getCellRef().getRefId());
data->mNpcStats.setGoldPool(gold);
@ -406,14 +406,6 @@ namespace MWClass
}
}
std::string Npc::getId (const MWWorld::Ptr& ptr) const
{
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->mBase->mId;
}
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{
renderingInterface.getObjects().insertNPC(ptr);
@ -603,7 +595,7 @@ namespace MWClass
}
if(!object.isEmpty())
getCreatureStats(ptr).setLastHitAttemptObject(object.getClass().getId(object));
getCreatureStats(ptr).setLastHitAttemptObject(object.getCellRef().getRefId());
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWMechanics::getPlayer())
{
@ -621,7 +613,7 @@ namespace MWClass
}
if(!object.isEmpty())
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
getCreatureStats(ptr).setLastHitObject(object.getCellRef().getRefId());
if (damage > 0.0f && !object.isEmpty())

@ -44,9 +44,6 @@ namespace MWClass
public:
virtual std::string getId (const MWWorld::Ptr& ptr) const;
///< Return ID of \a ptr
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -24,10 +24,6 @@
namespace MWClass
{
std::string Potion::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Potion>()->mBase->mId;
}
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -21,10 +21,6 @@
namespace MWClass
{
std::string Probe::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Probe>()->mBase->mId;
}
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -20,10 +20,6 @@
namespace MWClass
{
std::string Repair::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Repair>()->mBase->mId;
}
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -11,10 +11,6 @@
namespace MWClass
{
std::string Static::getId (const MWWorld::Ptr& ptr) const
{
return ptr.get<ESM::Static>()->mBase->mId;
}
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -11,9 +11,6 @@ namespace MWClass
public:
/// Return ID of \a ptr
virtual std::string getId (const MWWorld::Ptr& ptr) const;
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -22,12 +22,6 @@
namespace MWClass
{
std::string Weapon::getId (const MWWorld::Ptr& ptr) const
{
MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
return ref->mBase->mId;
}
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{

@ -12,9 +12,6 @@ namespace MWClass
public:
virtual std::string getId (const MWWorld::Ptr& ptr) const;
///< Return ID of \a ptr
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
///< Add reference into a cell for rendering

@ -28,7 +28,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
// actor id
if (!info.mActor.empty())
{
if ( !Misc::StringUtils::ciEqual(info.mActor, mActor.getClass().getId (mActor)))
if ( !Misc::StringUtils::ciEqual(info.mActor, mActor.getCellRef().getRefId()))
return false;
}
else if (isCreature)
@ -438,7 +438,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_NotId:
return !Misc::StringUtils::ciEqual(mActor.getClass().getId (mActor), select.getName());
return !Misc::StringUtils::ciEqual(mActor.getCellRef().getRefId(), select.getName());
case SelectWrapper::Function_NotFaction:

@ -93,7 +93,7 @@ namespace MWGui
Spell newSpell;
newSpell.mItem = item;
newSpell.mId = item.getClass().getId(item);
newSpell.mId = item.getCellRef().getRefId();
newSpell.mName = item.getClass().getName(item);
newSpell.mType = Spell::Type_EnchantedItem;
newSpell.mSelected = invStore.getSelectedEnchantItem() == it;

@ -421,8 +421,8 @@ int MWMechanics::Alchemy::addIngredient (const MWWorld::Ptr& ingredient)
return -1;
for (TIngredientsIterator iter (mIngredients.begin()); iter!=mIngredients.end(); ++iter)
if (!iter->isEmpty() && Misc::StringUtils::ciEqual(ingredient.getClass().getId(ingredient),
iter->getClass().getId(*iter)))
if (!iter->isEmpty() && Misc::StringUtils::ciEqual(ingredient.getCellRef().getRefId(),
iter->getCellRef().getRefId()))
return -1;
mIngredients[slot] = ingredient;

@ -983,7 +983,7 @@ namespace MWMechanics
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
{
StolenItemsMap::iterator stolenIt = mStolenItems.find(Misc::StringUtils::lowerCase(it->getClass().getId(*it)));
StolenItemsMap::iterator stolenIt = mStolenItems.find(Misc::StringUtils::lowerCase(it->getCellRef().getRefId()));
if (stolenIt == mStolenItems.end())
continue;
OwnerMap& owners = stolenIt->second;
@ -1045,7 +1045,7 @@ namespace MWMechanics
Misc::StringUtils::lowerCaseInPlace(owner.first);
if (!Misc::StringUtils::ciEqual(item.getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId))
mStolenItems[Misc::StringUtils::lowerCase(item.getClass().getId(item))][owner] += count;
mStolenItems[Misc::StringUtils::lowerCase(item.getCellRef().getRefId())][owner] += count;
commitCrime(ptr, victim, OT_Theft, item.getClass().getValue(item) * count);
}

@ -145,7 +145,7 @@ namespace MWScript
// selected), store the ID of that reference store it so it can be inherited by
// targeted scripts started from this one.
if (targetId.empty() && !reference.isEmpty())
mTargetId = reference.getClass().getId (reference);
mTargetId = reference.getCellRef().getRefId();
}
int InterpreterContext::getLocalShort (int index) const

@ -19,7 +19,7 @@ namespace MWWorld
getTarget().getContainerStore()->remove(getTarget(), 1, actor);
// apply to actor
std::string id = getTarget().getClass().getId (getTarget());
std::string id = getTarget().getCellRef().getRefId();
if (actor.getClass().apply (actor, id, actor) && actor == MWMechanics::getPlayer())
actor.getClass().skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1);

@ -30,11 +30,6 @@ namespace MWWorld
Class::~Class() {}
std::string Class::getId (const Ptr& ptr) const
{
throw std::runtime_error ("class does not support ID retrieval");
}
void Class::insertObjectRendering (const Ptr& ptr, const std::string& mesh, MWRender::RenderingInterface& renderingInterface) const
{

@ -76,12 +76,6 @@ namespace MWWorld
return mTypeName;
}
virtual std::string getId (const Ptr& ptr) const;
///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval
/// (default implementation: throw an exception)
/// @note This function is currently redundant; the same ID can be retrieved by CellRef::getRefId.
/// Leaving it here for now in case we want to optimize later.
virtual void insertObjectRendering (const Ptr& ptr, const std::string& mesh, MWRender::RenderingInterface& renderingInterface) const;
virtual void insertObject(const Ptr& ptr, const std::string& mesh, MWPhysics::PhysicsSystem& physics) const;
///< Add reference into a cell for rendering (default implementation: don't render anything).

@ -700,7 +700,7 @@ void MWWorld::InventoryStore::purgeEffect(short effectId, const std::string &sou
if (*iter==end())
continue;
if ((*iter)->getClass().getId(**iter) != sourceId)
if ((*iter)->getCellRef().getRefId() != sourceId)
continue;
std::string enchantmentId = (*iter)->getClass().getEnchantment (**iter);

@ -32,7 +32,7 @@ namespace
MWRender::RenderingManager& rendering)
{
std::string model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr), rendering.getResourceSystem()->getVFS());
std::string id = ptr.getClass().getId(ptr);
std::string id = ptr.getCellRef().getRefId();
if (id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker")
model = ""; // marker objects that have a hardcoded function in the game logic, should be hidden from the player
ptr.getClass().insertObjectRendering(ptr, model, rendering);

Loading…
Cancel
Save