Improve error message for not found records

c++11
scrawl 10 years ago
parent de98d991b4
commit 28caeadef4

@ -188,7 +188,7 @@ namespace MWWorld
const T *ptr = search(id);
if (ptr == 0) {
std::ostringstream msg;
msg << "Object '" << id << "' not found (const)";
msg << T::getRecordType() << " '" << id << "' not found";
throw std::runtime_error(msg.str());
}
return ptr;
@ -202,7 +202,7 @@ namespace MWWorld
if(ptr == 0)
{
std::ostringstream msg;
msg << "Object starting with '"<<id<<"' not found (const)";
msg << T::getRecordType() << " starting with '"<<id<<"' not found";
throw std::runtime_error(msg.str());
}
return ptr;
@ -989,7 +989,7 @@ namespace MWWorld
const T *ptr = search(index);
if (ptr == 0) {
std::ostringstream msg;
msg << "Object with index " << index << " not found";
msg << T::getRecordType() << " with index " << index << " not found";
throw std::runtime_error(msg.str());
}
return ptr;

@ -12,6 +12,8 @@ class ESMWriter;
struct Activator
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Activator"; }
std::string mId, mName, mScript, mModel;

@ -19,6 +19,9 @@ struct Potion
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Potion"; }
struct ALDTstruct
{
float mWeight;

@ -16,6 +16,8 @@ class ESMWriter;
struct Apparatus
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Apparatus"; }
enum AppaType
{

@ -66,6 +66,8 @@ struct PartReferenceList
struct Armor
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Armor"; }
enum Type
{

@ -12,6 +12,8 @@ class ESMWriter;
struct BodyPart
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "BodyPart"; }
enum MeshPart
{

@ -15,6 +15,8 @@ class ESMWriter;
struct Book
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Book"; }
struct BKDTstruct
{

@ -14,6 +14,8 @@ class ESMWriter;
struct BirthSign
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "BirthSign"; }
std::string mId, mName, mDescription, mTexture;

@ -56,6 +56,8 @@ typedef std::list<CellRef> CellRefTracker;
struct Cell
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Cell"; }
enum Flags
{

@ -18,6 +18,8 @@ class ESMWriter;
struct Class
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Class"; }
enum AutoCalc
{

@ -18,6 +18,8 @@ class ESMWriter;
struct Clothing
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Clothing"; }
enum Type
{

@ -36,6 +36,8 @@ struct InventoryList
struct Container
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Container"; }
enum Flags
{

@ -22,6 +22,8 @@ class ESMWriter;
struct Creature
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Creature"; }
// Default is 0x48?
enum Flags

@ -21,6 +21,8 @@ class ESMWriter;
struct Dialogue
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Dialogue"; }
enum Type
{

@ -12,6 +12,8 @@ class ESMWriter;
struct Door
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Door"; }
std::string mId, mName, mModel, mScript, mOpenSound, mCloseSound;

@ -18,6 +18,8 @@ class ESMWriter;
struct Enchantment
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Enchantment"; }
enum Type
{

@ -30,6 +30,8 @@ struct RankData
struct Faction
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Faction"; }
std::string mId, mName;

@ -18,6 +18,8 @@ class ESMWriter;
struct Global
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Global"; }
std::string mId;
Variant mValue;

@ -19,6 +19,8 @@ class ESMWriter;
struct GameSetting
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "GameSetting"; }
std::string mId;

@ -21,6 +21,8 @@ class ESMWriter;
struct DialInfo
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "DialInfo"; }
enum Gender
{

@ -16,6 +16,8 @@ class ESMWriter;
struct Ingredient
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Ingredient"; }
struct IRDTstruct
{

@ -18,6 +18,8 @@ class ESMWriter;
struct Land
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Land"; }
Land();
~Land();

@ -46,6 +46,8 @@ struct LevelledListBase
struct CreatureLevList: LevelledListBase
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "CreatureLevList"; }
enum Flags
{
@ -64,6 +66,8 @@ struct CreatureLevList: LevelledListBase
struct ItemLevList: LevelledListBase
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "ItemLevList"; }
enum Flags
{

@ -17,6 +17,8 @@ class ESMWriter;
struct Light
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Light"; }
enum Flags
{

@ -12,6 +12,8 @@ class ESMWriter;
struct Lockpick
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Lockpick"; }
struct Data
{

@ -28,6 +28,8 @@ class ESMWriter;
struct LandTexture
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "LandTexture"; }
std::string mId, mTexture;
int mIndex;

@ -13,6 +13,8 @@ class ESMWriter;
struct MagicEffect
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "MagicEffect"; }
std::string mId;

@ -17,6 +17,8 @@ class ESMWriter;
struct Miscellaneous
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Miscellaneous"; }
struct MCDTstruct
{

@ -23,6 +23,8 @@ class ESMWriter;
struct NPC
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "NPC"; }
// Services
enum Services

@ -16,6 +16,8 @@ class ESMWriter;
struct Pathgrid
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Pathgrid"; }
struct DATAstruct
{

@ -12,6 +12,8 @@ class ESMWriter;
struct Probe
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Probe"; }
struct Data
{

@ -18,6 +18,8 @@ class ESMWriter;
struct Race
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Race"; }
struct SkillBonus
{

@ -19,6 +19,8 @@ class ESMWriter;
struct Region
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Region"; }
#pragma pack(push)
#pragma pack(1)

@ -12,6 +12,8 @@ class ESMWriter;
struct Repair
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Repair"; }
struct Data
{

@ -20,6 +20,8 @@ class Script
{
public:
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Script"; }
struct SCHDstruct
{

@ -20,6 +20,8 @@ class ESMWriter;
struct Skill
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Skill"; }
std::string mId;

@ -16,6 +16,8 @@ class ESMWriter;
struct SoundGenerator
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "SoundGenerator"; }
enum Type
{

@ -17,6 +17,8 @@ struct SOUNstruct
struct Sound
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Sound"; }
SOUNstruct mData;
std::string mId, mSound;

@ -14,6 +14,8 @@ class ESMWriter;
struct Spell
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Spell"; }
enum SpellType
{

@ -20,6 +20,8 @@ class ESMWriter;
struct StartScript
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "StartScript"; }
std::string mData;
std::string mId;

@ -23,6 +23,8 @@ class ESMWriter;
struct Static
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Static"; }
std::string mId, mModel;

@ -16,6 +16,8 @@ class ESMWriter;
struct Weapon
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Weapon"; }
enum Type
{

Loading…
Cancel
Save