mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-12 14:01:15 -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>();
|
npc.mNpdt.mDisposition = rec["baseDisposition"].get<int>();
|
||||||
|
|
||||||
if (rec["baseGold"] != sol::nil)
|
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)
|
if (rec["bloodType"] != sol::nil)
|
||||||
npc.mBloodType = static_cast<int>(rec["bloodType"]);
|
npc.mBloodType = rec["bloodType"].get<int>();
|
||||||
|
|
||||||
// Services offered
|
// Services offered
|
||||||
if (rec["servicesOffered"] != sol::nil)
|
if (rec["servicesOffered"] != sol::nil)
|
||||||
|
@ -269,13 +269,29 @@ namespace MWWorld
|
|||||||
list.push_back((*it)->mId);
|
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>
|
template <class T, class Id>
|
||||||
T* TypedDynamicStore<T, Id>::insert(const T& item, bool overrideOnly)
|
T* TypedDynamicStore<T, Id>::insert(const T& item, bool overrideOnly)
|
||||||
{
|
{
|
||||||
if (overrideOnly)
|
if (overrideOnly)
|
||||||
{
|
{
|
||||||
auto it = mStatic.find(item.mId);
|
if (!shouldInsert(item.mId, mStatic))
|
||||||
if (it == mStatic.end())
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
std::pair<typename Dynamic::iterator, bool> result = mDynamic.insert_or_assign(item.mId, item);
|
std::pair<typename Dynamic::iterator, bool> result = mDynamic.insert_or_assign(item.mId, item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user