diff --git a/data/Memory-ng.xml b/data/Memory-ng.xml
index 3cf4be3e7..48c9ce60b 100644
--- a/data/Memory-ng.xml
+++ b/data/Memory-ng.xml
@@ -1892,7 +1892,7 @@
-
+
@@ -2028,12 +2028,12 @@
-
+
-
+
CHMOD
@@ -2144,7 +2144,7 @@
-
+
@@ -2208,7 +2208,7 @@
-
+
@@ -2231,7 +2231,7 @@
-
+
diff --git a/library/DFContext.cpp b/library/DFContext.cpp
index 8b67f193f..72662490b 100644
--- a/library/DFContext.cpp
+++ b/library/DFContext.cpp
@@ -334,7 +334,7 @@ bool API::InitReadEffects ( uint32_t & numeffects )
{
effects = d->offset_descriptor->getAddress ("effects_vector");
}
- catch(Error::MissingMemoryDefinition)
+ catch(Error::AllMemdef)
{
return false;
}
@@ -400,7 +400,7 @@ bool API::InitReadNotes( uint32_t &numnotes )
numnotes = d->p_notes->getSize();
return true;
}
- catch (Error::MissingMemoryDefinition&)
+ catch (Error::AllMemdef&)
{
d->notesInited = false;
numnotes = 0;
@@ -438,7 +438,7 @@ bool API::InitReadSettlements( uint32_t & numsettlements )
numsettlements = d->p_settlements->getSize();
return true;
}
- catch (Error::MissingMemoryDefinition&)
+ catch (Error::AllMemdef&)
{
d->settlementsInited = false;
numsettlements = 0;
@@ -543,7 +543,7 @@ bool API::InitReadItems(uint32_t & numitems)
numitems = d->p_itm->getSize();
return true;
}
- catch (Error::MissingMemoryDefinition&)
+ catch (Error::AllMemdef&)
{
d->itemsInited = false;
numitems = 0;
diff --git a/library/DFProcess-linux-SHM.cpp b/library/DFProcess-linux-SHM.cpp
index 6f6bedb34..4eaf47b90 100644
--- a/library/DFProcess-linux-SHM.cpp
+++ b/library/DFProcess-linux-SHM.cpp
@@ -339,7 +339,7 @@ bool SHMProcess::Private::validate(vector & known_versions)
return true;
}
}
- catch (Error::MissingMemoryDefinition&)
+ catch (Error::AllMemdef&)
{
continue;
}
diff --git a/library/DFProcess-linux-wine.cpp b/library/DFProcess-linux-wine.cpp
index 8ab9bc689..cd96b3e54 100644
--- a/library/DFProcess-linux-wine.cpp
+++ b/library/DFProcess-linux-wine.cpp
@@ -142,7 +142,7 @@ bool WineProcess::Private::validate(char* exe_file, uint32_t pid, char* mem_file
{
thishash = (*it)->getMD5();
}
- catch (Error::MissingMemoryDefinition& e)
+ catch (Error::AllMemdef& e)
{
continue;
}
diff --git a/library/DFProcess-linux.cpp b/library/DFProcess-linux.cpp
index 24bff365a..431dee508 100644
--- a/library/DFProcess-linux.cpp
+++ b/library/DFProcess-linux.cpp
@@ -142,7 +142,7 @@ bool NormalProcess::Private::validate(char * exe_file,uint32_t pid, char * memFi
return true;
}
}
- catch (Error::MissingMemoryDefinition&)
+ catch (Error::AllMemdef&)
{
continue;
}
diff --git a/library/DFProcess-windows-SHM.cpp b/library/DFProcess-windows-SHM.cpp
index aa9d50dfe..5630d3146 100644
--- a/library/DFProcess-windows-SHM.cpp
+++ b/library/DFProcess-windows-SHM.cpp
@@ -353,7 +353,7 @@ bool SHMProcess::Private::validate(vector & known_versions)
{
pe_timestamp = (*it)->getPE();
}
- catch(Error::MissingMemoryDefinition&)
+ catch(Error::AllMemdef&)
{
continue;
}
diff --git a/library/DFProcess-windows.cpp b/library/DFProcess-windows.cpp
index 5bc7bbe23..b9f3fd86e 100644
--- a/library/DFProcess-windows.cpp
+++ b/library/DFProcess-windows.cpp
@@ -111,7 +111,7 @@ NormalProcess::NormalProcess(uint32_t pid, vector & known_versio
{
pe_timestamp = (*it)->getPE();
}
- catch(Error::MissingMemoryDefinition&)
+ catch(Error::AllMemdef&)
{
continue;
}
diff --git a/library/VersionInfo.cpp b/library/VersionInfo.cpp
index c0a3477af..f63dc0930 100644
--- a/library/VersionInfo.cpp
+++ b/library/VersionInfo.cpp
@@ -127,11 +127,11 @@ namespace DFHack
*/
namespace DFHack
{
- typedef pair nullableUint32;
+ typedef pair nullableUint32;
typedef map ::iterator uint32_Iter;
- typedef pair nullableInt32;
+ typedef pair nullableInt32;
typedef map ::iterator int32_Iter;
- typedef pair nullableString;
+ typedef pair nullableString;
typedef map ::iterator strings_Iter;
typedef map ::iterator groups_Iter;
class OffsetGroupPrivate
@@ -149,69 +149,73 @@ namespace DFHack
void OffsetGroup::createOffset(const string & key)
{
- OGd->offsets[key] = nullableInt32(false, 0);
+ OGd->offsets[key] = nullableInt32(NOT_SET, 0);
}
void OffsetGroup::createAddress(const string & key)
{
- OGd->addresses[key] = nullableUint32(false, 0);
+ OGd->addresses[key] = nullableUint32(NOT_SET, 0);
}
void OffsetGroup::createHexValue(const string & key)
{
- OGd->hexvals[key] = nullableUint32(false, 0);
+ OGd->hexvals[key] = nullableUint32(NOT_SET, 0);
}
void OffsetGroup::createString(const string & key)
{
- OGd->strings[key] = nullableString(false, std::string());
+ OGd->strings[key] = nullableString(NOT_SET, std::string());
}
-void OffsetGroup::setOffset (const string & key, const string & value)
+void OffsetGroup::setOffset (const string & key, const string & value, const INVAL_TYPE inval)
{
int32_Iter it = OGd->offsets.find(key);
if(it != OGd->offsets.end())
{
int32_t offset = strtol(value.c_str(), NULL, 16);
(*it).second.second = offset;
- (*it).second.first = true;
+ if(inval != NOT_SET)
+ (*it).second.first = inval;
}
else throw Error::MissingMemoryDefinition("offset", getFullName() + key);
}
-void OffsetGroup::setAddress (const string & key, const string & value)
+void OffsetGroup::setAddress (const string & key, const string & value, const INVAL_TYPE inval)
{
uint32_Iter it = OGd->addresses.find(key);
if(it != OGd->addresses.end())
{
int32_t address = strtol(value.c_str(), NULL, 16);
(*it).second.second = address;
- (*it).second.first = true;
+ if(inval != NOT_SET)
+ (*it).second.first = inval;
}
else throw Error::MissingMemoryDefinition("address", getFullName() + key);
}
-void OffsetGroup::setHexValue (const string & key, const string & value)
+void OffsetGroup::setHexValue (const string & key, const string & value, const INVAL_TYPE inval)
{
uint32_Iter it = OGd->hexvals.find(key);
if(it != OGd->hexvals.end())
{
(*it).second.second = strtol(value.c_str(), NULL, 16);
- (*it).second.first = true;
+ if(inval != NOT_SET)
+ (*it).second.first = inval;
}
else throw Error::MissingMemoryDefinition("hexvalue", getFullName() + key);
}
-void OffsetGroup::setString (const string & key, const string & value)
+void OffsetGroup::setString (const string & key, const string & value, const INVAL_TYPE inval)
{
strings_Iter it = OGd->strings.find(key);
if(it != OGd->strings.end())
{
(*it).second.second = value;
- (*it).second.first = true;
+ if(inval != NOT_SET)
+ (*it).second.first = inval;
}
else throw Error::MissingMemoryDefinition("string", getFullName() + key);
}
@@ -224,8 +228,10 @@ uint32_t OffsetGroup::getAddress (const string & key)
if(iter != OGd->addresses.end())
{
- if((*iter).second.first)
+ if((*iter).second.first == IS_VALID)
return (*iter).second.second;
+ if((*iter).second.first == IS_INVALID)
+ throw Error::InvalidMemoryDefinition("address", getFullName() + key);
throw Error::UnsetMemoryDefinition("address", getFullName() + key);
}
throw Error::MissingMemoryDefinition("address", getFullName() + key);
@@ -238,8 +244,10 @@ int32_t OffsetGroup::getOffset (const string & key)
int32_Iter iter = OGd->offsets.find(key);
if(iter != OGd->offsets.end())
{
- if((*iter).second.first)
+ if((*iter).second.first == IS_VALID)
return (*iter).second.second;
+ if((*iter).second.first == IS_INVALID)
+ throw Error::InvalidMemoryDefinition("offset", getFullName() + key);
throw Error::UnsetMemoryDefinition("offset", getFullName() + key);
}
throw Error::MissingMemoryDefinition("offset", getFullName() + key);
@@ -252,8 +260,10 @@ uint32_t OffsetGroup::getHexValue (const string & key)
uint32_Iter iter = OGd->hexvals.find(key);
if(iter != OGd->hexvals.end())
{
- if((*iter).second.first)
+ if((*iter).second.first == IS_VALID)
return (*iter).second.second;
+ if((*iter).second.first == IS_INVALID)
+ throw Error::InvalidMemoryDefinition("hexvalue", getFullName() + key);
throw Error::UnsetMemoryDefinition("hexvalue", getFullName() + key);
}
throw Error::MissingMemoryDefinition("hexvalue", getFullName() + key);
@@ -265,8 +275,10 @@ std::string OffsetGroup::getString (const string &key)
strings_Iter iter = OGd->strings.find(key);
if(iter != OGd->strings.end())
{
- if((*iter).second.first)
+ if((*iter).second.first == IS_VALID)
return (*iter).second.second;
+ if((*iter).second.first == IS_INVALID)
+ throw Error::InvalidMemoryDefinition("string", getFullName() + key);
throw Error::UnsetMemoryDefinition("string", getFullName() + key);
}
throw Error::MissingMemoryDefinition("string", getFullName() + key);
@@ -361,6 +373,8 @@ std::string OffsetGroup::PrintOffsets(int indentation)
if((*iter).second.first)
ss << " value=\"" << hex << "0x" << (*iter).second.second << "\"";
ss << " />";
+ if((*iter).second.first == IS_INVALID)
+ ss << " INVALID!";
if(!(*iter).second.first)
ss << " MISSING!";
ss << endl;
@@ -372,6 +386,8 @@ std::string OffsetGroup::PrintOffsets(int indentation)
if((*iter2).second.first)
ss << " value=\"" << hex << "0x" << (*iter2).second.second << "\"";
ss << " />";
+ if((*iter2).second.first == IS_INVALID)
+ ss << " INVALID!";
if(!(*iter2).second.first)
ss << " MISSING!";
ss << endl;
@@ -382,6 +398,8 @@ std::string OffsetGroup::PrintOffsets(int indentation)
if((*iter).second.first)
ss << " value=\"" << hex << "0x" << (*iter).second.second << "\"";
ss << " />";
+ if((*iter).second.first == IS_INVALID)
+ ss << " INVALID!";
if(!(*iter).second.first)
ss << " MISSING!";
ss << endl;
@@ -393,6 +411,8 @@ std::string OffsetGroup::PrintOffsets(int indentation)
if((*iter3).second.first)
ss << " value=\"" << (*iter3).second.second << "\"";
ss << " />";
+ if((*iter3).second.first == IS_INVALID)
+ ss << " INVALID!";
if(!(*iter3).second.first)
ss << " MISSING!";
ss << endl;
@@ -409,6 +429,42 @@ std::string OffsetGroup::PrintOffsets(int indentation)
return ss.str();
}
+// the big ugly method behind the curtain...
+void OffsetGroup::setInvalid(INVAL_TYPE invalidity)
+{
+ if(invalidity == NOT_SET)
+ return;
+
+ uint32_Iter iter;
+ for(iter = OGd->addresses.begin(); iter != OGd->addresses.end(); iter++)
+ {
+ if((*iter).second.first)
+ (*iter).second.first = invalidity;
+ }
+ int32_Iter iter2;
+ for(iter2 = OGd->offsets.begin(); iter2 != OGd->offsets.end(); iter2++)
+ {
+ if((*iter2).second.first)
+ (*iter2).second.first = invalidity;
+ }
+ for(iter = OGd->hexvals.begin(); iter != OGd->hexvals.end(); iter++)
+ {
+ if((*iter).second.first)
+ (*iter).second.first = invalidity;
+ }
+ strings_Iter iter3;
+ for(iter3 = OGd->strings.begin(); iter3 != OGd->strings.end(); iter3++)
+ {
+ if((*iter3).second.first)
+ (*iter3).second.first = invalidity;
+ }
+ groups_Iter iter4;
+ for(iter4 = OGd->groups.begin(); iter4 != OGd->groups.end(); iter4++)
+ {
+ (*iter4).second->setInvalid(invalidity);
+ }
+}
+
/*
* Private data
*/
diff --git a/library/VersionInfoFactory.cpp b/library/VersionInfoFactory.cpp
index b9a640663..0f99713e4 100644
--- a/library/VersionInfoFactory.cpp
+++ b/library/VersionInfoFactory.cpp
@@ -31,6 +31,65 @@ distribution.
using namespace DFHack;
+template
+struct triple
+{
+ typedef _T1 first_type;
+ typedef _T2 second_type;
+ typedef _T3 third_type;
+
+ _T1 first;
+ _T2 second;
+ _T3 third;
+
+ triple() : first(), second(), third() { }
+
+ triple(const _T1& __a, const _T2& __b, const _T3& __c) : first(__a), second(__b), third(__c) { }
+
+ template
+ triple(const triple<_U1, _U2, _U3>& __p) : first(__p.first), second(__p.second), third(__p.third) { }
+
+};
+
+template
+inline bool operator==(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y)
+{
+ return __x.first == __y.first && __x.second == __y.second && __x.third == __y.third;
+}
+
+template
+inline bool operator<(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y)
+{
+ return
+ __x.first < __y.first ||
+ (!(__y.first < __x.first) && __x.second < __y.second) ||
+ (!(__y.first < __x.first) && !(__x.second < __y.second) && (__x.third < __y.third));
+}
+
+template
+inline bool operator!=(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y)
+{
+ return !(__x == __y);
+}
+
+template
+inline bool operator>(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y)
+{
+ return __y < __x;
+}
+
+template
+inline bool operator<=(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y)
+{
+ return !(__y < __x);
+}
+
+template
+inline bool operator>=(const triple<_T1, _T2, _T3>& __x, const triple<_T1, _T2, _T3>& __y)
+{
+ return !(__x < __y);
+}
+
VersionInfoFactory::~VersionInfoFactory()
{
// for each stored version, delete
@@ -95,35 +154,51 @@ void VersionInfoFactory::ParseVTable(TiXmlElement* vtable, VersionInfo* mem)
}
}
-// FIXME: this is ripe for replacement with a more generic approach
+struct breadcrumb
+{
+ TiXmlElement * first;
+ OffsetGroup * second;
+};
+
void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target, bool initial)
{
// we parse the groups iteratively instead of recursively
// breadcrubs acts like a makeshift stack
// first pair entry stores the current element of that level
// second pair entry the group object from OffsetGroup
- typedef pair < TiXmlElement *, OffsetGroup * > groupPair;
- vector< groupPair > breadcrumbs;
+ typedef triple< TiXmlElement *, OffsetGroup *, INVAL_TYPE> groupTriple;
+ vector< groupTriple > breadcrumbs;
{
TiXmlElement* pEntry;
// we get the , look at the children
pEntry = parent->FirstChildElement();
if(!pEntry)
return;
-
+ const char *cstr_invalid = parent->Attribute("valid");
+ INVAL_TYPE parent_inval = NOT_SET;
+ if(cstr_invalid)
+ {
+ if(strcmp(cstr_invalid,"false") == 0)
+ parent_inval = IS_INVALID;
+ else if(strcmp(cstr_invalid,"true") == 0)
+ parent_inval = IS_VALID;
+ }
OffsetGroup * currentGroup = reinterpret_cast (target);
- breadcrumbs.push_back(groupPair(pEntry,currentGroup));
+ currentGroup->setInvalid(parent_inval);
+ breadcrumbs.push_back(groupTriple(pEntry,currentGroup, parent_inval));
}
// work variables
OffsetGroup * currentGroup = 0;
TiXmlElement * currentElem = 0;
+ INVAL_TYPE parent_inval = NOT_SET;
//cerr << ""<< endl;
while(1)
{
// get current work variables
currentElem = breadcrumbs.back().first;
currentGroup = breadcrumbs.back().second;
+ parent_inval = breadcrumbs.back().third;
// we reached the end of the current group?
if(!currentElem)
@@ -144,7 +219,7 @@ void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target
if(!currentGroup)
{
- groupPair & gp = breadcrumbs.back();
+ groupTriple & gp = breadcrumbs.back();
gp.first = gp.first->NextSiblingElement();
continue;
}
@@ -152,7 +227,7 @@ void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target
// skip non-elements
if (currentElem->Type() != TiXmlNode::ELEMENT)
{
- groupPair & gp = breadcrumbs.back();
+ groupTriple & gp = breadcrumbs.back();
gp.first = gp.first->NextSiblingElement();
continue;
}
@@ -169,18 +244,27 @@ void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target
// evaluate elements
const char *cstr_value = currentElem->Attribute("value");
+ const char *cstr_invalid = currentElem->Attribute("valid");
+
+ INVAL_TYPE child_inval = parent_inval;
+ if(cstr_invalid)
+ {
+ if(strcmp(cstr_invalid,"false") == 0)
+ child_inval = IS_INVALID;
+ else if(strcmp(cstr_invalid,"true") == 0)
+ child_inval = IS_VALID;
+ }
if(type == "group")
{
- // FIXME: possibly use setGroup always, with the initial flag as parameter?
// create or get group
OffsetGroup * og;
if(initial)
og = currentGroup->createGroup(cstr_name);
else
og = currentGroup->getGroup(cstr_name);
- //cerr << "" << endl;
+
// advance this level to the next element
- groupPair & gp = breadcrumbs.back();
+ groupTriple & gp = breadcrumbs.back();
gp.first = currentElem->NextSiblingElement();
if(!og)
@@ -189,8 +273,9 @@ void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target
throw Error::MissingMemoryDefinition("group", fullname);
}
- // add a new level that will be processed next
- breadcrumbs.push_back(groupPair(currentElem->FirstChildElement(), og));
+ // add a new level that will be processed in the next step
+ breadcrumbs.push_back(groupTriple(currentElem->FirstChildElement(), og, child_inval));
+ og->setInvalid(child_inval);
continue;
}
else if(type == "address")
@@ -201,7 +286,7 @@ void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target
}
else if(cstr_value)
{
- currentGroup->setAddress(cstr_name, cstr_value);
+ currentGroup->setAddress(cstr_name, cstr_value, child_inval);
}
else
{
@@ -216,7 +301,7 @@ void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target
}
else if(cstr_value)
{
- currentGroup->setOffset(cstr_name, cstr_value);
+ currentGroup->setOffset(cstr_name, cstr_value, child_inval);
}
else
{
@@ -231,7 +316,7 @@ void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target
}
else if(cstr_value)
{
- currentGroup->setString(cstr_name, cstr_value);
+ currentGroup->setString(cstr_name, cstr_value, child_inval);
}
else
{
@@ -246,7 +331,7 @@ void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target
}
else if(cstr_value)
{
- currentGroup->setHexValue(cstr_name, cstr_value);
+ currentGroup->setHexValue(cstr_name, cstr_value, child_inval);
}
else
{
@@ -255,7 +340,7 @@ void VersionInfoFactory::ParseOffsets(TiXmlElement * parent, VersionInfo* target
}
// advance to next element
- groupPair & gp = breadcrumbs.back();
+ groupTriple & gp = breadcrumbs.back();
gp.first = currentElem->NextSiblingElement();
continue;
}
diff --git a/library/include/dfhack/DFError.h b/library/include/dfhack/DFError.h
index fcb80f724..28e11df33 100644
--- a/library/include/dfhack/DFError.h
+++ b/library/include/dfhack/DFError.h
@@ -39,6 +39,7 @@ namespace DFHack
* the whole array of DFHack exceptions from the rest
*/
class DFHACK_EXPORT All : public std::exception{};
+ class DFHACK_EXPORT AllMemdef : public All{};
class DFHACK_EXPORT NoProcess : public All
{
public:
@@ -80,7 +81,7 @@ namespace DFHack
};
// a call to DFHack::mem_info::get* failed
- class DFHACK_EXPORT MissingMemoryDefinition : public All
+ class DFHACK_EXPORT MissingMemoryDefinition : public AllMemdef
{
public:
MissingMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key)
@@ -113,7 +114,7 @@ namespace DFHack
};
// a call to DFHack::mem_info::get* failed
- class DFHACK_EXPORT UnsetMemoryDefinition : public All
+ class DFHACK_EXPORT UnsetMemoryDefinition : public AllMemdef
{
public:
UnsetMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key)
@@ -145,7 +146,41 @@ namespace DFHack
}
};
- // Syntax errors and whatnot, the xml cant be read
+ // a call to DFHack::mem_info::get* failed
+ class DFHACK_EXPORT InvalidMemoryDefinition : public AllMemdef
+ {
+ public:
+ InvalidMemoryDefinition(const char* _type, const std::string _key) : type(_type), key(_key)
+ {
+ std::stringstream s;
+ s << "memory object is INVALID: type " << type << " key " << key;
+ full = s.str();
+ }
+ // Used by functios using integer keys, such as getTrait
+ InvalidMemoryDefinition(const char* _type, uint32_t _key) : type(_type)
+ {
+ std::stringstream s1;
+ s1 << _key;
+ key = s1.str();
+
+ std::stringstream s;
+ s << "memory object is INVALID: type " << type << " key " << key;
+ full = s.str();
+ }
+ virtual ~InvalidMemoryDefinition() throw(){};
+
+ std::string full;
+ const std::string type;
+ std::string key;
+
+ virtual const char* what() const throw()
+ {
+ return full.c_str();
+ }
+ };
+
+
+ // Syntax errors and whatnot, the xml can't be read
class DFHACK_EXPORT MemoryXmlParse : public All
{
public:
@@ -156,14 +191,12 @@ namespace DFHack
s << "error " << id << ": " << desc << ", at row " << row << " col " << col;
full = s.str();
}
-
-
+
std::string full;
const std::string desc;
const int id;
const int row;
const int col;
-
virtual ~MemoryXmlParse() throw(){};
virtual const char* what() const throw()
diff --git a/library/include/dfhack/VersionInfo.h b/library/include/dfhack/VersionInfo.h
index 84a7087da..e01b8f115 100644
--- a/library/include/dfhack/VersionInfo.h
+++ b/library/include/dfhack/VersionInfo.h
@@ -41,6 +41,13 @@ namespace DFHack
class VersionInfoPrivate;
class OffsetGroupPrivate;
+ enum INVAL_TYPE
+ {
+ NOT_SET,
+ IS_INVALID,
+ IS_VALID
+ };
+
/*
* Offset Group
*/
@@ -68,14 +75,15 @@ namespace DFHack
std::string getString (const std::string & key);
OffsetGroup * getGroup ( const std::string & name );
- void setOffset (const std::string & key, const std::string & value);
- void setAddress (const std::string & key, const std::string & value);
- void setHexValue (const std::string & key, const std::string & value);
- void setString (const std::string & key, const std::string & value);
+ void setOffset (const std::string& key, const std::string& value, const DFHack::INVAL_TYPE inval = IS_VALID);
+ void setAddress (const std::string& key, const std::string& value, const DFHack::INVAL_TYPE inval = IS_VALID);
+ void setHexValue (const std::string& key, const std::string& value, const DFHack::INVAL_TYPE inval = IS_VALID);
+ void setString (const std::string& key, const std::string& value, const DFHack::INVAL_TYPE inval = IS_VALID);
std::string PrintOffsets(int indentation);
std::string getName();
std::string getFullName();
OffsetGroup * getParent();
+ void setInvalid(INVAL_TYPE arg1);
};
/*
diff --git a/library/modules/Buildings.cpp b/library/modules/Buildings.cpp
index 5e82be992..7541bb33e 100644
--- a/library/modules/Buildings.cpp
+++ b/library/modules/Buildings.cpp
@@ -85,9 +85,9 @@ Buildings::Buildings(DFContextShared * d_)
mem->resolveClassnameToClassID("building_custom_workshop", d->custom_workshop_id);
d->hasCustomWorkshops = true;
}
- catch(DFHack::Error::UnsetMemoryDefinition &e)
+ catch(DFHack::Error::AllMemdef &e)
{
- cerr << "Custom workshops not available. Unset Memory Definition: " << e.what() << endl;
+ cerr << "Custom workshops not available. Memory Definition: " << e.what() << endl;
}
d->Inited = true;
}
diff --git a/tools/examples/creaturedump.cpp b/tools/examples/creaturedump.cpp
index ac691316b..ae221a1e6 100644
--- a/tools/examples/creaturedump.cpp
+++ b/tools/examples/creaturedump.cpp
@@ -306,7 +306,7 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
{
cout << mem->getSkill(creature.defaultSoul.skills[i].id) << ": " << creature.defaultSoul.skills[i].rating;
}
- catch(DFHack::Error::MissingMemoryDefinition &e)
+ catch(DFHack::Error::AllMemdef &e)
{
cout << "Unknown skill! : " << creature.defaultSoul.skills[i].id <<", rating: " << creature.defaultSoul.skills[i].rating << endl;
cout << e.what() << endl;
diff --git a/tools/playground/renamer.cpp b/tools/playground/renamer.cpp
index c08fb0bfc..389ba8068 100644
--- a/tools/playground/renamer.cpp
+++ b/tools/playground/renamer.cpp
@@ -449,7 +449,7 @@ start:
uint32_t nickname = mem->getOffset("creature_name") + mem->getOffset("name_nickname");
p->writeSTLString(toChange.origin+nickname,changeString);
}
- catch (DFHack::Error::MissingMemoryDefinition&)
+ catch (DFHack::Error::AllMemdef&)
{
cerr << "Writing creature nicknames unsupported in this version!" << endl;
}
@@ -461,7 +461,7 @@ start:
uint32_t custom_prof = mem->getOffset("creature_custom_profession");
p->writeSTLString(toChange.origin+custom_prof,changeString);
}
- catch (DFHack::Error::MissingMemoryDefinition&)
+ catch (DFHack::Error::AllMemdef&)
{
cerr << "Writing creature custom profession unsupported in this version!" << endl;
}
diff --git a/tools/supported/cleartask.cpp b/tools/supported/cleartask.cpp
index 08f86f781..6ef34abac 100644
--- a/tools/supported/cleartask.cpp
+++ b/tools/supported/cleartask.cpp
@@ -39,7 +39,7 @@ int main ()
{
item_vec_offset = p->getDescriptor()->getAddress ("items_vector");
}
- catch(DFHack::Error::MissingMemoryDefinition & e)
+ catch(DFHack::Error::AllMemdef & e)
{
cerr << "missing offset for the item vector, exiting :(" << endl;
#ifndef LINUX_BUILD