1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-21 06:41:33 +00:00

Even more elses

This commit is contained in:
AnyOldName3 2025-04-10 18:32:52 +01:00
parent 37dc1a6a76
commit 48572e4c96

View file

@ -63,8 +63,6 @@ namespace ESM
const auto indexIt = mIndex.find(index); const auto indexIt = mIndex.find(index);
if (indexIt == mIndex.end()) if (indexIt == mIndex.end())
throw std::logic_error("ESMReader at index " + std::to_string(index) + " has not been created yet"); throw std::logic_error("ESMReader at index " + std::to_string(index) + " has not been created yet");
else
{
switch (indexIt->second->mState) switch (indexIt->second->mState)
{ {
case State::Busy: case State::Busy:
@ -73,21 +71,17 @@ namespace ESM
case State::Closed: case State::Closed:
if (indexIt->second->mName) if (indexIt->second->mName)
return *indexIt->second->mName; return *indexIt->second->mName;
throw std::logic_error( throw std::logic_error("ESMReader at index " + std::to_string(index) + " has forgotten its filename");
"ESMReader at index " + std::to_string(index) + " has forgotten its filename");
default: default:
throw std::logic_error("ESMReader at index " + std::to_string(index) + " in unknown state"); throw std::logic_error("ESMReader at index " + std::to_string(index) + " in unknown state");
} }
} }
}
std::size_t ReadersCache::getFileSize(std::size_t index) std::size_t ReadersCache::getFileSize(std::size_t index)
{ {
const auto indexIt = mIndex.find(index); const auto indexIt = mIndex.find(index);
if (indexIt == mIndex.end()) if (indexIt == mIndex.end())
return 0; return 0;
else
{
switch (indexIt->second->mState) switch (indexIt->second->mState)
{ {
case State::Busy: case State::Busy:
@ -98,13 +92,11 @@ namespace ESM
case State::Closed: case State::Closed:
if (indexIt->second->mFileSize) if (indexIt->second->mFileSize)
return *indexIt->second->mFileSize; return *indexIt->second->mFileSize;
throw std::logic_error( throw std::logic_error("ESMReader at index " + std::to_string(index) + " has forgotten its file size");
"ESMReader at index " + std::to_string(index) + " has forgotten its file size");
default: default:
throw std::logic_error("ESMReader at index " + std::to_string(index) + " in unknown state"); throw std::logic_error("ESMReader at index " + std::to_string(index) + " in unknown state");
} }
} }
}
void ReadersCache::closeExtraReaders() void ReadersCache::closeExtraReaders()
{ {