diff --git a/sc2/doc/devel/debug b/sc2/doc/devel/debug index 21dcb3c74..a100a33cc 100644 --- a/sc2/doc/devel/debug +++ b/sc2/doc/devel/debug @@ -40,7 +40,8 @@ listed below: Outputs information on all stars to a FILE. With the 'flags' variable, the amount of detail can be specified. At this time this function will only work when called from the top of - ExploreSolarSys(). + ExploreSolarSys(). Defining DUMP_STARS in sc2code/uqmdebug.h + will make this happen. - the function uio_debugInteractive() This function is not defined in sc2code/uqmdebug.h, but in libs/uio.h. This function can interactively (tty-based) display information on diff --git a/sc2/src/sc2code/comm.c b/sc2/src/sc2code/comm.c index 7187ee963..d78126481 100644 --- a/sc2/src/sc2code/comm.c +++ b/sc2/src/sc2code/comm.c @@ -30,6 +30,7 @@ #include "settings.h" #include "setup.h" #include "sounds.h" +#include "uqmdebug.h" #include "libs/graphics/drawable.h" #include "libs/graphics/gfx_common.h" #include "libs/mathlib.h" @@ -2085,6 +2086,10 @@ InitCommunication (RESOURCE which_comm) MEM_HANDLE hOldIndex, hIndex; LOCDATAPTR LocDataPtr; +#ifdef DUMP_STARS + return 0; +#endif + last_subtitle = NULL; LockMutex (GraphicsLock); diff --git a/sc2/src/sc2code/planets/solarsys.c b/sc2/src/sc2code/planets/solarsys.c index f17b707a5..79e707729 100644 --- a/sc2/src/sc2code/planets/solarsys.c +++ b/sc2/src/sc2code/planets/solarsys.c @@ -1891,15 +1891,16 @@ ExploreSolarSys (void) { SOLARSYS_STATE SolarSysState; -#if 0 +#ifdef DUMP_STARS { FILE *out; - // Write the star and planet info to a file in the current - // directory (which currently is the content/ directory). + // Write the star and planet info to a file in the current directory. out = fopen("PlanetInfo", "w"); if (out == NULL) exit(1); + TFB_DEBUG_HALT = 1; + // Disable drawing. dumpStars(out, DUMP_PLANETS); fclose(out); fprintf(stdout, "*** Star dump complete. You can terminate the " diff --git a/sc2/src/sc2code/uqmdebug.c b/sc2/src/sc2code/uqmdebug.c index c2286d2bb..e9204dba9 100644 --- a/sc2/src/sc2code/uqmdebug.c +++ b/sc2/src/sc2code/uqmdebug.c @@ -29,6 +29,8 @@ #include "globdata.h" #include "races.h" #include "setup.h" +#include "state.h" +#include "libs/misc.h" #include @@ -596,10 +598,12 @@ dumpPlanet (FILE *out, const PLANET_DESC *planet, UWORD flags) { PLANET_DESC *oldPlanetDesc; - oldPlanetDesc= pSolarSysState->pBaseDesc; + oldPlanetDesc = pSolarSysState->pBaseDesc; // For now, only the name is printed. Other data may be added later. pSolarSysState->pBaseDesc = (PLANET_DESC *) planet; + //GetPlanetInfo (); + //(*pSolarSysState->GenFunc) (GENERATE_ORBITAL); (*pSolarSysState->GenFunc) (GENERATE_NAME); fprintf (out, "- %-37s %s\n", GLOBAL_SIS (PlanetName), planetTypeString (planet->data_index)); diff --git a/sc2/src/sc2code/uqmdebug.h b/sc2/src/sc2code/uqmdebug.h index b62559383..635dd6ac3 100644 --- a/sc2/src/sc2code/uqmdebug.h +++ b/sc2/src/sc2code/uqmdebug.h @@ -24,6 +24,12 @@ #include +// Define DUMP_STARS to dump a list of stars to ./PlanetInfo. +// The list is generated when a new game is started. Normal +// gameplay is not available in this situation. +//#define DUMP_STARS + + // Called when the debug key (symbol 'Debug' in the keys.cfg) is pressed. extern void debugKeyPressed (void);