diff --git a/apps/essimporter/main.cpp b/apps/essimporter/main.cpp index d593669c3..9b969e35a 100644 --- a/apps/essimporter/main.cpp +++ b/apps/essimporter/main.cpp @@ -57,7 +57,7 @@ int main(int argc, char** argv) else { const std::string& ext = ".omwsave"; - if (boost::filesystem::exists(boost::filesystem::path(outputFile)) + if (bfs::exists(bfs::path(outputFile)) && (outputFile.size() < ext.size() || outputFile.substr(outputFile.size()-ext.size()) != ext)) { throw std::runtime_error("Output file already exists and does not end in .omwsave. Did you mean to use --compare?"); diff --git a/apps/opencs/model/world/commands.cpp b/apps/opencs/model/world/commands.cpp index 34485a46d..5ec7401dc 100644 --- a/apps/opencs/model/world/commands.cpp +++ b/apps/opencs/model/world/commands.cpp @@ -76,6 +76,7 @@ void CSMWorld::ImportLandTexturesCommand::redo() } std::vector oldTextures; + oldTextures.reserve(texIndices.size()); for (int index : texIndices) { oldTextures.push_back(LandTexture::createUniqueRecordId(oldPlugin, index)); diff --git a/apps/opencs/model/world/idtree.cpp b/apps/opencs/model/world/idtree.cpp index a8dfacb01..1e3398bbb 100644 --- a/apps/opencs/model/world/idtree.cpp +++ b/apps/opencs/model/world/idtree.cpp @@ -201,7 +201,7 @@ QModelIndex CSMWorld::IdTree::parent (const QModelIndex& index) const const std::pair& address(unfoldIndexAddress(id)); if (address.first >= this->rowCount() || address.second >= this->columnCount()) - throw "Parent index is not present in the model"; + throw std::logic_error("Parent index is not present in the model"); return createIndex(address.first, address.second); } @@ -216,7 +216,7 @@ unsigned int CSMWorld::IdTree::foldIndexAddress (const QModelIndex& index) const std::pair< int, int > CSMWorld::IdTree::unfoldIndexAddress (unsigned int id) const { if (id == 0) - throw "Attempt to unfold index id of the top level data cell"; + throw std::runtime_error("Attempt to unfold index id of the top level data cell"); --id; int row = id / this->columnCount(); diff --git a/components/esm/loadregn.cpp b/components/esm/loadregn.cpp index 98edca48f..a56b9f247 100644 --- a/components/esm/loadregn.cpp +++ b/components/esm/loadregn.cpp @@ -115,7 +115,7 @@ namespace ESM void Region::blank() { mData.mClear = mData.mCloudy = mData.mFoggy = mData.mOvercast = mData.mRain = - mData.mThunder = mData.mAsh, mData.mBlight = mData.mA = mData.mB = 0; + mData.mThunder = mData.mAsh = mData.mBlight = mData.mA = mData.mB = 0; mMapColor = 0; diff --git a/components/esm/variantimp.cpp b/components/esm/variantimp.cpp index 74d1351ec..64dc980b8 100644 --- a/components/esm/variantimp.cpp +++ b/components/esm/variantimp.cpp @@ -52,12 +52,7 @@ void ESM::readESMVariantValue(ESMReader& esm, Variant::Format format, VarType ty esm.getHNT (value, "FLTV"); if (type==VT_Short) - { - if (value!=value) - out = 0; // nan - else - out = static_cast (value); - } + out = static_cast (value); else if (type==VT_Long) out = static_cast (value); else