apply terminal detection hack to all supported tools, add missing terminfo header

develop
Petr Mrázek 2011-05-15 06:10:47 +02:00
parent fe6eb4b70a
commit ca65aa99e6
22 changed files with 204 additions and 183 deletions

@ -7,9 +7,11 @@
#include <ctime>
using namespace std;
#include <DFHack.h>
#include "termutil.h"
int main (void)
{
bool temporary_terminal = TemporaryTerminal();
time_t start, end;
double time_diff;
DFHack::ContextManager DFMgr("Memory.xml");
@ -23,9 +25,8 @@ int main (void)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
/*
@ -80,9 +81,10 @@ int main (void)
time_diff = difftime(end, start);
cout << "suspend tests done in " << time_diff << " seconds." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}

@ -11,6 +11,7 @@ using namespace std;
#include <DFHack.h>
#include <dfhack/DFVector.h>
#include <dfhack/extra/MapExtras.h> // map cache for the win.
#include "termutil.h"
using namespace DFHack;
using MapExtras::Block;
using MapExtras::MapCache;
@ -19,6 +20,7 @@ typedef std::map <DFCoord, uint32_t> coordmap;
int main (int argc, char * argv[])
{
bool temporary_terminal = TemporaryTerminal();
// Command line options
bool destroy = false;
if(argc > 1 && strcmp(argv[1],"-d") == 0)
@ -53,9 +55,8 @@ int main (int argc, char * argv[])
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -67,9 +68,8 @@ int main (int argc, char * argv[])
if(!Maps->Start())
{
cerr << "Can't initialize map." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
MapCache MC (Maps);
@ -84,9 +84,8 @@ int main (int argc, char * argv[])
if (!Gui->getCursorCoords(cx,cy,cz))
{
cerr << "Cursor position not found. Please enabled the cursor." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
pos_cursor = DFCoord(cx,cy,cz);
@ -95,18 +94,16 @@ int main (int argc, char * argv[])
if(!b)
{
cerr << "Cursor is in an invalid area. Place it over something save first." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
uint16_t ttype = MC.tiletypeAt(pos_cursor);
if(!DFHack::isFloorTerrain(ttype))
{
cerr << "Cursor should be placed over a floor." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
}
@ -209,9 +206,10 @@ int main (int argc, char * argv[])
{
cout << "Done. " << dumped_total << " items marked for destruction." << endl;
}
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}

@ -7,10 +7,11 @@
using namespace std;
#include <DFHack.h>
#include "termutil.h"
int main (int argc, char** argv)
{
bool temporary_terminal = TemporaryTerminal();
bool quiet = false;
for(int i = 1; i < argc; i++)
{
@ -33,9 +34,8 @@ int main (int argc, char** argv)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
DFHack::Maps *Mapz = DF->getMaps();
@ -44,9 +44,8 @@ int main (int argc, char** argv)
if(!Mapz->Start())
{
cerr << "Can't init map." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -91,12 +90,10 @@ int main (int argc, char** argv)
}
}
DF->Detach();
#ifndef LINUX_BUILD
if (!quiet)
if (!quiet && temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
}
#endif
return 0;
}

@ -13,9 +13,11 @@ using namespace std;
#include <DFHack.h>
#include <dfhack/DFVector.h>
#include <dfhack/DFTypes.h>
#include "termutil.h"
int main (int argc, char *argv[])
{
bool temporary_terminal = TemporaryTerminal();
bool dump_scattered = false;
bool confiscate_all = false;
bool dry_run = false;
@ -60,9 +62,8 @@ int main (int argc, char *argv[])
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -175,10 +176,10 @@ int main (int argc, char *argv[])
*/
}
}
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}

@ -11,9 +11,11 @@ using namespace std;
#include <DFHack.h>
#include <dfhack/DFVector.h>
#include <dfhack/DFTypes.h>
#include "termutil.h"
int main ()
{
bool temporary_terminal = TemporaryTerminal();
DFHack::Process * p;
unsigned int i;
DFHack::ContextManager DFMgr("Memory.xml");
@ -27,9 +29,8 @@ int main ()
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -44,9 +45,8 @@ int main ()
catch(DFHack::Error::All & e)
{
cerr << "Fatal error, exiting :(" << endl << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -68,9 +68,10 @@ int main ()
}
cout << "Found and untasked " << numtasked << " items." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}

@ -10,10 +10,11 @@ using namespace std;
#include <DFHack.h>
#include <dfhack/DFTileTypes.h>
#include "termutil.h"
int main (void)
{
bool temporary_terminal = TemporaryTerminal();
uint32_t x_max,y_max,z_max;
uint32_t num_blocks = 0;
uint32_t bytes_read = 0;
@ -42,9 +43,8 @@ int main (void)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
DFHack::Maps *Mapz = DF->getMaps();
@ -53,9 +53,8 @@ int main (void)
if (!Mapz->Start())
{
cerr << "Can't init map." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -138,9 +137,10 @@ int main (void)
DF->Detach();
cout << "Found and changed " << count << " tiles." << endl;
cout << "Fixed " << countbad << " bad down ramps." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}

@ -10,10 +10,11 @@ using namespace std;
#include <DFHack.h>
#include <dfhack/DFTileTypes.h>
#include "termutil.h"
int main (void)
{
bool temporary_terminal = TemporaryTerminal();
uint32_t x_max,y_max,z_max;
DFHack::designations40d designations;
DFHack::tiletypes40d tiles;
@ -35,9 +36,8 @@ int main (void)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
DFHack::Maps *Mapz = DF->getMaps();
@ -46,9 +46,8 @@ int main (void)
if (!Mapz->Start())
{
cerr << "Can't init map." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -56,9 +55,8 @@ int main (void)
if(!Mapz->StartFeatures())
{
cerr << "Can't get features." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -114,9 +112,10 @@ int main (void)
}
DF->Detach();
cout << "Found and changed " << count << " tiles." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}

@ -10,9 +10,11 @@ using namespace std;
#include <DFHack.h>
#include <dfhack/VersionInfoFactory.h>
using namespace DFHack;
#include "termutil.h"
int main (int numargs, const char ** args)
{
bool temporary_terminal = TemporaryTerminal();
/*
DFHack::VersionInfoFactory * VIF = new DFHack::VersionInfoFactory("Memory.xml");
for(int i = 0; i < VIF->versions.size(); i++)
@ -29,16 +31,16 @@ int main (int numargs, const char ** args)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
cout << DF->getMemoryInfo()->PrintOffsets();
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
//delete VIF;
return 0;
}

@ -9,7 +9,7 @@
using namespace std;
#include <DFHack.h>
#include "termutil.h"
void print_progress (int current, int total)
{
if(total < 100)
@ -29,10 +29,10 @@ void print_progress (int current, int total)
int main (int numargs, char** args)
{
bool temporary_terminal = TemporaryTerminal();
time_t start, end;
double time_diff;
unsigned int iterations = 0;
if (numargs == 2)
{
@ -58,9 +58,8 @@ int main (int numargs, char** args)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -70,7 +69,6 @@ int main (int numargs, char** args)
for(uint32_t i = 0; i< iterations;i++)
{
print_progress (i, iterations);
if(!Maps->Start())
break;
Maps->getSize(x_max,y_max,z_max);
@ -97,9 +95,10 @@ int main (int numargs, char** args)
cout << num_blocks << " blocks read" << endl;
cout << bytes_read / (1024 * 1024) << " MB" << endl;
cout << "map export tests done in " << time_diff << " seconds." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}

@ -5,9 +5,10 @@
using namespace std;
#include <DFHack.h>
#include "termutil.h"
int main (void)
{
bool temporary_terminal = TemporaryTerminal();
uint32_t x_max,y_max,z_max;
DFHack::designations40d designations;
@ -23,18 +24,16 @@ int main (void)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
// init the map
if(!Maps->Start())
{
cerr << "Can't init map." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
DFHack::t_blockflags bflags;
@ -76,8 +75,7 @@ int main (void)
cout << "Magma tiles: " << magma << endl;
cout << endl << "Done." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 0;
}

@ -7,9 +7,11 @@ using namespace std;
#include <DFHack.h>
#include <dfhack/modules/Gui.h>
#include "termutil.h"
int main (int argc, char** argv)
{
bool temporary_terminal = TemporaryTerminal();
bool quiet = false;
for(int i = 1; i < argc; i++)
{
@ -30,9 +32,8 @@ int main (int argc, char** argv)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(!quiet) cin.ignore();
#endif
if(!quiet && temporary_terminal)
cin.ignore();
return 1;
}
@ -41,9 +42,8 @@ int main (int argc, char** argv)
World->SetPauseState(true);
DF->Resume();
#ifndef LINUX_BUILD
cout << "Done. The current game frame will have to finish first. This can take some time on bugged maps." << endl;
if (!quiet) cin.ignore();
#endif
if(!quiet && temporary_terminal)
cin.ignore();
return 0;
}

@ -5,14 +5,13 @@
#include <map>
using namespace std;
#include <DFHack.h>
//#include <dfhack/modules/Gui.h>
//#include <dfhack/DFTileTypes.h>
#include "termutil.h"
int main (void)
{
bool temporary_terminal = TemporaryTerminal();
uint32_t x_max,y_max,z_max;
DFHack::occupancies40d occupancies;
//DFHack::tiletypes40d tiles;
DFHack::ContextManager DFMgr("Memory.xml");
DFHack::Context *DF;
@ -24,9 +23,8 @@ int main (void)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -36,9 +34,8 @@ int main (void)
if(!Maps->Start())
{
cerr << "Can't init map." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -68,9 +65,10 @@ int main (void)
}
}
}
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "The map has been marked as a creature lair. Items shouldn't scatter." << endl;
cin.ignore();
#endif
}
return 0;
}

@ -9,6 +9,8 @@ using namespace std;
#include <set>
using namespace MapExtras;
#include "termutil.h"
typedef vector <DFHack::DFCoord> coord_vec;
class Brush
@ -130,6 +132,7 @@ public:
int main (int argc, char** argv)
{
bool temporary_terminal = TemporaryTerminal();
bool quiet = false;
for(int i = 1; i < argc; i++)
{
@ -140,11 +143,7 @@ int main (int argc, char** argv)
}
}
int32_t x,y,z;
/*
DFHack::designations40d designations;
DFHack::tiletypes40d tiles;
DFHack::t_temperatures temp1,temp2;
*/
uint32_t x_max,y_max,z_max;
DFHack::ContextManager DFMgr("Memory.xml");
@ -165,9 +164,8 @@ int main (int argc, char** argv)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
bool end = false;
@ -496,12 +494,10 @@ int main (int argc, char** argv)
}
}
DF->Detach();
#ifndef LINUX_BUILD
if(!quiet)
if(temporary_terminal && !quiet)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
}
#endif
return 0;
}

@ -7,7 +7,7 @@
using namespace std;
#include <DFHack.h>
#include "termutil.h"
std::ostream &operator<<(std::ostream &stream, DFHack::t_gamemodes funzies)
{
const char * gm[]=
@ -37,6 +37,7 @@ std::ostream &operator<<(std::ostream &stream, DFHack::t_gamemodes funzies)
int main (int argc, char** argv)
{
bool temporary_terminal = TemporaryTerminal();
bool quiet = false;
for(int i = 1; i < argc; i++)
{
@ -65,9 +66,8 @@ int main (int argc, char** argv)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
DFHack::t_gamemodes gmm;
@ -117,12 +117,10 @@ int main (int argc, char** argv)
cerr << "Can't detach from DF" << endl;
}
#ifndef LINUX_BUILD
if(!quiet)
if(!quiet && temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
}
#endif
return 0;
}

@ -13,16 +13,16 @@ using namespace std;
#define DFHACK_WANT_TILETYPES 1
#include <DFHack.h>
#include <dfhack/extra/MapExtras.h>
#include "termutil.h"
using namespace DFHack;
int main (int numargs, const char ** args)
{
bool temporary_terminal = TemporaryTerminal();
DFHack::ContextManager DFMgr("Memory.xml");
DFHack::Context *DF = DFMgr.getSingleContext();
#ifndef LINUX_BUILD
BEGIN_PROBE:
#endif
try
{
DF->Attach();
@ -30,9 +30,8 @@ int main (int numargs, const char ** args)
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -206,10 +205,11 @@ int main (int numargs, const char ** args)
}
}
DF->Detach();
#ifndef LINUX_BUILD
if(temporary_terminal)
{
std::cout << "Press any key to refresh..." << std::endl;
cin.ignore();
goto BEGIN_PROBE;
#endif
}
return 0;
}

@ -21,6 +21,7 @@ void waitmsec (int delay)
Sleep(delay);
}
#endif
#include "termutil.h"
struct hideblock
{
@ -32,9 +33,9 @@ struct hideblock
int main (void)
{
bool temporary_terminal = TemporaryTerminal();
uint32_t x_max,y_max,z_max;
DFHack::designations40d designations;
DFHack::ContextManager DFMgr("Memory.xml");
DFHack::Context *DF;
try
@ -45,12 +46,10 @@ int main (void)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
DFHack::Maps *Maps =DF->getMaps();
DFHack::World *World =DF->getWorld();
// walk the map, save the hide bits, reveal.
@ -69,9 +68,8 @@ int main (void)
if(!Maps->Start())
{
cerr << "Can't init map." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -129,9 +127,10 @@ int main (void)
}
Maps->WriteDesignations(hb.x,hb.y,hb.z, &designations);
}
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}

@ -8,8 +8,11 @@
using namespace std;
#include <DFHack.h>
#include "termutil.h"
int main (void)
{
bool temporary_terminal = TemporaryTerminal();
string blah;
DFHack::ContextManager DFMgr("Memory.xml");
DFHack::Context * DF;
@ -21,9 +24,8 @@ int main (void)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
cout << "Attached, DF should be suspended now" << endl;
@ -48,10 +50,12 @@ int main (void)
if(!DF->Detach())
{
cerr << "Can't detach from DF" << endl;
if(temporary_terminal)
cin.ignore();
return 1;
}
cout << "Detached, DF should be running again" << endl;
if(temporary_terminal)
getline(cin, blah);
return 0;
}

@ -0,0 +1,29 @@
#ifndef TERMUTIL_H
#define TERMUTIL_H
#ifdef LINUX_BUILD
// FIXME: is this ever false?
bool TemporaryTerminal ()
{
return false;
}
#else
#include <windows.h>
#include <stdio.h>
#include <conio.h>
bool TemporaryTerminal ()
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
HANDLE hStdOutput;
hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
if (!GetConsoleScreenBufferInfo(hStdOutput, &csbi))
{
printf("GetConsoleScreenBufferInfo failed: %d\n", GetLastError());
return false;
}
return ((!csbi.dwCursorPosition.X) && (!csbi.dwCursorPosition.Y));
};
#endif // LINUX_BUILD
#endif

@ -9,6 +9,7 @@
using namespace std;
#include <DFHack.h>
#include <dfhack/extra/MapExtras.h>
#include "termutil.h"
void tolower(std::string &str)
{
@ -389,6 +390,7 @@ public:
int main(int argc, char *argv[])
{
bool temporary_terminal = TemporaryTerminal();
uint32_t x_max = 0, y_max = 0, z_max = 0;
int32_t x = 0, y = 0, z = 0;
DFHack::ContextManager manager("Memory.xml");
@ -397,9 +399,8 @@ int main(int argc, char *argv[])
if (!context->Attach())
{
std::cerr << "Unable to attach to DF!" << std::endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
std::cin.ignore();
#endif
return 1;
}
@ -513,9 +514,8 @@ int main(int argc, char *argv[])
{
std::cerr << "Cannot get map info!" << std::endl;
context->Detach();
#ifndef LINUX_BUILD
if(temporary_terminal)
std::cin.ignore();
#endif
return 1;
}
maps->getSize(x_max, y_max, z_max);
@ -587,10 +587,11 @@ int main(int argc, char *argv[])
}
context->Detach();
#ifndef LINUX_BUILD
if(temporary_terminal)
{
std::cout << "Press any key to finish.";
std::cin.ignore();
#endif
}
std::cout << std::endl;
return 0;
}

@ -12,9 +12,11 @@ using namespace std;
#include <dfhack/extra/MapExtras.h>
using namespace MapExtras;
using namespace DFHack;
#include "termutil.h"
int main (int argc, char* argv[])
{
bool temporary_terminal = TemporaryTerminal();
ContextManager DFMgr("Memory.xml");
Context * DF;
try
@ -25,9 +27,8 @@ int main (int argc, char* argv[])
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -40,9 +41,8 @@ int main (int argc, char* argv[])
{
cerr << "Can't init map. Make sure you have a map loaded in DF." << endl;
DF->Detach();
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -55,9 +55,8 @@ int main (int argc, char* argv[])
if(cx == -30000)
{
cerr << "Cursor is not active. Point the cursor at some empty space you want to be unhidden." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
DFCoord xy ((uint32_t)cx,(uint32_t)cy,cz);
@ -66,9 +65,8 @@ int main (int argc, char* argv[])
if(isWallTerrain(tt))
{
cerr << "Point the cursor at some empty space you want to be unhidden." << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
// hide all tiles, flush cache
@ -194,10 +192,11 @@ int main (int argc, char* argv[])
MCache->WriteAll();
delete MCache;
DF->Detach();
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}

@ -8,8 +8,10 @@
using namespace std;
#include <DFHack.h>
#include "termutil.h"
int main (void)
{
bool temporary_terminal = TemporaryTerminal();
string blah;
DFHack::ContextManager DFMgr("Memory.xml");
DFHack::Context *DF;
@ -21,9 +23,8 @@ int main (void)
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}

@ -10,10 +10,12 @@ using namespace std;
#include <DFHack.h>
#include <dfhack/extra/MapExtras.h>
#include "termutil.h"
using namespace MapExtras;
int main (int argc, char* argv[])
{
bool temporary_terminal = TemporaryTerminal();
// Command line options
bool updown = false;
if(argc > 1 && strcmp(argv[1],"-x") == 0)
@ -29,9 +31,8 @@ int main (int argc, char* argv[])
catch (exception& e)
{
cerr << e.what() << endl;
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -44,9 +45,8 @@ int main (int argc, char* argv[])
{
cerr << "Can't init map. Make sure you have a map loaded in DF." << endl;
DF->Detach();
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
@ -69,9 +69,8 @@ int main (int argc, char* argv[])
{
cerr << "I won't dig the borders. That would be cheating!" << endl;
DF->Detach();
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
MapCache * MCache = new MapCache(Maps);
@ -85,9 +84,8 @@ int main (int argc, char* argv[])
cerr << "This tile is non-vein. Bye :)" << endl;
delete MCache;
DF->Detach();
#ifndef LINUX_BUILD
if(temporary_terminal)
cin.ignore();
#endif
return 1;
}
printf("%d/%d/%d tiletype: %d, veinmat: %d, designation: 0x%x ... DIGGING!\n", cx,cy,cz, tt, veinmat, des.whole);
@ -200,10 +198,11 @@ int main (int argc, char* argv[])
MCache->WriteAll();
delete MCache;
DF->Detach();
#ifndef LINUX_BUILD
if(temporary_terminal)
{
cout << "Done. Press any key to continue" << endl;
cin.ignore();
#endif
}
return 0;
}