Export fail removal - sa_feature, other minor changes

develop
Petr Mrázek 2011-03-03 17:50:17 +01:00
parent 680fe2981e
commit 6f7a8e3af5
5 changed files with 22 additions and 11 deletions

@ -173,6 +173,9 @@ void OffsetGroup::setOffset (const string & key, const string & value, const INV
if(it != OGd->offsets.end()) if(it != OGd->offsets.end())
{ {
int32_t offset = strtol(value.c_str(), NULL, 16); 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; (*it).second.second = offset;
if(inval != NOT_SET) if(inval != NOT_SET)
(*it).second.first = inval; (*it).second.first = inval;

@ -8,7 +8,6 @@
#include "dfhack/DFExport.h" #include "dfhack/DFExport.h"
#include "dfhack/DFModule.h" #include "dfhack/DFModule.h"
#include "Vegetation.h" #include "Vegetation.h"
namespace DFHack namespace DFHack
{ {
/*************************************************************************** /***************************************************************************
@ -23,7 +22,7 @@ namespace DFHack
feature_Hell_Temple 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. /// used as a key for the local feature map. combines X an Y coords.
union planecoord union planecoord

@ -41,12 +41,21 @@ distribution.
#define MAPS_GUARD if(!d->Started) throw DFHack::Error::ModuleNotInitialized(); #define MAPS_GUARD if(!d->Started) throw DFHack::Error::ModuleNotInitialized();
using namespace DFHack; using namespace DFHack;
const char * sa_feature[]= const char * DFHack::sa_feature(int index)
{ {
"Other", switch(index)
"Adamantine Tube", {
"Underworld", case 0:
"Hell Temple" return "Other";
case 1:
return "Adamantine Tube";
case 2:
return "Underworld";
case 3:
return "Hell Temple";
default:
return "Unknown/Error";
}
}; };
struct Maps::Private struct Maps::Private

@ -139,7 +139,7 @@ int main (int numargs, const char ** args)
printf("%-16s %4d (%2d) %s\n", "", printf("%-16s %4d (%2d) %s\n", "",
block.local_feature, block.local_feature,
local_features[pc][block.local_feature]->type, 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", "", printf("%-16s %4d (%2d) %s\n", "",
block.global_feature, block.global_feature,
global_features[block.global_feature].type, 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 #undef PRINT_FLAG

@ -441,7 +441,7 @@ void do_features(Context* DF, mapblock40d * block, uint32_t blockX, uint32_t blo
matname = stonetypes[ftr.sub_material].id; matname = stonetypes[ftr.sub_material].id;
} }
gotoxy(printX,printY+2); 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); gotoxy(printX,printY+3);
string name = p->readClassName(p->readDWord( ftr.origin )); 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; matname = stonetypes[ftr.sub_material].id;
} }
gotoxy(printX,printY+6); 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); gotoxy(printX,printY+7);
string name = p->readClassName(p->readDWord( ftr.origin )); string name = p->readClassName(p->readDWord( ftr.origin ));