1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-25 12:41:01 +00:00

Merge branch 'cs_log' into 'master'

Make editor failure to load content files more detailed

See merge request OpenMW/openmw!3062
This commit is contained in:
jvoisin 2023-05-25 20:38:05 +00:00
commit 2ab5b8e7b0
7 changed files with 18 additions and 6 deletions

View File

@ -296,9 +296,8 @@ namespace CSMWorld
const int index = getIndex(id); const int index = getIndex(id);
Record<ESXRecordT>& record = *mRecords.at(index); Record<ESXRecordT>& record = *mRecords.at(index);
if (record.isDeleted()) if (record.isDeleted())
{ throw std::runtime_error("attempt to touch deleted record from collection of "
throw std::runtime_error("attempt to touch deleted record"); + std::string(ESXRecordT::getRecordType()) + ": " + id.toDebugString());
}
if (!record.isModified()) if (!record.isModified())
{ {
@ -394,7 +393,8 @@ namespace CSMWorld
int index = searchId(id); int index = searchId(id);
if (index == -1) if (index == -1)
throw std::runtime_error("invalid ID: " + id.getRefIdString()); throw std::runtime_error("ID is not found in collection of " + std::string(ESXRecordT::getRecordType())
+ " records: " + id.getRefIdString());
return index; return index;
} }
@ -427,7 +427,8 @@ namespace CSMWorld
NestableColumn* Collection<ESXRecordT>::getNestableColumn(int column) const NestableColumn* Collection<ESXRecordT>::getNestableColumn(int column) const
{ {
if (column < 0 || column >= static_cast<int>(mColumns.size())) if (column < 0 || column >= static_cast<int>(mColumns.size()))
throw std::runtime_error("column index out of range"); throw std::runtime_error(
"column index out of range [0, " + std::to_string(mColumns.size()) + "): " + std::to_string(column));
return mColumns.at(column); return mColumns.at(column);
} }

View File

@ -27,6 +27,7 @@
#include <apps/opencs/model/world/subcellcollection.hpp> #include <apps/opencs/model/world/subcellcollection.hpp>
#include <apps/opencs/model/world/universalid.hpp> #include <apps/opencs/model/world/universalid.hpp>
#include <components/debug/debuglog.hpp>
#include <components/esm/defs.hpp> #include <components/esm/defs.hpp>
#include <components/esm/esmcommon.hpp> #include <components/esm/esmcommon.hpp>
#include <components/esm3/cellref.hpp> #include <components/esm3/cellref.hpp>
@ -1041,6 +1042,8 @@ int CSMWorld::Data::getTotalRecords(const std::vector<std::filesystem::path>& fi
int CSMWorld::Data::startLoading(const std::filesystem::path& path, bool base, bool project) int CSMWorld::Data::startLoading(const std::filesystem::path& path, bool base, bool project)
{ {
Log(Debug::Info) << "Loading content file " << path;
// Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading // Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading
std::shared_ptr<ESM::ESMReader> ptr(mReader); std::shared_ptr<ESM::ESMReader> ptr(mReader);
mReaders.push_back(ptr); mReaders.push_back(ptr);

View File

@ -16,6 +16,8 @@ namespace CSMWorld
{ {
struct MetaData struct MetaData
{ {
static constexpr std::string_view getRecordType() { return "MetaData"; }
ESM::RefId mId; ESM::RefId mId;
ESM::FormatVersion mFormatVersion; ESM::FormatVersion mFormatVersion;

View File

@ -658,7 +658,7 @@ int CSMWorld::RefIdCollection::getIndex(const ESM::RefId& id) const
int index = searchId(id); int index = searchId(id);
if (index == -1) if (index == -1)
throw std::runtime_error("invalid ID: " + id.toDebugString()); throw std::runtime_error("ID is not found in RefId collection: " + id.toDebugString());
return index; return index;
} }

View File

@ -27,6 +27,8 @@ namespace ESM
class CellRef class CellRef
{ {
public: public:
static constexpr std::string_view getRecordType() { return "CellRef"; }
// Reference number // Reference number
// Note: Currently unused for items in containers // Note: Currently unused for items in containers
RefNum mRefNum; RefNum mRefNum;

View File

@ -15,6 +15,8 @@ namespace ESM
{ {
constexpr static RecNameInts sRecordId = REC_DBGP; constexpr static RecNameInts sRecordId = REC_DBGP;
static constexpr std::string_view getRecordType() { return "DebugProfile"; }
enum Flags enum Flags
{ {
Flag_Default = 1, // add to newly opened scene subviews Flag_Default = 1, // add to newly opened scene subviews

View File

@ -15,6 +15,8 @@ namespace ESM
{ {
constexpr static RecNameInts sRecordId = REC_FILT; constexpr static RecNameInts sRecordId = REC_FILT;
static constexpr std::string_view getRecordType() { return "Filter"; }
unsigned int mRecordFlags; unsigned int mRecordFlags;
RefId mId; RefId mId;