mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-08-03 15:27:13 -04:00
Use overload
This commit is contained in:
parent
5203f300e2
commit
7c665643ad
@ -91,10 +91,10 @@ namespace
|
||||
npc.mNpdt.mDisposition = rec["baseDisposition"].get<int>();
|
||||
|
||||
if (rec["baseGold"] != sol::nil)
|
||||
npc.mNpdt.mGold = static_cast<int>(rec["baseGold"]);
|
||||
npc.mNpdt.mGold = rec["baseGold"].get<int>();
|
||||
|
||||
if (rec["bloodType"] != sol::nil)
|
||||
npc.mBloodType = static_cast<int>(rec["bloodType"]);
|
||||
npc.mBloodType = rec["bloodType"].get<int>();
|
||||
|
||||
// Services offered
|
||||
if (rec["servicesOffered"] != sol::nil)
|
||||
|
@ -269,13 +269,29 @@ namespace MWWorld
|
||||
list.push_back((*it)->mId);
|
||||
}
|
||||
}
|
||||
template <class IdType, class StaticMap>
|
||||
inline bool shouldInsert(const IdType& id, const StaticMap& map)
|
||||
{
|
||||
auto it = map.find(id);
|
||||
return it != map.end();
|
||||
}
|
||||
|
||||
template <class StaticMap>
|
||||
inline bool shouldInsert(const ESM::RefId& id, const StaticMap& map)
|
||||
{
|
||||
if (!id.template is<ESM::GeneratedRefId>())
|
||||
{
|
||||
auto it = map.find(id);
|
||||
return it != map.end();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
template <class T, class Id>
|
||||
T* TypedDynamicStore<T, Id>::insert(const T& item, bool overrideOnly)
|
||||
{
|
||||
if (overrideOnly)
|
||||
{
|
||||
auto it = mStatic.find(item.mId);
|
||||
if (it == mStatic.end())
|
||||
if (!shouldInsert(item.mId, mStatic))
|
||||
return nullptr;
|
||||
}
|
||||
std::pair<typename Dynamic::iterator, bool> result = mDynamic.insert_or_assign(item.mId, item);
|
||||
|
Loading…
x
Reference in New Issue
Block a user