Cleaned up use of the DEBUG define:

- renamed the DEBUG define for debugging specific code. In the top of
  the relevant files there is an commented out define to activate
  debugging for that file.
- removed entire DEBUG sections where it is no longer relevant
- compile with DEBUG defined when building a debugging binary
Code that produces general warnings is kept in DEBUG blocks.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1376 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2004-06-10 04:49:02 +00:00
parent 918fead64a
commit 87edd5faa0
21 changed files with 99 additions and 162 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.4:
- Cleaned up use of the DEBUG define, SvdB
- Talking Pet .txt file corrected to match the .ogg files,
and talkpet.ts corrections, from Nic
- Abstracted window-drawing code from confirm.c -Michael
+1 -1
View File
@@ -68,7 +68,7 @@ uqm_prepare_config()
CHOICE_debug_OPTION_debug_TITLE="Debugging information"
CHOICE_debug_OPTION_debug_ACTION='debug_action'
debug_action() {
CFLAGS="$CFLAGS -g -O0 -W -Wall"
CFLAGS="$CFLAGS -g -O0 -W -Wall -DDEBUG"
LDFLAGS="$LDFLAGS -O0"
DEBUG=1
}
+1 -1
View File
@@ -66,7 +66,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "." /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "_DEBUG" /D "DEBUG_TRACK_SEM" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "HAVE_OPENAL" /D "HAVE_ZIP" /FR /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "." /I ".." /I "..\sc2code" /I "..\sc2code\libs" /I "..\sc2code\ships" /D "DEBUG" /D "_DEBUG" /D "DEBUG_TRACK_SEM" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D _VW=320 /D _VH=240 /D "HAVE_OPENGL" /D "GFXMODULE_SDL" /D "HAVE_OPENAL" /D "HAVE_ZIP" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
+2 -2
View File
@@ -126,9 +126,9 @@ prepareSaveDir (void) {
// Create the path upto the save dir, if not already existing.
if (mkdirhier (buf) == -1)
exit (EXIT_FAILURE);
//#ifdef DEBUG
#ifdef DEBUG
fprintf(stderr, "Saved games are kept in %s.\n", buf);
//#endif
#endif
saveDir = uio_openDirRelative (configDir, "save", 0);
if (saveDir == NULL) {
+7 -7
View File
@@ -18,7 +18,7 @@
#include "starcon.h"
/* #define DEBUG */
//#define DEBUG_COLLIDE
void
collide (ELEMENTPTR ElementPtr0, ELEMENTPTR ElementPtr1)
@@ -55,13 +55,13 @@ collide (ELEMENTPTR ElementPtr0, ELEMENTPTR ElementPtr1)
ImpactAngle1 = TravelAngle1 + HALF_CIRCLE;
}
#ifdef DEBUG
#ifdef DEBUG_COLLIDE
fprintf (stderr, "Centers: <%d, %d> <%d, %d>\n",
ElementPtr0->next.location.x, ElementPtr0->next.location.y,
ElementPtr1->next.location.x, ElementPtr1->next.location.y);
fprintf (stderr, "RelTravelAngle : %d, ImpactAngles <%d, %d>\n",
RelTravelAngle, ImpactAngle0, ImpactAngle1);
#endif /* DEBUG */
#endif /* DEBUG_COLLIDE */
if (ElementPtr0->next.location.x == ElementPtr0->current.location.x
&& ElementPtr0->next.location.y == ElementPtr0->current.location.y
@@ -77,10 +77,10 @@ collide (ELEMENTPTR ElementPtr0, ELEMENTPTR ElementPtr1)
}
ElementPtr0->state_flags |= (DEFY_PHYSICS | COLLISION);
ElementPtr1->state_flags |= (DEFY_PHYSICS | COLLISION);
#ifdef DEBUG
#ifdef DEBUG_COLLIDE
fprintf (stderr, "No movement before collision -- <(%d, %d) = %d, (%d, %d) = %d>\n",
dx0, dy0, ImpactAngle0 - OCTANT, dx1, dy1, ImpactAngle1 - OCTANT);
#endif /* DEBUG */
#endif /* DEBUG_COLLIDE */
}
{
@@ -164,12 +164,12 @@ collide (ELEMENTPTR ElementPtr0, ELEMENTPTR ElementPtr1)
SINE (ImpactAngle1,
WORLD_TO_VELOCITY (SCALED_ONE) - 1));
}
#ifdef DEBUG
#ifdef DEBUG_COLLIDE
GetCurrentVelocityComponents (&ElementPtr0->velocity, &dx0, &dy0);
GetCurrentVelocityComponents (&ElementPtr1->velocity, &dx1, &dy1);
fprintf (stderr, "After: <%d, %d> <%d, %d>\n\n",
dx0, dy0, dx1, dy1);
#endif /* DEBUG */
#endif /* DEBUG_COLLIDE */
}
}
-1
View File
@@ -44,7 +44,6 @@ void Slider (void);
#define SLIDER_Y 107
#define SLIDER_HEIGHT 15
// #define DEBUG
LOCDATA CommData;
int cur_comm;
+2 -55
View File
@@ -236,90 +236,37 @@ construct_response (UNICODE *buf, int R /* promoted from RESPONSE_REF */, ...)
UNICODE *name;
va_list vlist;
// fprintf(stderr, "DEBUG: We've entered into construct_response!\n");
va_start (vlist, R);
// fprintf(stderr, "DEBUG: R = %d\n", R);
do
{
COUNT len;
STRING S;
// fprintf(stderr, "DEBUG: len = %d\n",len);
S = SetAbsStringTableIndex (CommData.ConversationPhrases, R - 1);
// fprintf(stderr, "DEBUG: Returned from call to SetAbsStringTableIndex\n");
// fprintf(stderr, "DEBUG: GetStringAddress(S) = %s\n",(UNICODE *)GetStringAddress(S));
// fprintf(stderr, "DEBUG: buf = '%s' (%d) \n", buf, *buf);
// fprintf(stderr, "DEBUG: strlen(buf) = %d\n", strlen(buf));
wstrcpy (buf, (UNICODE *)GetStringAddress (S));
// fprintf(stderr, "DEBUG: buf = '%s' (%d) \n", buf, *buf);
// fprintf(stderr, "DEBUG: strlen(buf) = %d\n", strlen(buf));
len = wstrlen (buf);
// fprintf(stderr, "DEBUG: len = %d\n",len);
buf += len;
// fprintf(stderr, "DEBUG: buf = '%s' (%d) \n", buf, *buf);
// fprintf(stderr, "DEBUG: strlen(buf) = %d\n", strlen(buf));
name = va_arg (vlist, UNICODE *);
// fprintf(stderr, "DEBUG: returned from va_arg call\n");
// fprintf(stderr, "DEBUG: name = %s\n",name);
if (name)
{
/*
fprintf(stderr, "DEBUG: ------------------------------------\n");
fprintf(stderr, "DEBUG: We are in the special va_args loop!\n");
fprintf(stderr, "DEBUG: Current critical variables read:\n");
fprintf(stderr, "DEBUG: ------------------------------------\n");
fprintf(stderr, "DEBUG: name = %s\n", name);
fprintf(stderr, "DEBUG: buf = '%s' (%d)\n", buf, *buf);
fprintf(stderr, "DEBUG: len = %d\n", len);
fprintf(stderr, "DEBUG: strlen(name) = %d\n", strlen(name));
fprintf(stderr, "DEBUG: strlen(buf) = %d\n", strlen(buf));
fprintf(stderr, "DEBUG: ---- continuing ----\n");
*/
len = wstrlen (name);
// fprintf(stderr, "DEBUG: len = %d\n", len);
wstrncpy (buf, name, len);
// fprintf(stderr, "DEBUG: buf = '%s' (%d)\n", buf, *buf);
// fprintf(stderr, "DEBUG: strlen(buf) = %d\n", strlen(buf));
buf += len;
// fprintf(stderr, "DEBUG: buf = '%s' (%d)\n", buf, *buf);
// fprintf(stderr, "DEBUG: Calling va_arg\n");
/*
The old code follows.. I've broken this all down while troubleshooting.
if ((R = va_arg (vlist, RESPONSE_REF)) == (RESPONSE_REF)-1)
name = 0;
*/
R = va_arg(vlist, int);
// fprintf(stderr, "DEBUG: Return from call to va_arg\n");
// fprintf(stderr, "DEBUG: R = %d\n", R);
if (R == ((RESPONSE_REF)-1)) name = 0;
// fprintf(stderr, "DEBUG: name = %s\n", name);
if (R == ((RESPONSE_REF) -1))
name = 0;
}
} while (name);
va_end (vlist);
+2 -15
View File
@@ -18,6 +18,8 @@
#include "starcon.h"
//#define DEBUG_CYBORG
COUNT
PlotIntercept (ELEMENTPTR ElementPtr0, ELEMENTPTR ElementPtr1, COUNT
max_turns, COUNT margin_of_error)
@@ -279,19 +281,11 @@ PlotIntercept (ELEMENTPTR ElementPtr0, ELEMENTPTR ElementPtr1, COUNT
STARSHIPPTR CyborgDescPtr;
#ifdef DEBUG
static COUNT turn_counter[NUM_PLAYERS];
#endif /* DEBUG */
static void
InitCyborg (STARSHIPPTR StarShipPtr)
{
COUNT Index, Divisor;
#ifdef DEBUG
//turn_counter[which_ship] = 0;
#endif /* DEBUG */
Index = StarShipPtr->RaceDescPtr->characteristics.max_thrust
* StarShipPtr->RaceDescPtr->characteristics.thrust_increment;
if ((Divisor = StarShipPtr->RaceDescPtr->characteristics.turn_wait
@@ -311,9 +305,6 @@ InitCyborg (STARSHIPPTR StarShipPtr)
}
#endif /* PRINT_MI */
StarShipPtr->RaceDescPtr->cyborg_control.ManeuverabilityIndex = Index;
#ifdef DEBUG
//turn_counter[which_ship] = 0;
#endif /* DEBUG */
}
static void
@@ -1021,10 +1012,6 @@ tactical_intelligence (void)
STARSHIPPTR StarShipPtr, EnemyStarShipPtr;
RACE_DESCPTR RDPtr, EnemyRDPtr;
#ifdef DEBUG
++turn_counter[cur_player];
#endif /* DEBUG */
StarShipPtr = CyborgDescPtr;
RDPtr = StarShipPtr->RaceDescPtr;
+10 -8
View File
@@ -18,6 +18,8 @@
#include "starcon.h"
//#define DEBUG_GRAVITY
BOOLEAN
CalculateGravity (PELEMENT ElementPtr)
{
@@ -56,27 +58,27 @@ CalculateGravity (PELEMENT ElementPtr)
dy = ElementPtr->next.location.y
- TestElementPtr->next.location.y;
}
#if 0 //def DEBUG
#ifdef DEBUG_GRAVITY
if (TestElementPtr->state_flags & PLAYER_SHIP)
{
fprintf (stderr, "CalculateGravity:\n");
fprintf (stderr, "\tdx = %d, dy = %d\n", dx, dy);
}
#endif /* DEBUG */
#endif /* DEBUG_GRAVITY */
dx = WRAP_DELTA_X (dx);
dy = WRAP_DELTA_Y (dy);
#if 0 //def DEBUG
#ifdef DEBUG_GRAVITY
if (TestElementPtr->state_flags & PLAYER_SHIP)
fprintf (stderr, "\twrap_dx = %d, wrap_dy = %d\n", dx, dy);
#endif /* DEBUG */
#endif /* DEBUG_GRAVITY */
abs_dx = dx >= 0 ? dx : -dx;
abs_dy = dy >= 0 ? dy : -dy;
abs_dx = WORLD_TO_DISPLAY (abs_dx);
abs_dy = WORLD_TO_DISPLAY (abs_dy);
#if 0 //def DEBUG
#ifdef DEBUG_GRAVITY
if (TestElementPtr->state_flags & PLAYER_SHIP)
fprintf (stderr, "\tdisplay_dx = %d, display_dy = %d\n", abs_dx, abs_dy);
#endif /* DEBUG */
#endif /* DEBUG_GRAVITY */
if (abs_dx <= GRAVITY_THRESHOLD
&& abs_dy <= GRAVITY_THRESHOLD)
{
@@ -104,10 +106,10 @@ CalculateGravity (PELEMENT ElementPtr)
fprintf (stderr, "magnitude = %u ", magnitude);
#endif /* NEVER */
#if 0 //def DEBUG
#ifdef DEBUG_GRAVITY
if (TestElementPtr->state_flags & PLAYER_SHIP)
fprintf (stderr, "dist_squared = %lu\n", dist_squared);
#endif /* DEBUG */
#endif /* DEBUG_GRAVITY */
if (TestHasGravity)
{
retval = TRUE;
+21 -21
View File
@@ -22,7 +22,7 @@
#endif
#include "file.h"
//#define DEBUG
//#define DEBUG_GROUPS
typedef struct
{
@@ -290,10 +290,10 @@ FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID
}
SeekResFile (fp, offset, SEEK_SET);
WriteResFile (pGH, sizeof (*pGH), 1, fp);
#ifdef DEBUG
#ifdef DEBUG_GROUPS
fprintf (stderr, "1)FlushGroupInfo(%lu): WG = %u(%lu), NG = %u, SI = %u\n",
offset, which_group, pGH->GroupOffset[which_group], pGH->NumGroups, pGH->star_index);
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
NumShips = (BYTE)CountLinks (&GLOBAL (npc_built_ship_q));
@@ -322,7 +322,7 @@ FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID
RaceType = GET_RACE_ID (FragPtr);
WriteResFile ((PBYTE)&RaceType, sizeof (RaceType), 1, fp);
#ifdef DEBUG
#ifdef DEBUG_GROUPS
if (which_group == 0)
fprintf (stderr, "F) type %u, loc %u<%d, %d>, task 0x%02x:%u\n",
RaceType,
@@ -331,7 +331,7 @@ FlushGroupInfo (GROUP_HEADER *pGH, DWORD offset, BYTE which_group, PVOID
FragPtr->ShipInfo.loc.y,
GET_GROUP_MISSION (FragPtr),
GET_GROUP_DEST (FragPtr));
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
Ptr = (PBYTE)&FragPtr->RaceDescPtr;
WriteResFile ((PBYTE)Ptr,
((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr,
@@ -360,17 +360,17 @@ GetGroupInfo (DWORD offset, BYTE which_group)
SeekResFile (fp, offset, SEEK_SET);
ReadResFile (&GH, sizeof (GH), 1, fp);
#ifdef DEBUG
#ifdef DEBUG_GROUPS
fprintf (stderr, "GetGroupInfo(%lu): %u(%lu) out of %u\n", offset, which_group, GH.GroupOffset[which_group], GH.NumGroups);
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
if (which_group == (BYTE)~0)
{
COUNT month_index, day_index, year_index;
ReinitQueue (&GLOBAL (npc_built_ship_q));
#ifdef DEBUG
#ifdef DEBUG_GROUPS
fprintf (stderr, "%u == %u\n", GH.star_index, (COUNT)(CurStarDescPtr - star_array));
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
day_index = GH.day_index;
month_index = GH.month_index;
year_index = GH.year_index;
@@ -381,11 +381,11 @@ GetGroupInfo (DWORD offset, BYTE which_group)
{
res_CloseResFile (fp);
#ifdef DEBUG
#ifdef DEBUG_GROUPS
if (GH.star_index == (COUNT)(CurStarDescPtr - star_array))
fprintf (stderr, "GetGroupInfo: battle groups out of date %u/%u/%u!\n",
month_index, day_index, year_index);
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
fp = res_OpenResFile (tempDir, RANDGRPINFO_FILE, "wb");
GH.NumGroups = 0;
GH.star_index = (COUNT)~0;
@@ -470,7 +470,7 @@ GetGroupInfo (DWORD offset, BYTE which_group)
SET_GROUP_MISSION (FragPtr, task);
SET_GROUP_LOC (FragPtr, group_loc);
#ifdef DEBUG
#ifdef DEBUG_GROUPS
fprintf (stderr, "battle group %u(0x%04x) strength %u, "
"type %u, loc %u<%d, %d>, task %u\n",
which_group,
@@ -481,7 +481,7 @@ GetGroupInfo (DWORD offset, BYTE which_group)
FragPtr->ShipInfo.loc.x,
FragPtr->ShipInfo.loc.y,
task);
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
UnlockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip
);
@@ -551,7 +551,7 @@ GetGroupInfo (DWORD offset, BYTE which_group)
((PBYTE)&FragPtr->ShipInfo.race_strings) - Ptr,
1, fp);
#ifdef DEBUG
#ifdef DEBUG_GROUPS
if (which_group == 0)
fprintf (stderr, "G) type %u, loc %u<%d, %d>, task 0x%02x:%u\n",
RaceType,
@@ -560,14 +560,14 @@ GetGroupInfo (DWORD offset, BYTE which_group)
FragPtr->ShipInfo.loc.y,
GET_GROUP_MISSION (FragPtr),
GET_GROUP_DEST (FragPtr));
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
if (GET_GROUP_ID (FragPtr) != BaseGroup
|| which_group
|| ShipsLeft)
{
#ifdef DEBUG
#ifdef DEBUG_GROUPS
fprintf (stderr, "\n");
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
if (RaceType == SHOFIXTI_SHIP
&& which_group
&& !GET_GAME_STATE (SHOFIXTI_RECRUITED))
@@ -588,9 +588,9 @@ GetGroupInfo (DWORD offset, BYTE which_group)
}
else
{
#ifdef DEBUG
#ifdef DEBUG_GROUPS
fprintf (stderr, " -- REMOVING\n");
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
UnlockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip
);
@@ -658,11 +658,11 @@ PutGroupInfo (DWORD offset, BYTE which_group)
GH.year_index = year_index;
}
GH.star_index = CurStarDescPtr - star_array;
#ifdef DEBUG
#ifdef DEBUG_GROUPS
fprintf (stderr, "PutGroupInfo(%lu): %u out of %u -- %u/%u/%u\n",
offset, which_group, GH.NumGroups,
GH.month_index, GH.day_index, GH.year_index);
#endif /* DEBUG */
#endif /* DEBUG_GROUPS */
FlushGroupInfo (&GH, offset, which_group, fp);
+1 -12
View File
@@ -180,11 +180,7 @@ check_hyperspace_encounter (void)
if (!GET_GAME_STATE (STARBASE_AVAILABLE))
percent = 100;
else
#ifdef TESTING
percent = 0;
#else /* TESTING */
percent *= GET_GAME_STATE (SLYLANDRO_MULTIPLIER);
#endif /* TESTING */
}
else if (Type == MELNORME_SHIP
&& (GLOBAL_SIS (FuelOnBoard) == 0
@@ -229,14 +225,7 @@ percent = 0;
(DWORD)encounter_radius * encounter_radius
&& ((COUNT)TFB_Random () % 100) < percent)
{
#ifndef DEBUG
char buf[20];
GetStringContents (SetAbsStringTableIndex (
TemplatePtr->ShipInfo.race_strings, 1
), (STRINGPTR)buf, FALSE);
// fprintf (stderr, "%s encounter\n", buf);
#endif /* DEBUG */
// Ship spawned for encounter.
hEncounter = AllocEncounter ();
if (hEncounter)
{
-2
View File
@@ -25,8 +25,6 @@
#include "libs/misc.h"
#include "libs/threadlib.h"
#define DEBUG
static uint32 mixer_initialized = 0;
static uint32 mixer_format;
static uint32 mixer_chansize;
+4 -4
View File
@@ -23,7 +23,7 @@
#define THREADLIB SDL
#define NAMED_SYNCHRO /* Should synchronizable objects have names? */
// #define TRACK_CONTENTION /* Should we report when a thread sleeps on synchronize? */
#define TRACK_CONTENTION /* Should we report when a thread sleeps on synchronize? */
/* TRACK_CONTENTION implies NAMED_SYNCHRO. */
#ifdef TRACK_CONTENTION
@@ -39,9 +39,9 @@
#endif /* DEBUG */
#ifdef DEBUG_THREADS
# ifndef PROFILE_THREADS
# define PROFILE_THREADS
# endif
//# ifndef PROFILE_THREADS
//# define PROFILE_THREADS
//# endif
#endif /* DEBUG_THREADS */
#include <sys/types.h>
@@ -271,8 +271,8 @@ CreateThread_SDL (ThreadFunction func, void *data, SDWORD stackSize
QueueThread (thread);
#ifdef DEBUG_THREADS
fprintf (stderr, "Thread '%s' created.\n", ThreadName (thread));
fflush (stderr);
// fprintf (stderr, "Thread '%s' created.\n", ThreadName (thread));
// fflush (stderr);
#endif
// Signal to the new thread that the thread structure is ready
+6 -4
View File
@@ -22,6 +22,8 @@
#include "options.h"
#include "file.h"
//#define DEBUG_LOAD
ACTIVITY NextActivity;
static void
@@ -162,9 +164,9 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
cread ((PBYTE)&num_links, sizeof (num_links), 1, fh);
{
#ifdef DEBUG
#ifdef DEBUG_LOAD
fprintf (stderr, "EVENTS:\n");
#endif /* DEBUG */
#endif /* DEBUG_LOAD */
while (num_links--)
{
HEVENT hEvent;
@@ -175,13 +177,13 @@ LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc)
cread ((PBYTE)EventPtr, sizeof (*EventPtr), 1, fh);
#ifdef DEBUG
#ifdef DEBUG_LOAD
fprintf (stderr, "\t%u/%u/%u -- %u\n",
EventPtr->month_index,
EventPtr->day_index,
EventPtr->year_index,
EventPtr->func_index);
#endif /* DEBUG */
#endif /* DEBUG_LOAD */
UnlockEvent (hEvent);
PutEvent (hEvent);
}
+6 -4
View File
@@ -22,6 +22,8 @@
/* -------------------------------- CODE -------------------------------- */
//#define DEBUG_PLANET_CALC
#define CalcMass(b) CalcFromBase (b, b)
#define CalcRadius(b) CalcFromBase (b, ((b) >> 1) + 1)
@@ -231,7 +233,7 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC
CalcSysInfo (SysInfoPtr);
#ifdef DEBUG
#ifdef DEBUG_PLANET_CALC
{
BYTE ColorClass[6][8] = {
"Red",
@@ -253,7 +255,7 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC
fprintf (stderr, "Stellar Energy: %d (sol = 3)\n",
SysInfoPtr->StarEnergy);
}
#endif /* DEBUG */
#endif /* DEBUG_PLANET_CALC */
{
SIZE radius;
@@ -330,7 +332,7 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC
SysInfoPtr->PlanetInfo.Tectonics >>= 5;
SysInfoPtr->PlanetInfo.Weather >>= 5;
#ifdef DEBUG
#ifdef DEBUG_PLANET_CALC
radius = (SIZE)((DWORD)UNSCALE_RADIUS (radius) * 100 / UNSCALE_RADIUS (EARTH_RADIUS));
fprintf (stderr, "\tOrbital Distance : %d.%02d AU\n", radius / 100, radius % 100);
//fprintf (stderr, "\tPlanetary Mass : %d.%02d Earth masses\n",
@@ -391,7 +393,7 @@ DoPlanetaryAnalysis (SYSTEM_INFOPTR SysInfoPtr, PPLANET_DESC
SysInfoPtr->PlanetInfo.RotationPeriod / 10,
SysInfoPtr->PlanetInfo.RotationPeriod % 10);
}
#endif /* DEBUG */
#endif /* DEBUG_PLANET_CALC */
}
return (TFB_SeedRandom (old_seed));
+4 -2
View File
@@ -19,6 +19,8 @@
#include "starcon.h"
#include "controls.h"
//#define DEBUG_DEVICES
static COUNT
lpstrchr (UNICODE *pStr, UNICODE ch)
{
@@ -597,9 +599,9 @@ InventoryDevices (BYTE *pDeviceMap)
break;
}
#ifndef DEBUG
#ifndef DEBUG_DEVICES
if (DeviceState)
#endif /* DEBUG */
#endif /* DEBUG_DEVICES */
{
*pDeviceMap++ = i;
++DevicesOnBoard;
+6 -4
View File
@@ -18,6 +18,8 @@
#include "starcon.h"
//#define DEBUG_ORBITS
enum
{
PLANET_NEVER = 0,
@@ -479,11 +481,11 @@ FillOrbits (BYTE NumPlanets, PPLANET_DESC pBaseDesc, BOOLEAN
{GIANT_ROCK_DIST, GIANT_GASG_DIST},
{SUPERGIANT_ROCK_DIST, SUPERGIANT_GASG_DIST},
};
#ifdef DEBUG
#ifdef DEBUG_ORBITS
UNICODE buf[40];
char stype[] = {'D', 'G', 'S'};
char scolor[] = {'B', 'G', 'O', 'R', 'W', 'Y'};
#endif /* DEBUG */
#endif /* DEBUG_ORBITS */
pPD = pBaseDesc;
StarSize = pSolarSysState->SunDesc[0].data_index;
@@ -498,12 +500,12 @@ char scolor[] = {'B', 'G', 'O', 'R', 'W', 'Y'};
pSolarSysState->SunDesc[0].NumPlanets = NumPlanets;
}
#ifdef DEBUG
#ifdef DEBUG_ORBITS
GetClusterName (CurStarDescPtr, buf);
fprintf (stderr, "cluster name = %s color = %c type = %c\n", buf,
scolor[STAR_COLOR (CurStarDescPtr->Type)],
stype[STAR_TYPE (CurStarDescPtr->Type)]);
#endif /* DEBUG */
#endif /* DEBUG_ORBITS */
GeneratingMoons = (BOOLEAN) (pBaseDesc == pSolarSysState->MoonDesc);
if (GeneratingMoons)
MaxPlanet = FIRST_LARGE_ROCKY_WORLD;
+6 -4
View File
@@ -20,6 +20,8 @@
#include "libs/graphics/gfx_common.h"
#include "controls.h"
//#define DEBUG_SOLARSYS
//Added by Chris
void LoadLanderData (void);
@@ -414,13 +416,13 @@ ShowPlanet:
pSolarSysState->pOrbitalDesc = pCurDesc;
}
#ifdef DEBUG
#ifdef DEBUG_SOLARSYS
fprintf (stderr, "Star index = %d, Planet index = %d, <%d, %d>\n",
CurStarDescPtr - star_array,
pCurDesc - pSolarSysState->PlanetDesc,
pSolarSysState->SunDesc[0].location.x,
pSolarSysState->SunDesc[0].location.y);
#endif /* DEBUG */
#endif /* DEBUG_SOLARSYS */
return;
}
}
@@ -1554,7 +1556,7 @@ GenerateRandomIP (BYTE control)
break;
case GENERATE_ORBITAL:
{
#ifdef DEBUG
#ifdef DEBUG_SOLARSYS
if (pSolarSysState->pOrbitalDesc->pPrevDesc ==
pSolarSysState->SunDesc)
fprintf (stderr, "Planet index = %d\n", pSolarSysState->pOrbitalDesc - pSolarSysState->PlanetDesc);
@@ -1562,7 +1564,7 @@ GenerateRandomIP (BYTE control)
fprintf (stderr, "Planet index = %d, Moon index = %d\n",
pSolarSysState->pOrbitalDesc->pPrevDesc - pSolarSysState->PlanetDesc,
pSolarSysState->pOrbitalDesc - pSolarSysState->MoonDesc);
#endif /* DEBUG */
#endif /* DEBUG_SOLARSYS */
rand_val = DoPlanetaryAnalysis (
&pSolarSysState->SysInfo, pSolarSysState->pOrbitalDesc
);
+9 -7
View File
@@ -19,6 +19,8 @@
#include "starcon.h"
#include "lifeform.h"
//#define DEBUG_SURFACE
const BYTE *Elements;
const PlanetFrame *PlanData;
@@ -72,11 +74,11 @@ CalcMineralDeposits (SYSTEM_INFOPTR SysInfoPtr, COUNT which_deposit)
deposit_quality_gross, deposit_quality_fine / 10 + 1
);
SysInfoPtr->PlanetInfo.CurType = eptr->ElementType;
#ifdef DEBUG
//fprintf (stderr, "\t\t%d units of %Fs\n",
// SysInfoPtr->PlanetInfo.CurDensity,
// Elements[eptr->ElementType].name);
#endif /* DEBUG */
#ifdef DEBUG_SURFACE
fprintf (stderr, "\t\t%d units of %Fs\n",
SysInfoPtr->PlanetInfo.CurDensity,
Elements[eptr->ElementType].name);
#endif /* DEBUG_SURFACE */
if ((num_deposits >= which_deposit
&& !(SysInfoPtr->PlanetInfo.ScanRetrieveMask[MINERAL_SCAN]
& (1L << num_deposits)))
@@ -235,11 +237,11 @@ CalcLifeForms (SYSTEM_INFOPTR SysInfoPtr, COUNT which_life)
} while (--num_creatures);
} while (--num_types);
}
#ifdef DEBUG
#ifdef DEBUG_SURFACE
else
fprintf (stderr, "It's dead, Jim! (%d >= %d)\n", life_var,
SysInfoPtr->PlanetInfo.LifeChance);
#endif /* DEBUG */
#endif /* DEBUG_SURFACE */
}
return (num_life_forms);
+8 -6
View File
@@ -22,6 +22,8 @@
#include "libs/graphics/drawcmd.h"
#include "options.h"
//#define DEBUG_PROCESS
COUNT DisplayFreeList;
PRIMITIVE DisplayArray[MAX_DISPLAY_PRIMS];
extern POINT SpaceOrg;
@@ -389,10 +391,10 @@ ProcessCollisions (HELEMENT hSuccElement, ELEMENTPTR ElementPtr,
&TestElementPtr->IntersectControl, min_time)) == 1
&& !((state_flags | test_state_flags) & FINITE_LIFE))
{
#ifdef DEBUG
#ifdef DEBUG_PROCESS
fprintf (stderr, "BAD NEWS 0x%x <--> 0x%x\n", ElementPtr,
TestElementPtr);
#endif /* DEBUG */
#endif /* DEBUG_PROCESS */
if (state_flags & COLLISION)
{
InitIntersectEndPoint (TestElementPtr);
@@ -511,10 +513,10 @@ ProcessCollisions (HELEMENT hSuccElement, ELEMENTPTR ElementPtr,
{
POINT SavePt, TestSavePt;
#ifdef DEBUG
#ifdef DEBUG_PROCESS
fprintf (stderr, "0x%x <--> 0x%x at %u\n", ElementPtr,
TestElementPtr, time_val);
#endif /* DEBUG */
#endif /* DEBUG_PROCESS */
SavePt = ElementPtr->IntersectControl.EndPoint;
TestSavePt = TestElementPtr->IntersectControl.EndPoint;
InitIntersectEndPoint (ElementPtr);
@@ -533,10 +535,10 @@ ProcessCollisions (HELEMENT hSuccElement, ELEMENTPTR ElementPtr,
state_flags = ElementPtr->state_flags;
test_state_flags = TestElementPtr->state_flags;
#ifdef DEBUG
#ifdef DEBUG_PROCESS
fprintf (stderr, "PROCESSING 0x%x <--> 0x%x at %u\n",
ElementPtr, TestElementPtr, time_val);
#endif /* DEBUG */
#endif /* DEBUG_PROCESS */
if (test_state_flags & PLAYER_SHIP)
{
(*TestElementPtr->collision_func) (