mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 23:21:20 -04:00
[Client] Move overrideRecord() method for Sound records to right spot
This commit is contained in:
parent
08e3e9af76
commit
0eb01591e8
@ -1282,6 +1282,53 @@ void RecordHelper::overrideRecord(const mwmp::ScriptRecord& record)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RecordHelper::overrideRecord(const mwmp::SoundRecord& record)
|
||||||
|
{
|
||||||
|
const ESM::Sound& recordData = record.data;
|
||||||
|
|
||||||
|
if (recordData.mId.empty())
|
||||||
|
{
|
||||||
|
LOG_APPEND(TimedLog::LOG_INFO, "-- Ignoring record override with no id provided");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isExistingId = doesRecordIdExist<ESM::Sound>(recordData.mId);
|
||||||
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
|
if (record.baseId.empty())
|
||||||
|
{
|
||||||
|
world->getModifiableStore().overrideRecord(recordData);
|
||||||
|
}
|
||||||
|
else if (doesRecordIdExist<ESM::Sound>(record.baseId))
|
||||||
|
{
|
||||||
|
const ESM::Sound* baseData = world->getStore().get<ESM::Sound>().search(record.baseId);
|
||||||
|
ESM::Sound finalData = *baseData;
|
||||||
|
finalData.mId = recordData.mId;
|
||||||
|
|
||||||
|
if (record.baseOverrides.hasSound)
|
||||||
|
finalData.mSound = recordData.mSound;
|
||||||
|
|
||||||
|
if (record.baseOverrides.hasVolume)
|
||||||
|
finalData.mData.mVolume = recordData.mData.mVolume;
|
||||||
|
|
||||||
|
if (record.baseOverrides.hasMinRange)
|
||||||
|
finalData.mData.mMinRange = recordData.mData.mMinRange;
|
||||||
|
|
||||||
|
if (record.baseOverrides.hasMaxRange)
|
||||||
|
finalData.mData.mMaxRange = recordData.mData.mMaxRange;
|
||||||
|
|
||||||
|
world->getModifiableStore().overrideRecord(finalData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_APPEND(TimedLog::LOG_INFO, "-- Ignoring record override with invalid baseId %s", record.baseId.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isExistingId)
|
||||||
|
world->updatePtrsWithRefId(recordData.mId);
|
||||||
|
}
|
||||||
|
|
||||||
void RecordHelper::overrideRecord(const mwmp::SpellRecord& record)
|
void RecordHelper::overrideRecord(const mwmp::SpellRecord& record)
|
||||||
{
|
{
|
||||||
const ESM::Spell &recordData = record.data;
|
const ESM::Spell &recordData = record.data;
|
||||||
@ -1470,53 +1517,6 @@ void RecordHelper::overrideRecord(const mwmp::WeaponRecord& record)
|
|||||||
world->updatePtrsWithRefId(recordData.mId);
|
world->updatePtrsWithRefId(recordData.mId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordHelper::overrideRecord(const mwmp::SoundRecord& record)
|
|
||||||
{
|
|
||||||
const ESM::Sound& recordData = record.data;
|
|
||||||
|
|
||||||
if (recordData.mId.empty())
|
|
||||||
{
|
|
||||||
LOG_APPEND(TimedLog::LOG_INFO, "-- Ignoring record override with no id provided");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isExistingId = doesRecordIdExist<ESM::Sound>(recordData.mId);
|
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
|
||||||
|
|
||||||
if (record.baseId.empty())
|
|
||||||
{
|
|
||||||
world->getModifiableStore().overrideRecord(recordData);
|
|
||||||
}
|
|
||||||
else if (doesRecordIdExist<ESM::Sound>(record.baseId))
|
|
||||||
{
|
|
||||||
const ESM::Sound* baseData = world->getStore().get<ESM::Sound>().search(record.baseId);
|
|
||||||
ESM::Sound finalData = *baseData;
|
|
||||||
finalData.mId = recordData.mId;
|
|
||||||
|
|
||||||
if (record.baseOverrides.hasSound)
|
|
||||||
finalData.mSound = recordData.mSound;
|
|
||||||
|
|
||||||
if (record.baseOverrides.hasVolume)
|
|
||||||
finalData.mData.mVolume = recordData.mData.mVolume;
|
|
||||||
|
|
||||||
if (record.baseOverrides.hasMinRange)
|
|
||||||
finalData.mData.mMinRange = recordData.mData.mMinRange;
|
|
||||||
|
|
||||||
if (record.baseOverrides.hasMaxRange)
|
|
||||||
finalData.mData.mMaxRange = recordData.mData.mMaxRange;
|
|
||||||
|
|
||||||
world->getModifiableStore().overrideRecord(finalData);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_APPEND(TimedLog::LOG_INFO, "-- Ignoring record override with invalid baseId %s", record.baseId.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isExistingId)
|
|
||||||
world->updatePtrsWithRefId(recordData.mId);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RecordHelper::createPlaceholderInteriorCell()
|
void RecordHelper::createPlaceholderInteriorCell()
|
||||||
{
|
{
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
|
@ -27,10 +27,10 @@ namespace RecordHelper
|
|||||||
void overrideRecord(const mwmp::ProbeRecord& record);
|
void overrideRecord(const mwmp::ProbeRecord& record);
|
||||||
void overrideRecord(const mwmp::RepairRecord& record);
|
void overrideRecord(const mwmp::RepairRecord& record);
|
||||||
void overrideRecord(const mwmp::ScriptRecord& record);
|
void overrideRecord(const mwmp::ScriptRecord& record);
|
||||||
|
void overrideRecord(const mwmp::SoundRecord& record);
|
||||||
void overrideRecord(const mwmp::SpellRecord& record);
|
void overrideRecord(const mwmp::SpellRecord& record);
|
||||||
void overrideRecord(const mwmp::StaticRecord& record);
|
void overrideRecord(const mwmp::StaticRecord& record);
|
||||||
void overrideRecord(const mwmp::WeaponRecord& record);
|
void overrideRecord(const mwmp::WeaponRecord& record);
|
||||||
void overrideRecord(const mwmp::SoundRecord& record);
|
|
||||||
|
|
||||||
template<class RecordType>
|
template<class RecordType>
|
||||||
void overrideRecord(const RecordType &record)
|
void overrideRecord(const RecordType &record)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user