diff --git a/library/VersionInfo.cpp b/library/VersionInfo.cpp index 0569b90f8..5c38de034 100644 --- a/library/VersionInfo.cpp +++ b/library/VersionInfo.cpp @@ -173,6 +173,9 @@ void OffsetGroup::setOffset (const string & key, const string & value, const INV if(it != OGd->offsets.end()) { int32_t offset = strtol(value.c_str(), NULL, 16); + // REPORT pointless rewrites + if((*it).second.second == offset) + std::cout << "Pointless offset setting: " << this->getFullName() + key << endl; (*it).second.second = offset; if(inval != NOT_SET) (*it).second.first = inval; diff --git a/library/include/dfhack/modules/Maps.h b/library/include/dfhack/modules/Maps.h index e0522f253..71337380b 100644 --- a/library/include/dfhack/modules/Maps.h +++ b/library/include/dfhack/modules/Maps.h @@ -8,7 +8,6 @@ #include "dfhack/DFExport.h" #include "dfhack/DFModule.h" #include "Vegetation.h" - namespace DFHack { /*************************************************************************** @@ -23,7 +22,7 @@ namespace DFHack feature_Hell_Temple }; - extern const char * sa_feature[]; + extern DFHACK_EXPORT const char * sa_feature(int index); /// used as a key for the local feature map. combines X an Y coords. union planecoord diff --git a/library/modules/Maps.cpp b/library/modules/Maps.cpp index 94c2a70bf..ae9227868 100644 --- a/library/modules/Maps.cpp +++ b/library/modules/Maps.cpp @@ -41,12 +41,21 @@ distribution. #define MAPS_GUARD if(!d->Started) throw DFHack::Error::ModuleNotInitialized(); using namespace DFHack; -const char * sa_feature[]= +const char * DFHack::sa_feature(int index) { - "Other", - "Adamantine Tube", - "Underworld", - "Hell Temple" + switch(index) + { + case 0: + return "Other"; + case 1: + return "Adamantine Tube"; + case 2: + return "Underworld"; + case 3: + return "Hell Temple"; + default: + return "Unknown/Error"; + } }; struct Maps::Private diff --git a/tools/supported/probe.cpp b/tools/supported/probe.cpp index 1df70e2cb..84c3ea694 100644 --- a/tools/supported/probe.cpp +++ b/tools/supported/probe.cpp @@ -139,7 +139,7 @@ int main (int numargs, const char ** args) printf("%-16s %4d (%2d) %s\n", "", block.local_feature, local_features[pc][block.local_feature]->type, - sa_feature[local_features[pc][block.local_feature]->type] + sa_feature(local_features[pc][block.local_feature]->type) ); } @@ -148,7 +148,7 @@ int main (int numargs, const char ** args) printf("%-16s %4d (%2d) %s\n", "", block.global_feature, global_features[block.global_feature].type, - sa_feature[global_features[block.global_feature].type] + sa_feature(global_features[block.global_feature].type) ); } #undef PRINT_FLAG diff --git a/tools/supported/veinlook.cpp b/tools/supported/veinlook.cpp index 643f416c6..542f698b5 100644 --- a/tools/supported/veinlook.cpp +++ b/tools/supported/veinlook.cpp @@ -441,7 +441,7 @@ void do_features(Context* DF, mapblock40d * block, uint32_t blockX, uint32_t blo matname = stonetypes[ftr.sub_material].id; } gotoxy(printX,printY+2); - cprintf("%d:%s, material %d/%d : %s", ftr.type, sa_feature[ftr.type], ftr.main_material, ftr.sub_material, matname); + cprintf("%d:%s, material %d/%d : %s", ftr.type, sa_feature(ftr.type), ftr.main_material, ftr.sub_material, matname); { gotoxy(printX,printY+3); string name = p->readClassName(p->readDWord( ftr.origin )); @@ -469,7 +469,7 @@ void do_features(Context* DF, mapblock40d * block, uint32_t blockX, uint32_t blo matname = stonetypes[ftr.sub_material].id; } gotoxy(printX,printY+6); - cprintf("%d:%s, material %d/%d : %s", ftr.type, sa_feature[ftr.type], ftr.main_material, ftr.sub_material, matname); + cprintf("%d:%s, material %d/%d : %s", ftr.type, sa_feature(ftr.type), ftr.main_material, ftr.sub_material, matname); gotoxy(printX,printY+7); string name = p->readClassName(p->readDWord( ftr.origin ));