From f02f5f5e82ae94b9182c62ae211d82ec4123f074 Mon Sep 17 00:00:00 2001 From: meep-eep Date: Sun, 2 Feb 2003 05:45:31 +0000 Subject: [PATCH] Some compile-time warnings removed. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@634 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/msvc++/UrQuanMasters.dsp | 4 ++++ sc2/src/port.c | 1 + sc2/src/port.h | 2 -- sc2/src/sc2code/battle.c | 3 +-- sc2/src/sc2code/build.c | 17 +++++++++-------- sc2/src/sc2code/build.h | 2 +- sc2/src/sc2code/cleanup.c | 3 ++- sc2/src/sc2code/comm.c | 7 ++++--- sc2/src/sc2code/libs/graphics/gfx_common.h | 1 - sc2/src/sc2code/libs/graphics/tfb_draw.c | 4 ++-- sc2/src/sc2code/libs/graphics/tfb_draw.h | 2 +- sc2/src/sc2code/libs/threadlib.h | 2 +- sc2/src/sc2code/libs/threads/thrcommon.c | 2 +- sc2/src/sc2code/loadship.c | 12 +++++++++--- sc2/src/sc2code/planets/plangen.c | 10 ++++++---- sc2/src/sc2code/shipyard.c | 2 ++ sc2/src/sc2code/starcon.h | 1 - sc2/src/starcon2.c | 17 +++++++++-------- 18 files changed, 53 insertions(+), 39 deletions(-) diff --git a/sc2/src/msvc++/UrQuanMasters.dsp b/sc2/src/msvc++/UrQuanMasters.dsp index 8de67feaa..78e974369 100644 --- a/sc2/src/msvc++/UrQuanMasters.dsp +++ b/sc2/src/msvc++/UrQuanMasters.dsp @@ -2971,6 +2971,10 @@ SOURCE=..\sc2code\comm.c # End Source File # Begin Source File +SOURCE=..\sc2code\comm.h +# End Source File +# Begin Source File + SOURCE=..\sc2code\commglue.c # End Source File # Begin Source File diff --git a/sc2/src/port.c b/sc2/src/port.c index 6175b30db..10ab46546 100644 --- a/sc2/src/port.c +++ b/sc2/src/port.c @@ -22,6 +22,7 @@ #include #include +#include "port.h" #ifndef HAVE_STRUPR char * diff --git a/sc2/src/port.h b/sc2/src/port.h index 3cdf4cea7..ad6100d17 100644 --- a/sc2/src/port.h +++ b/sc2/src/port.h @@ -12,9 +12,7 @@ #define stricmp strcasecmp #endif -#ifndef HAVE_STRUPR char *strupr (char *str); -#endif #endif /* _PORT_H */ diff --git a/sc2/src/sc2code/battle.c b/sc2/src/sc2code/battle.c index 7d444880f..c0e568be4 100644 --- a/sc2/src/sc2code/battle.c +++ b/sc2/src/sc2code/battle.c @@ -100,8 +100,7 @@ if ((InputState & DEVICE_BUTTON3) && !(ElementPtr->state_flags & FINITE_LIFE) && ElementPtr->mass_points != MAX_SHIP_MASS * 10) { - extern void flee_preprocess (PELEMENT - ElementPtr); + extern void flee_preprocess (PELEMENT); battle_counter -= MAKE_WORD (1, 0); diff --git a/sc2/src/sc2code/build.c b/sc2/src/sc2code/build.c index d9e05167b..031201377 100644 --- a/sc2/src/sc2code/build.c +++ b/sc2/src/sc2code/build.c @@ -173,15 +173,15 @@ ActivateStarShip (COUNT which_ship, SIZE state) )); hStarShip; hStarShip = hNextShip) { BOOLEAN RemoveShip; - SHIP_FRAGMENTPTR StarShipPtr; + SHIP_FRAGMENTPTR StarShipPtr2; - StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip ( + StarShipPtr2 = (SHIP_FRAGMENTPTR)LockStarShip ( &GLOBAL (built_ship_q), hStarShip ); - hNextShip = _GetSuccLink (StarShipPtr); + hNextShip = _GetSuccLink (StarShipPtr2); RemoveShip = (BOOLEAN)( - GET_RACE_ID (StarShipPtr) == ORZ_SHIP + GET_RACE_ID (StarShipPtr2) == ORZ_SHIP ); UnlockStarShip ( &GLOBAL (built_ship_q), @@ -375,12 +375,13 @@ NameCaptain (PQUEUE pQueue, STARSHIPPTR StarShipPtr) } HSTARSHIP -CloneShipFragment (COUNT index, PQUEUE pDstQueue, BYTE crew_level) +CloneShipFragment (COUNT shipIndex, PQUEUE pDstQueue, BYTE crew_level) { HSTARSHIP hStarShip, hBuiltShip; SHIP_FRAGMENTPTR TemplatePtr; - if ((hStarShip = GetStarShipFromIndex (&GLOBAL (avail_race_q), index)) == 0) + if ((hStarShip = GetStarShipFromIndex (&GLOBAL (avail_race_q), + shipIndex)) == 0) return (0); TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip ( @@ -390,7 +391,7 @@ CloneShipFragment (COUNT index, PQUEUE pDstQueue, BYTE crew_level) Build (pDstQueue, TemplatePtr->RaceResIndex, TemplatePtr->ShipInfo.ship_flags & (GOOD_GUY | BAD_GUY), - (BYTE)(index == SAMATRA_SHIP ? + (BYTE)(shipIndex == SAMATRA_SHIP ? 0 : NameCaptain (pDstQueue, (STARSHIPPTR)TemplatePtr))); if (hBuiltShip) { @@ -404,7 +405,7 @@ CloneShipFragment (COUNT index, PQUEUE pDstQueue, BYTE crew_level) ShipFragPtr->ShipInfo.ship_flags = 0; ShipFragPtr->ShipInfo.var1 = ShipFragPtr->ShipInfo.var2 = 0; ShipFragPtr->ShipInfo.loc.x = ShipFragPtr->ShipInfo.loc.y = 0; - SET_RACE_ID (ShipFragPtr, (BYTE)index); + SET_RACE_ID (ShipFragPtr, (BYTE)shipIndex); UnlockStarShip (pDstQueue, hBuiltShip); } UnlockStarShip ( diff --git a/sc2/src/sc2code/build.h b/sc2/src/sc2code/build.h index cfa3c5a62..1f72a4445 100644 --- a/sc2/src/sc2code/build.h +++ b/sc2/src/sc2code/build.h @@ -41,7 +41,7 @@ extern HSTARSHIP Build (PQUEUE pQueue, DWORD RaceResIndex, COUNT which_player, BYTE captains_name_index); -extern HSTARSHIP CloneShipFragment (COUNT index, PQUEUE pDstQueue, BYTE +extern HSTARSHIP CloneShipFragment (COUNT shipIndex, PQUEUE pDstQueue, BYTE crew_level); extern HSTARSHIP GetStarShipFromIndex (PQUEUE pShipQ, COUNT Index); extern BYTE NameCaptain (PQUEUE pQueue, STARSHIPPTR StarShipPtr); diff --git a/sc2/src/sc2code/cleanup.c b/sc2/src/sc2code/cleanup.c index 7fdfd1e88..bc2323336 100644 --- a/sc2/src/sc2code/cleanup.c +++ b/sc2/src/sc2code/cleanup.c @@ -90,7 +90,8 @@ UninitKernel (BOOLEAN ships) ActivityFrame = 0; } -void UninitGameKernel () +void +UninitGameKernel (void) { if (ActivityFrame) { diff --git a/sc2/src/sc2code/comm.c b/sc2/src/sc2code/comm.c index d5c8400e8..ed4748eb0 100644 --- a/sc2/src/sc2code/comm.c +++ b/sc2/src/sc2code/comm.c @@ -23,6 +23,7 @@ #include "starcon.h" #include "commglue.h" #include "options.h" +#include "comm.h" void InitOscilloscope (int x, int y, int width, int height, FRAME_DESC *f); void SetSliderImage (void *f); @@ -439,7 +440,7 @@ static struct { } XFormControl; void -init_xform_control () +init_xform_control (void) { XFormControl.XFormCurrent = XFormControl.XFormInsertPoint = 0; XFormControl.XFormsPending = FALSE; @@ -447,13 +448,13 @@ init_xform_control () } void -uninit_xform_control () +uninit_xform_control (void) { DestroySemaphore (XFormControl.XFormSem); } void -xform_complete () +xform_complete (void) { SetSemaphore (XFormControl.XFormSem); if (XFormControl.XFormsPending) diff --git a/sc2/src/sc2code/libs/graphics/gfx_common.h b/sc2/src/sc2code/libs/graphics/gfx_common.h index 16a65c7e9..aba1202b7 100644 --- a/sc2/src/sc2code/libs/graphics/gfx_common.h +++ b/sc2/src/sc2code/libs/graphics/gfx_common.h @@ -21,7 +21,6 @@ #include #include -#include #include "starcon.h" #include "libs/gfxlib.h" diff --git a/sc2/src/sc2code/libs/graphics/tfb_draw.c b/sc2/src/sc2code/libs/graphics/tfb_draw.c index b09027d61..ca8a81c81 100644 --- a/sc2/src/sc2code/libs/graphics/tfb_draw.c +++ b/sc2/src/sc2code/libs/graphics/tfb_draw.c @@ -45,7 +45,7 @@ TFB_DrawScreen_Rect (PRECT rect, int r, int g, int b, SCREEN dest) } void -TFB_DrawScreen_SetPalette (int index, int r, int g, int b) +TFB_DrawScreen_SetPalette (int paletteIndex, int r, int g, int b) { TFB_DrawCommand DC; @@ -53,7 +53,7 @@ TFB_DrawScreen_SetPalette (int index, int r, int g, int b) DC.data.setpalette.r = r; DC.data.setpalette.g = g; DC.data.setpalette.b = b; - DC.data.setpalette.index = index; + DC.data.setpalette.index = paletteIndex; TFB_EnqueueDrawCommand (&DC); } diff --git a/sc2/src/sc2code/libs/graphics/tfb_draw.h b/sc2/src/sc2code/libs/graphics/tfb_draw.h index 708d67030..1bbfe078f 100644 --- a/sc2/src/sc2code/libs/graphics/tfb_draw.h +++ b/sc2/src/sc2code/libs/graphics/tfb_draw.h @@ -59,7 +59,7 @@ void TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, BOOLEAN scaled, i void TFB_DrawScreen_CopyToImage (TFB_Image *img, PRECT lpRect, SCREEN src); void TFB_DrawScreen_DeleteImage (TFB_Image *img); void TFB_DrawScreen_WaitForSignal (void); -void TFB_DrawScreen_SetPalette (int index, int r, int g, int b); +void TFB_DrawScreen_SetPalette (int paletteIndex, int r, int g, int b); void TFB_FlushPaletteCache (void); void TFB_DrawImage_Line (int x1, int y1, int x2, int y2, int r, int g, int b, TFB_Image *dest); diff --git a/sc2/src/sc2code/libs/threadlib.h b/sc2/src/sc2code/libs/threadlib.h index 19d665ff0..6b9d14ef8 100644 --- a/sc2/src/sc2code/libs/threadlib.h +++ b/sc2/src/sc2code/libs/threadlib.h @@ -101,7 +101,7 @@ extern void WaitThread (Thread thread, int *status); typedef void *Semaphore; #ifdef DEBUG_TRACK_SEM -extern Semaphore CreateSemaphoreAux (DWORD initial, char *sem_name); +extern Semaphore CreateSemaphoreAux (DWORD initial, const char *sem_name); # define CreateSemaphore(initial,sem_name) \ CreateSemaphoreAux ((initial), (sem_name)) extern void ResetSemaphoreOwnerAux (Semaphore sem); diff --git a/sc2/src/sc2code/libs/threads/thrcommon.c b/sc2/src/sc2code/libs/threads/thrcommon.c index 9c602e5b2..363bc6185 100644 --- a/sc2/src/sc2code/libs/threads/thrcommon.c +++ b/sc2/src/sc2code/libs/threads/thrcommon.c @@ -342,7 +342,7 @@ PrintThreadsStats (void) Semaphore CreateSemaphoreAux (DWORD initial #ifdef DEBUG_TRACK_SEM - , char *sem_name + , const char *sem_name #endif ) { diff --git a/sc2/src/sc2code/loadship.c b/sc2/src/sc2code/loadship.c index eb86f2329..9851b8514 100644 --- a/sc2/src/sc2code/loadship.c +++ b/sc2/src/sc2code/loadship.c @@ -51,19 +51,25 @@ load_ship (STARSHIPPTR StarShipPtr, BOOLEAN LoadBattleData) CaptureDrawable (LoadGraphic ( (RESOURCE)StarShipPtr->RaceDescPtr->ship_info.icons ))) == 0) - /* goto BadLoad */; + { + /* goto BadLoad */ + } if ((StarShipPtr->RaceDescPtr->ship_info.melee_icon = CaptureDrawable (LoadGraphic ( (RESOURCE)StarShipPtr->RaceDescPtr->ship_info.melee_icon ))) == 0) - /* goto BadLoad */; + { + /* goto BadLoad */ + } if ((StarShipPtr->RaceDescPtr->ship_info.race_strings = CaptureStringTable (LoadStringTable ( (RESOURCE)StarShipPtr->RaceDescPtr->ship_info.race_strings ))) == 0) - /* goto BadLoad */; + { + /* goto BadLoad */ + } if (LoadBattleData) { diff --git a/sc2/src/sc2code/planets/plangen.c b/sc2/src/sc2code/planets/plangen.c index 704f80d89..77ef98f0a 100644 --- a/sc2/src/sc2code/planets/plangen.c +++ b/sc2/src/sc2code/planets/plangen.c @@ -63,10 +63,12 @@ DWORD **getpixelarray(FRAME FramePtr,int width, int height); #define DIAMETER (TWORADIUS + 1) #define DIFFUSE_BITS 24 -//#define GET_LIGHT(val, dif, sp) \ -// ( (UBYTE)min ((sp) + \ -// ( ( ( (DWORD)(val) << DIFFUSE_BITS ) - (DWORD)(val) * (dif) ) >> DIFFUSE_BITS ) \ -// , 255) ) +#if 0 +#define GET_LIGHT(val, dif, sp) \ + ( (UBYTE)min ((sp) + \ + ( ( ( (DWORD)(val) << DIFFUSE_BITS ) - (DWORD)(val) * (dif) ) >> DIFFUSE_BITS ) \ + , 255) ) +#endif UBYTE GET_LIGHT (UBYTE val, DWORD dif, UBYTE sp) { DWORD i = (DWORD)val << DIFFUSE_BITS; diff --git a/sc2/src/sc2code/shipyard.c b/sc2/src/sc2code/shipyard.c index b9fe05467..1ad73b229 100644 --- a/sc2/src/sc2code/shipyard.c +++ b/sc2/src/sc2code/shipyard.c @@ -889,9 +889,11 @@ DoModifyShips (INPUT_STATE InputState, PMENU_STATE pMS) } if (hStarShip) + { UnlockStarShip ( &GLOBAL (built_ship_q), hStarShip ); + } CrewTransaction (crew_delta); } diff --git a/sc2/src/sc2code/starcon.h b/sc2/src/sc2code/starcon.h index 894109cca..3a3abd3bc 100644 --- a/sc2/src/sc2code/starcon.h +++ b/sc2/src/sc2code/starcon.h @@ -44,7 +44,6 @@ extern int ScreenHeight; #include "config.h" #include "../port.h" #include -#include #include "gfxlib.h" #include "inplib.h" #include "timelib.h" diff --git a/sc2/src/starcon2.c b/sc2/src/starcon2.c index 25d15cd1e..4ce197eb7 100644 --- a/sc2/src/starcon2.c +++ b/sc2/src/starcon2.c @@ -36,6 +36,7 @@ #include "file.h" #include "port.h" #include "options.h" +#include "comm.h" #if defined(GFXMODULE_SDL) || defined(SOUNDMODULE_SDL) # include @@ -59,11 +60,11 @@ CDToContentDir (char *contentdir) } static int -Check_PC_3DO_opt (char *value, DWORD mask, char *opt) +Check_PC_3DO_opt (const char *value, DWORD mask, const char *opt) { if (value == NULL) { - fprintf (stderr, "option '%s' requires a value!\n",opt); + fprintf (stderr, "option '%s' requires a value!\n", opt); return -1; } @@ -71,7 +72,7 @@ Check_PC_3DO_opt (char *value, DWORD mask, char *opt) return OPT_3DO; if ((mask & OPT_PC) && strcmp (value, "pc") == 0) return OPT_PC; - fprintf (stderr, "Unknown option '%s %s' found!",opt, value); + fprintf (stderr, "Unknown option '%s %s' found!", opt, value); return -1; } @@ -215,31 +216,31 @@ main (int argc, char *argv[]) case 'm': if ((val = Check_PC_3DO_opt (optarg, OPT_PC | OPT_3DO, - (char *)long_options[option_index].name)) != -1) + long_options[option_index].name)) != -1) optWhichMusic = val; break; case CSCAN_OPT: if ((val = Check_PC_3DO_opt (optarg, OPT_PC | OPT_3DO, - (char *)long_options[option_index].name)) != -1) + long_options[option_index].name)) != -1) optWhichCoarseScan = val; break; case MENU_OPT: if ((val = Check_PC_3DO_opt (optarg, OPT_PC | OPT_3DO, - (char *)long_options[option_index].name)) != -1) + long_options[option_index].name)) != -1) optWhichMenu = val; break; case FONT_OPT: if ((val = Check_PC_3DO_opt (optarg, OPT_PC | OPT_3DO, - (char *)long_options[option_index].name)) != -1) + long_options[option_index].name)) != -1) optWhichFonts = val; break; case SCROLL_OPT: if ((val = Check_PC_3DO_opt (optarg, OPT_PC | OPT_3DO, - (char *)long_options[option_index].name)) != -1) + long_options[option_index].name)) != -1) optSmoothScroll = val; break; default: