Skip to content

Commit 6f7a8e3

Browse files
committed
Export fail removal - sa_feature, other minor changes
1 parent 680fe29 commit 6f7a8e3

5 files changed

Lines changed: 22 additions & 11 deletions

File tree

library/VersionInfo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ void OffsetGroup::setOffset (const string & key, const string & value, const INV
173173
if(it != OGd->offsets.end())
174174
{
175175
int32_t offset = strtol(value.c_str(), NULL, 16);
176+
// REPORT pointless rewrites
177+
if((*it).second.second == offset)
178+
std::cout << "Pointless offset setting: " << this->getFullName() + key << endl;
176179
(*it).second.second = offset;
177180
if(inval != NOT_SET)
178181
(*it).second.first = inval;

library/include/dfhack/modules/Maps.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "dfhack/DFExport.h"
99
#include "dfhack/DFModule.h"
1010
#include "Vegetation.h"
11-
1211
namespace DFHack
1312
{
1413
/***************************************************************************
@@ -23,7 +22,7 @@ namespace DFHack
2322
feature_Hell_Temple
2423
};
2524

26-
extern const char * sa_feature[];
25+
extern DFHACK_EXPORT const char * sa_feature(int index);
2726

2827
/// used as a key for the local feature map. combines X an Y coords.
2928
union planecoord

library/modules/Maps.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,21 @@ distribution.
4141
#define MAPS_GUARD if(!d->Started) throw DFHack::Error::ModuleNotInitialized();
4242
using namespace DFHack;
4343

44-
const char * sa_feature[]=
44+
const char * DFHack::sa_feature(int index)
4545
{
46-
"Other",
47-
"Adamantine Tube",
48-
"Underworld",
49-
"Hell Temple"
46+
switch(index)
47+
{
48+
case 0:
49+
return "Other";
50+
case 1:
51+
return "Adamantine Tube";
52+
case 2:
53+
return "Underworld";
54+
case 3:
55+
return "Hell Temple";
56+
default:
57+
return "Unknown/Error";
58+
}
5059
};
5160

5261
struct Maps::Private

tools/supported/probe.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ int main (int numargs, const char ** args)
139139
printf("%-16s %4d (%2d) %s\n", "",
140140
block.local_feature,
141141
local_features[pc][block.local_feature]->type,
142-
sa_feature[local_features[pc][block.local_feature]->type]
142+
sa_feature(local_features[pc][block.local_feature]->type)
143143
);
144144
}
145145

@@ -148,7 +148,7 @@ int main (int numargs, const char ** args)
148148
printf("%-16s %4d (%2d) %s\n", "",
149149
block.global_feature,
150150
global_features[block.global_feature].type,
151-
sa_feature[global_features[block.global_feature].type]
151+
sa_feature(global_features[block.global_feature].type)
152152
);
153153
}
154154
#undef PRINT_FLAG

tools/supported/veinlook.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void do_features(Context* DF, mapblock40d * block, uint32_t blockX, uint32_t blo
441441
matname = stonetypes[ftr.sub_material].id;
442442
}
443443
gotoxy(printX,printY+2);
444-
cprintf("%d:%s, material %d/%d : %s", ftr.type, sa_feature[ftr.type], ftr.main_material, ftr.sub_material, matname);
444+
cprintf("%d:%s, material %d/%d : %s", ftr.type, sa_feature(ftr.type), ftr.main_material, ftr.sub_material, matname);
445445
{
446446
gotoxy(printX,printY+3);
447447
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
469469
matname = stonetypes[ftr.sub_material].id;
470470
}
471471
gotoxy(printX,printY+6);
472-
cprintf("%d:%s, material %d/%d : %s", ftr.type, sa_feature[ftr.type], ftr.main_material, ftr.sub_material, matname);
472+
cprintf("%d:%s, material %d/%d : %s", ftr.type, sa_feature(ftr.type), ftr.main_material, ftr.sub_material, matname);
473473

474474
gotoxy(printX,printY+7);
475475
string name = p->readClassName(p->readDWord( ftr.origin ));

0 commit comments

Comments
 (0)