diff --git a/output/.gitignore b/output/.gitignore index 45291fd1d..c6cc1f208 100644 --- a/output/.gitignore +++ b/output/.gitignore @@ -1,3 +1,8 @@ -Debug -Release +<<<<<<< HEAD +Debug +Release +======= +Debug +Release +>>>>>>> remotes/peterix/master RelWithDebInfo \ No newline at end of file diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index ca619c9cd..9eb8fa50e 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -26,15 +26,16 @@ TARGET_LINK_LIBRARIES(dfincremental dfhack) ADD_EXECUTABLE(dfbauxite dfbauxite.cpp) TARGET_LINK_LIBRARIES(dfbauxite dfhack) -# itemdesignator - change some item designations (dump, forbid, on-fire) for all items of a given type and material -ADD_EXECUTABLE(dfitemdesignator itemdesignator.cpp) -TARGET_LINK_LIBRARIES(dfitemdesignator dfhack) - # digger - designate for digging by tile class # Author: mizipzor ADD_EXECUTABLE(dfdigger digger.cpp) TARGET_LINK_LIBRARIES(dfdigger dfhack) +# itemdesignator - change some item designations (dump, forbid, on-fire) for all items of a given type and material +ADD_EXECUTABLE(dfitemdesignator itemdesignator.cpp) +TARGET_LINK_LIBRARIES(dfitemdesignator dfhack) + + IF(UNIX) install(TARGETS dfreveal diff --git a/tools/findnameindexes.cpp b/tools/findnameindexes.cpp new file mode 100644 index 000000000..c584ae23c --- /dev/null +++ b/tools/findnameindexes.cpp @@ -0,0 +1,84 @@ +// Map cleaner. Removes all the snow, mud spills, blood and vomit from map tiles. + +#include +#include +#include +#include +#include +#include +using namespace std; + +#include +#include + +// returns a lower case version of the string +string tolower (const string & s) +{ + string d (s); + + transform (d.begin (), d.end (), d.begin (), (int(*)(int)) tolower); + return d; +} +string groupBy2(const string & s) +{ + string d; + for(int i =2;i>24) | + ((x<<8) & 0x00FF0000) | + ((x>>8) & 0x0000FF00) | + (x<<24); + return x; +} + + +int main (void) +{ + DFHack::API DF ("Memory.xml"); + if(!DF.Attach()) + { + cerr << "DF not found" << endl; + return 1; + } + map< string, vector > names; + if(!DF.InitReadNameTables(names)) + { + cerr << "Could not get Names" << endl; + return 1; + } + string input; + DF.ForceResume(); + cout << "\nSelect Name to search or q to Quit" << endl; + getline (cin, input); + while(input != "q"){ + for( map< string, vector >::iterator it = names.begin();it != names.end(); it++){ + for(uint32_t i = 0; i < it->second.size(); i++){ + uint32_t found = input.find(tolower(it->second[i])); + if(found != string::npos){ + stringstream value; + value << setfill('0') << setw(8) << hex << endian_swap(i); + cout << it->first << " " << it->second[i] << " " << groupBy2(value.str()) << endl; + } + } + } + DF.Resume(); + getline(cin,input); + } + DF.Detach(); + DF.FinishReadNameTables(); + #ifndef LINUX_BUILD + cout << "Done. Press any key to continue" << endl; + cin.ignore(); + #endif + return 0; +}