Merge branch 'cs_log' into 'master'

Make editor failure to load content files more detailed

See merge request OpenMW/openmw!3062
simplify_debugging
jvoisin 1 year ago
commit 2ab5b8e7b0

@ -296,9 +296,8 @@ namespace CSMWorld
const int index = getIndex(id);
Record<ESXRecordT>& record = *mRecords.at(index);
if (record.isDeleted())
{
throw std::runtime_error("attempt to touch deleted record");
}
throw std::runtime_error("attempt to touch deleted record from collection of "
+ std::string(ESXRecordT::getRecordType()) + ": " + id.toDebugString());
if (!record.isModified())
{
@ -394,7 +393,8 @@ namespace CSMWorld
int index = searchId(id);
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;
}
@ -427,7 +427,8 @@ namespace CSMWorld
NestableColumn* Collection<ESXRecordT>::getNestableColumn(int column) const
{
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);
}

@ -27,6 +27,7 @@
#include <apps/opencs/model/world/subcellcollection.hpp>
#include <apps/opencs/model/world/universalid.hpp>
#include <components/debug/debuglog.hpp>
#include <components/esm/defs.hpp>
#include <components/esm/esmcommon.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)
{
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
std::shared_ptr<ESM::ESMReader> ptr(mReader);
mReaders.push_back(ptr);

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

@ -658,7 +658,7 @@ int CSMWorld::RefIdCollection::getIndex(const ESM::RefId& id) const
int index = searchId(id);
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;
}

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

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

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

Loading…
Cancel
Save