From c37f164c39a2af0a722f7a72018c6cc5ebc3f378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 27 Apr 2010 23:48:25 +0200 Subject: [PATCH] More work on local features - hell temple --- dfhack/include/modules/Maps.h | 11 +++++++-- dfhack/modules/Maps.cpp | 6 +++++ examples/veinlook.cpp | 44 ++++++++++++++--------------------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/dfhack/include/modules/Maps.h b/dfhack/include/modules/Maps.h index 2614c0356..cbb620fcf 100644 --- a/dfhack/include/modules/Maps.h +++ b/dfhack/include/modules/Maps.h @@ -14,10 +14,17 @@ namespace DFHack enum e_feature { + feature_Other, feature_Adamantine_Tube, feature_Underworld, - // add stuff here, don't reorder or delete - feature_Other = 10000, + feature_Hell_Temple, + }; + static char * sa_feature[]= + { + "Other", + "Adamantine Tube", + "Underworld", + "Hell Temple" }; union planecoord { diff --git a/dfhack/modules/Maps.cpp b/dfhack/modules/Maps.cpp index aa7f630bc..284c68a79 100644 --- a/dfhack/modules/Maps.cpp +++ b/dfhack/modules/Maps.cpp @@ -767,6 +767,12 @@ bool Maps::ReadLocalFeatures( std::map > & tftemp.sub_material = p->readDWord( cur_ptr + sub_mat_offset ); tftemp.type = feature_Adamantine_Tube; } + else if(name == "feature_init_deep_surface_portalst") + { + tftemp.main_material = p->readWord( cur_ptr + main_mat_offset ); + tftemp.sub_material = p->readDWord( cur_ptr + sub_mat_offset ); + tftemp.type = feature_Hell_Temple; + } else { tftemp.main_material = -1; diff --git a/examples/veinlook.cpp b/examples/veinlook.cpp index 7dfd992dd..237244b4c 100644 --- a/examples/veinlook.cpp +++ b/examples/veinlook.cpp @@ -439,20 +439,17 @@ void do_features(API& DF, mapblock40d * block, uint32_t blockX, uint32_t blockY, gotoxy(printX,printY+1); cprintf("You've discovered it already!"); } - if(ftr.type == feature_Underworld) + + char * matname = "unknown"; + // is stone? + if(ftr.main_material == 0) { - char * matname = "unknown"; - // is stone? - if(ftr.main_material == 0) - { - matname = stonetypes[ftr.sub_material].id; - } - gotoxy(printX,printY+2); - cprintf("Underworld, material %d/%d : %s", ftr.main_material, ftr.sub_material, matname); + matname = stonetypes[ftr.sub_material].id; } - else + gotoxy(printX,printY+2); + cprintf("%d:%s, material %d/%d : %s", ftr.type, sa_feature[ftr.type], ftr.main_material, ftr.sub_material, matname); { - gotoxy(printX,printY+2); + gotoxy(printX,printY+3); string name = p->readClassName(p->readDWord( ftr.origin )); cprintf("%s", name.c_str()); } @@ -471,23 +468,18 @@ void do_features(API& DF, mapblock40d * block, uint32_t blockX, uint32_t blockY, gotoxy(printX,printY+ 5); cprintf("You've discovered it already!"); } - if(ftr.type == feature_Adamantine_Tube) - { - char * matname = "unknown"; - // is stone? - if(ftr.main_material == 0) - { - matname = stonetypes[ftr.sub_material].id; - } - gotoxy(printX,printY+6); - cprintf("Underworld, material %d/%d : %s", ftr.main_material, ftr.sub_material, matname); - } - else + char * matname = "unknown"; + // is stone? + if(ftr.main_material == 0) { - gotoxy(printX,printY+6); - string name = p->readClassName(p->readDWord( ftr.origin )); - cprintf("%s", name.c_str()); + 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); + + gotoxy(printX,printY+7); + string name = p->readClassName(p->readDWord( ftr.origin )); + cprintf("%s", name.c_str()); } else {