diff --git a/tools/playground/CMakeLists.txt b/tools/playground/CMakeLists.txt index 950552547..06006bc96 100644 --- a/tools/playground/CMakeLists.txt +++ b/tools/playground/CMakeLists.txt @@ -19,12 +19,6 @@ ENDIF() # a creature mood dump hack. has hardcoded offsets DFHACK_TOOL(dfmoodump moodump.cpp) -# burn trees and shrubs to ashes -DFHACK_TOOL(dfimmolate immolate.cpp) - -# grow saplings into trees instantly -DFHACK_TOOL(dfgrow grow.cpp) - # bauxite - turn all mechanisms into bauxite mechanisms # Author: Alex Legg # FIXME: turned off. there is no reliable Items module. diff --git a/tools/supported/CMakeLists.txt b/tools/supported/CMakeLists.txt index efd146433..3f8f5299b 100644 --- a/tools/supported/CMakeLists.txt +++ b/tools/supported/CMakeLists.txt @@ -14,6 +14,12 @@ IF(MSVC) set(LOCAL_DEPNAME memxml-for-supported) ENDIF() +# burn trees and shrubs to ashes +DFHACK_TOOL(dfimmolate immolate.cpp) + +# grow saplings into trees instantly +DFHACK_TOOL(dfgrow grow.cpp) + # a reveal clone DFHACK_TOOL(dfreveal reveal.cpp) diff --git a/tools/playground/grow.cpp b/tools/supported/grow.cpp similarity index 87% rename from tools/playground/grow.cpp rename to tools/supported/grow.cpp index a5ab64617..12f02acf3 100644 --- a/tools/playground/grow.cpp +++ b/tools/supported/grow.cpp @@ -10,9 +10,11 @@ using namespace std; #include #include #include +#include "termutil.h" int main(int argc, char *argv[]) { + bool temporary_terminal = TemporaryTerminal(); srand(time(0)); uint32_t x_max = 0, y_max = 0, z_max = 0; @@ -22,9 +24,8 @@ int main(int argc, char *argv[]) if (!context->Attach()) { std::cerr << "Unable to attach to DF!" << std::endl; - #ifndef LINUX_BUILD - std::cin.ignore(); - #endif + if(temporary_terminal) + std::cin.ignore(); return 1; } @@ -33,9 +34,8 @@ int main(int argc, char *argv[]) { std::cerr << "Cannot get map info!" << std::endl; context->Detach(); - #ifndef LINUX_BUILD - std::cin.ignore(); - #endif + if(temporary_terminal) + std::cin.ignore(); return 1; } DFHack::Gui * Gui = context->getGui(); @@ -46,6 +46,8 @@ int main(int argc, char *argv[]) if (!veg->Start(vegCount)) { std::cerr << "Unable to read vegetation!" << std::endl; + if(temporary_terminal) + cin.ignore(); return 1; } int32_t x,y,z; @@ -89,10 +91,11 @@ int main(int argc, char *argv[]) veg->Finish(); maps->Finish(); context->Detach(); - #ifndef LINUX_BUILD - std::cout << " Press any key to finish."; - std::cin.ignore(); - #endif + if(temporary_terminal) + { + std::cout << " Press any key to finish."; + std::cin.ignore(); + } std::cout << std::endl; return 0; } diff --git a/tools/playground/immolate.cpp b/tools/supported/immolate.cpp similarity index 92% rename from tools/playground/immolate.cpp rename to tools/supported/immolate.cpp index b9c09ba73..e57a8f764 100644 --- a/tools/playground/immolate.cpp +++ b/tools/supported/immolate.cpp @@ -10,6 +10,7 @@ using namespace std; #include #include #include +#include "termutil.h" bool parseOptions(int argc, char **argv, bool &trees, bool &shrubs, bool &immolate) @@ -52,6 +53,7 @@ bool parseOptions(int argc, char **argv, int main(int argc, char *argv[]) { + bool temporary_terminal = TemporaryTerminal(); bool all_trees = false; bool all_shrubs = false; bool immolate = false; @@ -68,9 +70,8 @@ int main(int argc, char *argv[]) if (!context->Attach()) { std::cerr << "Unable to attach to DF!" << std::endl; - #ifndef LINUX_BUILD - std::cin.ignore(); - #endif + if(temporary_terminal) + std::cin.ignore(); return 1; } @@ -79,9 +80,8 @@ int main(int argc, char *argv[]) { std::cerr << "Cannot get map info!" << std::endl; context->Detach(); - #ifndef LINUX_BUILD - std::cin.ignore(); - #endif + if(temporary_terminal) + std::cin.ignore(); return 1; } DFHack::Gui * Gui = context->getGui(); @@ -92,6 +92,8 @@ int main(int argc, char *argv[]) if (!veg->Start(vegCount)) { std::cerr << "Unable to read vegetation!" << std::endl; + if(temporary_terminal) + cin.ignore(); return 1; } if(all_shrubs || all_trees) @@ -158,10 +160,10 @@ int main(int argc, char *argv[]) veg->Finish(); maps->Finish(); context->Detach(); - #ifndef LINUX_BUILD - std::cout << " Press any key to finish."; - std::cin.ignore(); - #endif - std::cout << std::endl; + if(temporary_terminal) + { + std::cout << " Press any key to finish."; + std::cin.ignore(); + } return 0; }