mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-08 20:05:19 -04:00
Resolve a number of Coverity defects
This commit is contained in:
parent
60d5e4d30b
commit
a085036a92
@ -90,7 +90,7 @@ namespace ESSImport
|
||||
scriptedAnim.mAbsolute = true;
|
||||
// Neither loop count nor queueing seems to be supported by the ess format.
|
||||
scriptedAnim.mLoopCount = std::numeric_limits<size_t>::max();
|
||||
state.mScriptedAnims.push_back(scriptedAnim);
|
||||
state.mScriptedAnims.push_back(std::move(scriptedAnim));
|
||||
}
|
||||
else
|
||||
// TODO: Handle 0xFF index, which seems to be used for finished animations.
|
||||
|
@ -303,7 +303,7 @@ namespace ESSImport
|
||||
marker.mWorldY = notepos[1];
|
||||
marker.mNote = std::move(note);
|
||||
marker.mCell = cell.mId;
|
||||
mMarkers.push_back(marker);
|
||||
mMarkers.push_back(std::move(marker));
|
||||
}
|
||||
|
||||
newcell.mRefs = std::move(cellrefs);
|
||||
|
@ -584,7 +584,7 @@ namespace ESSImport
|
||||
script.load(esm);
|
||||
ESM::GlobalScript out;
|
||||
convertSCPT(script, out);
|
||||
mScripts.push_back(out);
|
||||
mScripts.push_back(std::move(out));
|
||||
}
|
||||
void write(ESM::ESMWriter& esm) override
|
||||
{
|
||||
|
@ -136,9 +136,9 @@ namespace ESSImport
|
||||
sub.mName = esm.retSubName().toString();
|
||||
sub.mData.resize(esm.getSubSize());
|
||||
esm.getExact(sub.mData.data(), sub.mData.size());
|
||||
rec.mSubrecords.push_back(sub);
|
||||
rec.mSubrecords.push_back(std::move(sub));
|
||||
}
|
||||
file.mRecords.push_back(rec);
|
||||
file.mRecords.push_back(std::move(rec));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace ESSImport
|
||||
}
|
||||
|
||||
if (!separateStacks)
|
||||
mItems.push_back(item);
|
||||
mItems.push_back(std::move(item));
|
||||
}
|
||||
|
||||
// equipped items
|
||||
|
@ -38,7 +38,7 @@ namespace ESSImport
|
||||
unsigned char xnam; // sentinel
|
||||
esm.getHNT(xnam, "XNAM");
|
||||
|
||||
mActiveSpells.push_back(spell);
|
||||
mActiveSpells.push_back(std::move(spell));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::filesystem::pat
|
||||
if (it == map.end())
|
||||
it = map.emplace_hint(it, std::move(key), std::vector<std::string>());
|
||||
|
||||
it->second.push_back(std::string(value));
|
||||
it->second.emplace_back(value);
|
||||
}
|
||||
|
||||
return map;
|
||||
@ -393,7 +393,7 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const std::filesystem::pat
|
||||
{
|
||||
map.insert(std::make_pair(key, std::vector<std::string>()));
|
||||
}
|
||||
map[key].push_back(value);
|
||||
map[key].push_back(std::move(value));
|
||||
}
|
||||
|
||||
return map;
|
||||
|
@ -166,7 +166,7 @@ std::pair<Files::PathContainer, std::vector<std::string>> CS::Editor::readConfig
|
||||
if (!local.empty())
|
||||
{
|
||||
std::filesystem::create_directories(local);
|
||||
dataLocal.push_back(local);
|
||||
dataLocal.push_back(std::move(local));
|
||||
}
|
||||
mCfgMgr.filterOutNonExistingPaths(dataDirs);
|
||||
mCfgMgr.filterOutNonExistingPaths(dataLocal);
|
||||
|
@ -365,7 +365,7 @@ std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry(const Token& keywo
|
||||
if (mError)
|
||||
return std::shared_ptr<Node>();
|
||||
|
||||
nodes.push_back(node);
|
||||
nodes.push_back(std::move(node));
|
||||
|
||||
token = getNextToken();
|
||||
|
||||
|
@ -1466,7 +1466,7 @@ namespace CSMWorld
|
||||
newRow.mCellName.clear();
|
||||
|
||||
if (position >= (int)list.size())
|
||||
list.push_back(newRow);
|
||||
list.push_back(std::move(newRow));
|
||||
else
|
||||
list.insert(list.begin() + position, newRow);
|
||||
|
||||
@ -1636,7 +1636,7 @@ namespace CSMWorld
|
||||
newRow.mCellName.clear();
|
||||
|
||||
if (position >= (int)list.size())
|
||||
list.push_back(newRow);
|
||||
list.push_back(std::move(newRow));
|
||||
else
|
||||
list.insert(list.begin() + position, newRow);
|
||||
|
||||
|
@ -449,7 +449,7 @@ CSVRender::WorldspaceHitResult CSVRender::WorldspaceWidget::mousePick(
|
||||
|
||||
mView->getCamera()->accept(visitor);
|
||||
|
||||
auto intersections = intersector->getIntersections();
|
||||
const auto& intersections = intersector->getIntersections();
|
||||
|
||||
std::vector<osgUtil::LineSegmentIntersector::Intersection> validIntersections
|
||||
= { intersections.begin(), intersections.end() };
|
||||
|
@ -133,10 +133,10 @@ QModelIndexList CSVWorld::RegionMap::getMissingRegionCells() const
|
||||
|
||||
for (QModelIndexList::const_iterator iter(selected.begin()); iter != selected.end(); ++iter)
|
||||
{
|
||||
std::string region = model->data(*iter, CSMWorld::RegionMap::Role_Region).toString().toUtf8().constData();
|
||||
std::string_view region = model->data(*iter, CSMWorld::RegionMap::Role_Region).toString().toUtf8().constData();
|
||||
|
||||
if (!region.empty())
|
||||
regions.insert(region);
|
||||
regions.emplace(region);
|
||||
}
|
||||
|
||||
QModelIndexList list;
|
||||
|
@ -86,7 +86,7 @@ bool parseOptions(int argc, char** argv, OMW::Engine& engine, Files::Configurati
|
||||
.u8string()); // This call to u8string is redundant, but required to
|
||||
// build on MSVC 14.26 due to implementation bugs.
|
||||
if (!local.empty())
|
||||
dataDirs.push_back(local);
|
||||
dataDirs.push_back(std::move(local));
|
||||
|
||||
cfgMgr.filterOutNonExistingPaths(dataDirs);
|
||||
|
||||
|
@ -111,7 +111,7 @@ namespace MWDialogue
|
||||
// there is no need to show empty entries in journal
|
||||
if (!entry.getText().empty())
|
||||
{
|
||||
mJournal.push_back(entry);
|
||||
mJournal.push_back(std::move(entry));
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sJournalEntry}");
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ namespace MWGui
|
||||
mQueue.pop_front();
|
||||
|
||||
if (mRepeat)
|
||||
mQueue.push_back(op);
|
||||
mQueue.push_back(std::move(op));
|
||||
}
|
||||
|
||||
float ScreenFader::getCurrentAlpha()
|
||||
|
@ -422,7 +422,7 @@ namespace MWGui
|
||||
continue; // fake locale to get gmst strings from content files
|
||||
if (std::find(availableLanguages.begin(), availableLanguages.end(), localeName)
|
||||
== availableLanguages.end())
|
||||
availableLanguages.push_back(localeName);
|
||||
availableLanguages.push_back(std::move(localeName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace MWGui
|
||||
newEffectSource.mRemainingTime = effect.mTimeLeft;
|
||||
newEffectSource.mSource = params.getDisplayName();
|
||||
newEffectSource.mTotalTime = effect.mDuration;
|
||||
effects[effect.mEffectId].push_back(newEffectSource);
|
||||
effects[effect.mEffectId].push_back(std::move(newEffectSource));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ namespace MWGui
|
||||
|
||||
newSpell.mActive = invStore.isEquipped(item);
|
||||
}
|
||||
mSpells.push_back(newSpell);
|
||||
mSpells.push_back(std::move(newSpell));
|
||||
}
|
||||
|
||||
std::stable_sort(mSpells.begin(), mSpells.end(), sortSpells);
|
||||
|
@ -702,9 +702,10 @@ namespace MWInput
|
||||
|
||||
void BindingsManager::saveBindings()
|
||||
{
|
||||
const std::string newFileName = Files::pathToUnicodeString(mUserFile) + ".new";
|
||||
std::string newFileName;
|
||||
try
|
||||
{
|
||||
newFileName = Files::pathToUnicodeString(mUserFile) + ".new";
|
||||
if (mInputBinder->save(newFileName))
|
||||
{
|
||||
std::filesystem::rename(Files::pathFromUnicodeString(newFileName), mUserFile);
|
||||
|
@ -19,7 +19,8 @@ namespace MWLua
|
||||
= [](const ESM::Script& rec) { return "ESM3_Script[" + rec.mId.toDebugString() + "]"; };
|
||||
recordBindingsClass["id"]
|
||||
= sol::readonly_property([](const ESM::Script& rec) { return rec.mId.serializeText(); });
|
||||
recordBindingsClass["text"] = sol::readonly_property([](const ESM::Script& rec) { return rec.mScriptText; });
|
||||
recordBindingsClass["text"]
|
||||
= sol::readonly_property([](const ESM::Script& rec) -> std::string_view { return rec.mScriptText; });
|
||||
|
||||
addRecordFunctionBinding<ESM::Script>(api, context);
|
||||
|
||||
|
@ -161,7 +161,7 @@ namespace MWLua
|
||||
{
|
||||
binary = LuaUtil::serialize(*data, mLocalSerializer.get());
|
||||
}
|
||||
mLuaEvents.addLocalEvent({ getId(target), name, binary });
|
||||
mLuaEvents.addLocalEvent({ getId(target), name, std::move(binary) });
|
||||
}
|
||||
|
||||
void LuaManager::update()
|
||||
|
@ -442,9 +442,9 @@ namespace MWLua
|
||||
sol::optional<Object> ammo = options.get<sol::optional<Object>>("ammo");
|
||||
|
||||
context.mLuaManager->addAction(
|
||||
[self = self, damages = std::move(damageCpp), attacker = options.get<sol::optional<Object>>("attacker"),
|
||||
weapon = ammo ? ammo : weapon, successful = options.get<bool>("successful"),
|
||||
sourceType = sourceType] {
|
||||
[self = Object(self), damages = std::move(damageCpp),
|
||||
attacker = options.get<sol::optional<Object>>("attacker"), weapon = ammo ? ammo : weapon,
|
||||
successful = options.get<bool>("successful"), sourceType = sourceType] {
|
||||
MWWorld::Ptr attackerPtr;
|
||||
MWWorld::Ptr weaponPtr;
|
||||
if (attacker)
|
||||
|
@ -168,7 +168,7 @@ namespace MWLua
|
||||
LuaUi::Layer::Options options;
|
||||
options.mInteractive = LuaUtil::getValueOrDefault(LuaUtil::getFieldOrNil(opt, "interactive"), true);
|
||||
context.mLuaManager->addAction(
|
||||
[=]() {
|
||||
[afterName = std::move(afterName), name = std::move(name), options]() {
|
||||
size_t index = LuaUi::Layer::indexOf(afterName);
|
||||
if (index == LuaUi::Layer::count())
|
||||
throw std::logic_error(
|
||||
|
@ -48,7 +48,8 @@ namespace MWLua
|
||||
auto weatherT = lua.new_usertype<MWWorld::Weather>("Weather");
|
||||
weatherT[sol::meta_function::to_string]
|
||||
= [](const MWWorld::Weather& w) -> std::string { return "Weather[" + w.mName + "]"; };
|
||||
weatherT["name"] = sol::readonly_property([](const MWWorld::Weather& w) { return w.mName; });
|
||||
weatherT["name"]
|
||||
= sol::readonly_property([](const MWWorld::Weather& w) -> std::string_view { return w.mName; });
|
||||
weatherT["windSpeed"] = sol::readonly_property([](const MWWorld::Weather& w) { return w.mWindSpeed; });
|
||||
weatherT["cloudSpeed"] = sol::readonly_property([](const MWWorld::Weather& w) { return w.mCloudSpeed; });
|
||||
weatherT["cloudTexture"] = sol::readonly_property([vfs](const MWWorld::Weather& w) {
|
||||
@ -139,7 +140,8 @@ namespace MWLua
|
||||
weatherT["scriptId"] = sol::readonly_property([](const MWWorld::Weather& w) { return w.mScriptId; });
|
||||
weatherT["recordId"] = sol::readonly_property([](const MWWorld::Weather& w) { return w.mId.serializeText(); });
|
||||
|
||||
api["getCurrent"] = []() { return MWBase::Environment::get().getWorld()->getCurrentWeather(); };
|
||||
api["getCurrent"]
|
||||
= []() -> const MWWorld::Weather* { return &MWBase::Environment::get().getWorld()->getCurrentWeather(); };
|
||||
api["getNext"]
|
||||
= []() -> const MWWorld::Weather* { return MWBase::Environment::get().getWorld()->getNextWeather(); };
|
||||
api["getTransition"] = []() { return MWBase::Environment::get().getWorld()->getWeatherTransition(); };
|
||||
|
@ -628,7 +628,7 @@ std::vector<std::string> MWMechanics::Alchemy::effectsDescription(const MWWorld:
|
||||
const ESM::Skill* skill = store->get<ESM::Skill>().search(ESM::Skill::indexToRefId(data.mSkills[i]));
|
||||
std::string effect = getMagicEffectString(*mgef.find(effectID), attribute, skill);
|
||||
|
||||
effects.push_back(effect);
|
||||
effects.push_back(std::move(effect));
|
||||
}
|
||||
}
|
||||
return effects;
|
||||
|
@ -2531,7 +2531,7 @@ namespace MWMechanics
|
||||
anim.mTime = 0.f;
|
||||
}
|
||||
|
||||
state.mScriptedAnims.push_back(anim);
|
||||
state.mScriptedAnims.push_back(std::move(anim));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2563,7 +2563,7 @@ namespace MWMechanics
|
||||
entry.mTime = (time - start) / (stop - start);
|
||||
}
|
||||
|
||||
mAnimQueue.push_back(entry);
|
||||
mAnimQueue.push_back(std::move(entry));
|
||||
}
|
||||
|
||||
playAnimQueue();
|
||||
@ -2644,7 +2644,7 @@ namespace MWMechanics
|
||||
mAnimQueue.resize(1);
|
||||
}
|
||||
|
||||
mAnimQueue.push_back(entry);
|
||||
mAnimQueue.push_back(std::move(entry));
|
||||
|
||||
if (playImmediately)
|
||||
playAnimQueue(mode == 2);
|
||||
@ -2675,7 +2675,7 @@ namespace MWMechanics
|
||||
|
||||
if (mAnimQueue.size() > 1)
|
||||
mAnimQueue.resize(1);
|
||||
mAnimQueue.push_back(entry);
|
||||
mAnimQueue.push_back(std::move(entry));
|
||||
|
||||
if (mAnimQueue.size() == 1)
|
||||
playAnimQueue();
|
||||
|
@ -185,7 +185,7 @@ namespace MWRender
|
||||
auto distortion = loadTechnique("internal_distortion");
|
||||
distortion->setInternal(true);
|
||||
distortion->setLocked(true);
|
||||
mInternalTechniques.push_back(distortion);
|
||||
mInternalTechniques.push_back(std::move(distortion));
|
||||
|
||||
osg::GraphicsContext* gc = viewer->getCamera()->getGraphicsContext();
|
||||
osg::GLExtensions* ext = gc->getState()->get<osg::GLExtensions>();
|
||||
|
@ -130,7 +130,7 @@ namespace MWScript
|
||||
if (ptr)
|
||||
mReference = *ptr;
|
||||
else
|
||||
mGlobalScriptDesc = globalScriptDesc;
|
||||
mGlobalScriptDesc = std::move(globalScriptDesc);
|
||||
}
|
||||
|
||||
ESM::RefId InterpreterContext::getTarget() const
|
||||
|
@ -58,7 +58,7 @@ void MWState::Character::addSlot(const std::filesystem::path& path, const std::s
|
||||
if (!Misc::StringUtils::ciEqual(getFirstGameFile(slot.mProfile.mContentFiles), game))
|
||||
return; // this file is for a different game -> ignore
|
||||
|
||||
mSlots.push_back(slot);
|
||||
mSlots.push_back(std::move(slot));
|
||||
}
|
||||
|
||||
void MWState::Character::addSlot(const ESM::SavedGame& profile)
|
||||
@ -92,7 +92,7 @@ void MWState::Character::addSlot(const ESM::SavedGame& profile)
|
||||
slot.mProfile = profile;
|
||||
slot.mTimeStamp = std::filesystem::file_time_type::clock::now();
|
||||
|
||||
mSlots.push_back(slot);
|
||||
mSlots.push_back(std::move(slot));
|
||||
}
|
||||
|
||||
MWState::Character::Character(const std::filesystem::path& saves, const std::string& game)
|
||||
@ -174,7 +174,7 @@ const MWState::Slot* MWState::Character::updateSlot(const Slot* slot, const ESM:
|
||||
|
||||
mSlots.erase(mSlots.begin() + index);
|
||||
|
||||
mSlots.push_back(newSlot);
|
||||
mSlots.push_back(std::move(newSlot));
|
||||
|
||||
return &mSlots.back();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ MWState::CharacterManager::CharacterManager(std::filesystem::path saves, const s
|
||||
Character character(characterDir, mGame);
|
||||
|
||||
if (character.begin() != character.end())
|
||||
mCharacters.push_back(character);
|
||||
mCharacters.push_back(std::move(character));
|
||||
}
|
||||
}
|
||||
mCharacters.sort();
|
||||
|
@ -150,7 +150,7 @@ namespace
|
||||
}
|
||||
|
||||
if (changed)
|
||||
npcsToReplace.push_back(npc);
|
||||
npcsToReplace.push_back(std::move(npc));
|
||||
}
|
||||
|
||||
return npcsToReplace;
|
||||
|
@ -335,7 +335,7 @@ namespace MWWorld
|
||||
}
|
||||
state.mProjectileId = mPhysics->addProjectile(caster, pos, model, true);
|
||||
state.mToDelete = false;
|
||||
mMagicBolts.push_back(state);
|
||||
mMagicBolts.push_back(std::move(state));
|
||||
}
|
||||
|
||||
void ProjectileManager::launchProjectile(const Ptr& actor, const ConstPtr& projectile, const osg::Vec3f& pos,
|
||||
@ -361,7 +361,7 @@ namespace MWWorld
|
||||
|
||||
state.mProjectileId = mPhysics->addProjectile(actor, pos, model, false);
|
||||
state.mToDelete = false;
|
||||
mProjectiles.push_back(state);
|
||||
mProjectiles.push_back(std::move(state));
|
||||
}
|
||||
|
||||
void ProjectileManager::updateCasters()
|
||||
@ -725,7 +725,7 @@ namespace MWWorld
|
||||
createModel(state, model, osg::Vec3f(esm.mPosition), osg::Quat(esm.mOrientation), false, false,
|
||||
osg::Vec4(0, 0, 0, 0));
|
||||
|
||||
mProjectiles.push_back(state);
|
||||
mProjectiles.push_back(std::move(state));
|
||||
return true;
|
||||
}
|
||||
if (type == ESM::REC_MPRJ)
|
||||
|
@ -1096,7 +1096,7 @@ namespace MWWorld
|
||||
Weather weather(
|
||||
id, mWeatherSettings.size(), name, fStromWindSpeed, mRainSpeed, dlFactor, dlOffset, particleEffect);
|
||||
|
||||
mWeatherSettings.push_back(weather);
|
||||
mWeatherSettings.push_back(std::move(weather));
|
||||
}
|
||||
|
||||
inline void WeatherManager::importRegions()
|
||||
|
@ -1955,7 +1955,7 @@ namespace MWWorld
|
||||
|
||||
newMarker.x = pos.pos[0];
|
||||
newMarker.y = pos.pos[1];
|
||||
mOut.push_back(newMarker);
|
||||
mOut.push_back(std::move(newMarker));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace Bsa
|
||||
fileName.resize(fileNameSize);
|
||||
input.read(fileName.data(), fileName.size());
|
||||
fileName.push_back('\0');
|
||||
mFileNames.push_back(fileName);
|
||||
mFileNames.push_back(std::move(fileName));
|
||||
mFiles[i].setNameInfos(0, &mFileNames.back());
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ namespace Bsa
|
||||
fileName.resize(fileNameSize);
|
||||
input.read(fileName.data(), fileName.size());
|
||||
fileName.push_back('\0');
|
||||
mFileNames.push_back(fileName);
|
||||
mFileNames.push_back(std::move(fileName));
|
||||
mFiles[i].setNameInfos(0, &mFileNames.back());
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace Compiler
|
||||
|
||||
std::copy(mCodeBlock.begin(), mCodeBlock.end(), std::back_inserter(entry.second));
|
||||
|
||||
mIfCode.push_back(entry);
|
||||
mIfCode.push_back(std::move(entry));
|
||||
|
||||
mCodeBlock.clear();
|
||||
|
||||
|
@ -327,7 +327,7 @@ namespace Compiler
|
||||
|
||||
if (mExplicit.empty() && getContext().isId(ESM::RefId::stringRefId(name2)))
|
||||
{
|
||||
mExplicit = name2;
|
||||
mExplicit = std::move(name2);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ namespace Compiler
|
||||
else if (!c.isMinusSign() && isStringCharacter(c))
|
||||
{
|
||||
/// workaround that allows names to begin with digits
|
||||
return scanName(c, parser, cont, value);
|
||||
return scanName(c, parser, cont, std::move(value));
|
||||
}
|
||||
else if (c == '.')
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ bool Config::GameSettings::readFile(
|
||||
|
||||
if (settings.isEmpty())
|
||||
{
|
||||
settings = cache; // This is the first time we read a file
|
||||
settings = std::move(cache); // This is the first time we read a file
|
||||
validatePaths();
|
||||
return true;
|
||||
}
|
||||
|
@ -23,31 +23,30 @@ namespace ESM
|
||||
|
||||
ESM::LandData::LandData(const ESM::Land& land, int loadFlags)
|
||||
: mData(loadData(land, loadFlags))
|
||||
, mHeights(mData->mHeights)
|
||||
, mNormals(mData->mNormals)
|
||||
, mColors(mData->mColours)
|
||||
, mTextures(mData->mTextures)
|
||||
, mLoadFlags(mData->mDataLoaded)
|
||||
, mMinHeight(mData->mMinHeight)
|
||||
, mMaxHeight(mData->mMaxHeight)
|
||||
, mSize(Constants::CellSizeInUnits)
|
||||
, mLandSize(ESM::Land::LAND_SIZE)
|
||||
, mPlugin(land.getPlugin())
|
||||
, mHeights(mData->mHeights)
|
||||
, mNormals(mData->mNormals)
|
||||
, mColors(mData->mColours)
|
||||
, mTextures(mData->mTextures)
|
||||
, mIsEsm4(false)
|
||||
{
|
||||
}
|
||||
|
||||
ESM::LandData::LandData(const ESM4::Land& land, int /*loadFlags*/)
|
||||
: mLoadFlags(land.mDataTypes) // ESM4::Land is always fully loaded. TODO: implement lazy loading
|
||||
, mHeightsData(ESM4::Land::sLandNumVerts)
|
||||
: mHeightsData(ESM4::Land::sLandNumVerts)
|
||||
, mNormals(land.mVertNorm)
|
||||
, mColors(land.mVertColr)
|
||||
, mTextures(textures)
|
||||
, mLoadFlags(land.mDataTypes) // ESM4::Land is always fully loaded. TODO: implement lazy loading
|
||||
, mMinHeight(std::numeric_limits<float>::max())
|
||||
, mMaxHeight(std::numeric_limits<float>::lowest())
|
||||
, mSize(Constants::ESM4CellSizeInUnits)
|
||||
, mLandSize(ESM4::Land::sVertsPerSide)
|
||||
, mPlugin(land.mId.mContentFile)
|
||||
, mNormals(land.mVertNorm)
|
||||
, mColors(land.mVertColr)
|
||||
, mTextures(textures)
|
||||
, mIsEsm4(true)
|
||||
{
|
||||
float rowOffset = land.mHeightMap.heightOffset;
|
||||
|
@ -51,19 +51,19 @@ namespace ESM
|
||||
|
||||
private:
|
||||
std::unique_ptr<const ESM::LandRecordData> mData;
|
||||
int mLoadFlags = 0;
|
||||
std::vector<float> mHeightsData;
|
||||
float mMinHeight = 0.f;
|
||||
float mMaxHeight = 0.f;
|
||||
float mSize = 0.f;
|
||||
int mLandSize = 0;
|
||||
int mPlugin = 0;
|
||||
std::span<const float> mHeights;
|
||||
std::span<const std::int8_t> mNormals;
|
||||
std::span<const std::uint8_t> mColors;
|
||||
std::span<const std::uint16_t> mTextures;
|
||||
std::array<ESM4::Land::Texture, 4> mEsm4Textures;
|
||||
bool mIsEsm4;
|
||||
int mLoadFlags = 0;
|
||||
float mMinHeight = 0.f;
|
||||
float mMaxHeight = 0.f;
|
||||
float mSize = 0.f;
|
||||
int mLandSize = 0;
|
||||
int mPlugin = 0;
|
||||
bool mIsEsm4 = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -55,25 +55,25 @@ namespace ESM
|
||||
{
|
||||
pack.mType = AI_Wander;
|
||||
esm.getSubComposite(pack.mWander);
|
||||
mList.push_back(pack);
|
||||
mList.push_back(std::move(pack));
|
||||
}
|
||||
else if (esm.retSubName() == AI_Travel)
|
||||
{
|
||||
pack.mType = AI_Travel;
|
||||
esm.getSubComposite(pack.mTravel);
|
||||
mList.push_back(pack);
|
||||
mList.push_back(std::move(pack));
|
||||
}
|
||||
else if (esm.retSubName() == AI_Escort || esm.retSubName() == AI_Follow)
|
||||
{
|
||||
pack.mType = (esm.retSubName() == AI_Escort) ? AI_Escort : AI_Follow;
|
||||
esm.getSubComposite(pack.mTarget);
|
||||
mList.push_back(pack);
|
||||
mList.push_back(std::move(pack));
|
||||
}
|
||||
else if (esm.retSubName() == AI_Activate)
|
||||
{
|
||||
pack.mType = AI_Activate;
|
||||
esm.getSubComposite(pack.mActivate);
|
||||
mList.push_back(pack);
|
||||
mList.push_back(std::move(pack));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ namespace ESM
|
||||
esm.getHNOT(anim.mAbsolute, "ABST");
|
||||
esm.getHNT(anim.mLoopCount, "COUN");
|
||||
|
||||
mScriptedAnims.push_back(anim);
|
||||
mScriptedAnims.push_back(std::move(anim));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ namespace ESM
|
||||
Header::MasterData d;
|
||||
d.name = name;
|
||||
d.size = size;
|
||||
mHeader.mMaster.push_back(d);
|
||||
mHeader.mMaster.push_back(std::move(d));
|
||||
}
|
||||
|
||||
void ESMWriter::save(std::ostream& file)
|
||||
|
@ -82,7 +82,7 @@ namespace ESM
|
||||
if (dataFormat <= MaxOldFogOfWarFormatVersion)
|
||||
convertFogOfWar(tex.mImageData);
|
||||
|
||||
mFogTextures.push_back(tex);
|
||||
mFogTextures.push_back(std::move(tex));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace ESM
|
||||
MasterData m;
|
||||
m.name = esm.getHString();
|
||||
esm.getHNT(m.size, "DATA");
|
||||
mMaster.push_back(m);
|
||||
mMaster.push_back(std::move(m));
|
||||
}
|
||||
|
||||
esm.getHNOT("GMDT", mGameData.mCurrentHealth, mGameData.mMaximumHealth, mGameData.mHour, mGameData.unknown1,
|
||||
|
@ -14,7 +14,7 @@ namespace ESM
|
||||
{
|
||||
Dest dodt;
|
||||
esm.getSubComposite(dodt.mPos);
|
||||
mList.push_back(dodt);
|
||||
mList.push_back(std::move(dodt));
|
||||
}
|
||||
else if (esm.retSubName().toInt() == fourCC("DNAM"))
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ void ESM4::Ingredient::load(ESM4::Reader& reader)
|
||||
if (!reader.getZString(scriptEffectName))
|
||||
throw std::runtime_error("INGR FULL data read error");
|
||||
|
||||
mScriptEffect.push_back(scriptEffectName);
|
||||
mScriptEffect.push_back(std::move(scriptEffectName));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
|
||||
{
|
||||
Navigation::IslandInfo island2;
|
||||
island2.load(reader);
|
||||
islandInfo.push_back(island2); // Maybe don't use a vector for just one entry?
|
||||
islandInfo.push_back(std::move(island2)); // Maybe don't use a vector for just one entry?
|
||||
}
|
||||
// else if (flags == FLG_Island) // FIXME: debug only
|
||||
// std::cerr << "nvmi no island but has 0x20 flag" << std::endl;
|
||||
@ -350,7 +350,7 @@ void ESM4::Navigation::load(ESM4::Reader& reader)
|
||||
// std::cout << "\nNVMI start" << std::endl;
|
||||
NavMeshInfo nvmi;
|
||||
nvmi.load(reader);
|
||||
mNavMeshInfo.push_back(nvmi);
|
||||
mNavMeshInfo.push_back(std::move(nvmi));
|
||||
break;
|
||||
}
|
||||
case ESM::fourCC("NVSI"): // from Dawnguard onwards
|
||||
|
@ -178,7 +178,7 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
|
||||
{
|
||||
reader.get(*it);
|
||||
}
|
||||
triSegments.push_back(indices);
|
||||
triSegments.push_back(std::move(indices));
|
||||
}
|
||||
if (triSegments.size() != divisor * divisor)
|
||||
throw std::runtime_error("Triangle segments size is not the square of divisor");
|
||||
@ -221,7 +221,7 @@ void ESM4::NavMesh::load(ESM4::Reader& reader)
|
||||
|
||||
NVNMstruct nvnm;
|
||||
nvnm.load(reader);
|
||||
mData.push_back(nvnm); // FIXME try swap
|
||||
mData.push_back(std::move(nvnm)); // FIXME try swap
|
||||
break;
|
||||
}
|
||||
case ESM::fourCC("ONAM"):
|
||||
|
@ -114,7 +114,7 @@ void ESM4::Pathgrid::load(ESM4::Reader& reader)
|
||||
for (std::size_t i = 0; i < numNodes; ++i)
|
||||
reader.get(objLink.linkedNodes.at(i));
|
||||
|
||||
mObjects.push_back(objLink);
|
||||
mObjects.push_back(std::move(objLink));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ void ESM4::SigilStone::load(ESM4::Reader& reader)
|
||||
std::string scriptEffectName;
|
||||
if (!reader.getZString(scriptEffectName))
|
||||
throw std::runtime_error("SGST FULL data read error");
|
||||
mScriptEffect.push_back(scriptEffectName);
|
||||
mScriptEffect.push_back(std::move(scriptEffectName));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void ESM4::Header::load(ESM4::Reader& reader)
|
||||
|
||||
// NOTE: some mods do not have DATA following MAST so can't read DATA here
|
||||
m.size = 0;
|
||||
mMaster.push_back(m);
|
||||
mMaster.push_back(std::move(m));
|
||||
break;
|
||||
}
|
||||
case ESM::fourCC("DATA"):
|
||||
|
@ -1033,7 +1033,7 @@ namespace Fx
|
||||
choice.mLabel = parseString();
|
||||
expect<Lexer::Equal>();
|
||||
choice.mValue = getUniformValue<SrcT, T>();
|
||||
choices.push_back(choice);
|
||||
choices.push_back(std::move(choice));
|
||||
|
||||
if (isNext<Lexer::Comma>())
|
||||
{
|
||||
|
@ -174,8 +174,12 @@ namespace Nif
|
||||
const float y = (1.f - curr.mTension) * (1.f + curr.mContinuity) * (1.f - curr.mBias);
|
||||
const float z = (1.f - curr.mTension) * (1.f + curr.mContinuity) * (1.f + curr.mBias);
|
||||
const float w = (1.f - curr.mTension) * (1.f - curr.mContinuity) * (1.f - curr.mBias);
|
||||
const U prevDelta = prev != nullptr ? curr.mValue - prev->mValue : next->mValue - curr.mValue;
|
||||
const U nextDelta = next != nullptr ? next->mValue - curr.mValue : curr.mValue - prev->mValue;
|
||||
const U prevDelta = prev != nullptr ? curr.mValue - prev->mValue
|
||||
: next != nullptr ? next->mValue - curr.mValue
|
||||
: U{};
|
||||
const U nextDelta = next != nullptr ? next->mValue - curr.mValue
|
||||
: prev != nullptr ? curr.mValue - prev->mValue
|
||||
: U{};
|
||||
curr.mInTan = (prevDelta * x + nextDelta * y) * prevLen / (prevLen + nextLen);
|
||||
curr.mOutTan = (prevDelta * z + nextDelta * w) * nextLen / (prevLen + nextLen);
|
||||
}
|
||||
@ -205,4 +209,4 @@ namespace Nif
|
||||
using BoolKeyMapPtr = std::shared_ptr<BoolKeyMap>;
|
||||
|
||||
} // Namespace
|
||||
#endif //#ifndef OPENMW_COMPONENTS_NIF_NIFKEY_HPP
|
||||
#endif // #ifndef OPENMW_COMPONENTS_NIF_NIFKEY_HPP
|
||||
|
@ -1395,7 +1395,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGroup(osg::Group& group)
|
||||
subset.push_back(geometry);
|
||||
if (subset.size()>1) needToDoMerge = true;
|
||||
}
|
||||
if (!subset.empty()) mergeList.push_back(subset);
|
||||
if (!subset.empty()) mergeList.push_back(std::move(subset));
|
||||
}
|
||||
|
||||
if (needToDoMerge)
|
||||
|
@ -339,7 +339,7 @@ namespace Shader
|
||||
if (!parseLinkDirective(source, linkTarget, templateName, foundPos))
|
||||
return false;
|
||||
if (!linkTarget.empty() && linkTarget != templateName)
|
||||
linkedShaderTemplateNames.push_back(linkTarget);
|
||||
linkedShaderTemplateNames.push_back(std::move(linkTarget));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -507,15 +507,17 @@ namespace Stereo
|
||||
if (!Stereo::getMultiview())
|
||||
{
|
||||
auto eye = static_cast<int>(Stereo::Manager::instance().getEye(cv));
|
||||
|
||||
if (msaa)
|
||||
if (eye < 2)
|
||||
{
|
||||
renderStage->setFrameBufferObject(mMultiviewFramebuffer->layerMsaaFbo(eye));
|
||||
renderStage->setMultisampleResolveFramebufferObject(mMultiviewFramebuffer->layerFbo(eye));
|
||||
}
|
||||
else
|
||||
{
|
||||
renderStage->setFrameBufferObject(mMultiviewFramebuffer->layerFbo(eye));
|
||||
if (msaa)
|
||||
{
|
||||
renderStage->setFrameBufferObject(mMultiviewFramebuffer->layerMsaaFbo(eye));
|
||||
renderStage->setMultisampleResolveFramebufferObject(mMultiviewFramebuffer->layerFbo(eye));
|
||||
}
|
||||
else
|
||||
{
|
||||
renderStage->setFrameBufferObject(mMultiviewFramebuffer->layerFbo(eye));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,7 +545,7 @@ namespace Stereo
|
||||
{
|
||||
}
|
||||
|
||||
MultiviewFramebuffer::~MultiviewFramebuffer() {}
|
||||
MultiviewFramebuffer::~MultiviewFramebuffer() = default;
|
||||
|
||||
void MultiviewFramebuffer::attachColorComponent(GLint sourceFormat, GLint sourceType, GLint internalFormat)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user