From 0d151a7143a1471407d376663832dbd8094bef98 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Sun, 3 Jul 2016 22:00:43 -0400 Subject: [PATCH] silence compiler warnings (mostly shadow variables) --- CMakeLists.txt | 1 + include/ui.h | 2 +- src/ac/convert.cpp | 20 ++--- src/anim/packunpack.cpp | 11 ++- src/debris/debris.cpp | 6 +- src/debugconsole/console.cpp | 1 - src/fireball/warpineffect.cpp | 2 - src/fonttool/fontcreate.cpp | 18 ++-- src/fonttool/fontkern.cpp | 3 +- src/freespace2/freespace.cpp | 6 +- src/graphics/font.cpp | 6 +- src/graphics/grgl1render.cpp | 26 +++--- src/graphics/grgl2render.cpp | 28 +++---- src/hud/hudsquadmsg.cpp | 14 ++++ src/hud/hudtarget.cpp | 10 +-- src/lighting/lighting.cpp | 19 ++--- src/math/vecmat.cpp | 6 +- src/menuui/techmenu.cpp | 6 +- src/mission/missionparse.cpp | 21 ++--- src/missionui/missionbrief.cpp | 7 +- src/missionui/missionshipchoice.cpp | 10 +-- src/missionui/missionweaponchoice.cpp | 8 +- src/model/modelinterp.cpp | 2 +- src/model/modelread.cpp | 11 +-- src/movie/mveplayer.cpp | 8 +- src/nebedit/nebedit.cpp | 2 +- src/network/multi_endgame.cpp | 1 - src/network/multi_ingame.cpp | 8 +- src/network/multi_pinfo.cpp | 6 +- src/network/multi_pxo.cpp | 2 - src/network/multimsgs.cpp | 30 +++---- src/network/multiui.cpp | 1 - src/network/multiutil.cpp | 5 +- src/network/psnet2.cpp | 1 - src/object/object.cpp | 6 +- src/parse/sexp.cpp | 8 +- src/particle/particle.cpp | 8 +- src/playerman/managepilot.cpp | 12 +-- src/playerman/playercontrol.cpp | 3 +- src/ship/aicode.cpp | 89 +++++++++----------- src/ship/ship.cpp | 23 +++--- src/ship/shiphit.cpp | 3 +- src/ui/button.cpp | 8 +- src/ui/inputbox.cpp | 8 +- src/ui/window.cpp | 114 +++++++++++++------------- src/weapon/beam.cpp | 13 ++- 46 files changed, 298 insertions(+), 305 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1ca4a5..2a39fea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,7 @@ if(NOT WIN32) add_definitions(-DPLAT_UNIX) add_definitions(-Wall) + add_definitions(-Wshadow) # add_definitions(-Wno-format-y2k) # add_definitions(-Wno-deprecated) add_definitions(-fsigned-char) diff --git a/include/ui.h b/include/ui.h index 7b1b1f1..4688e83 100644 --- a/include/ui.h +++ b/include/ui.h @@ -945,7 +945,7 @@ public: void draw_XSTR_forced(UI_GADGET *owner, int frame); int get_current_hotspot(); void destroy(); - ushort *get_mask_data(int *w, int *h) { *w = mask_w; *h = mask_h; return mask_data; } + ushort *get_mask_data(int *width, int *height) { *width = mask_w; *height = mask_h; return mask_data; } void render_tooltip(const char *str); void set_ignore_gadgets(int state); void add_XSTR(const char *string, int xstr_id, int x, int y, UI_GADGET *assoc, int color_type, int font_id = -1); diff --git a/src/ac/convert.cpp b/src/ac/convert.cpp index b172ecb..5926868 100644 --- a/src/ac/convert.cpp +++ b/src/ac/convert.cpp @@ -904,7 +904,7 @@ int save_anim_header() // should be key frames. int allocate_key_frames(int total_frames) { - int count = 0, frame = 1, rate = key_frame_rate, last_frame; + int count = 0, frame = 1, rate = key_frame_rate, last; if (!rate) rate = total_frames; @@ -921,16 +921,16 @@ int allocate_key_frames(int total_frames) Anim.keys = (key_frame *) malloc(count * sizeof(key_frame)); count = 0; - frame = last_frame = 1; + frame = last = 1; while (frame <= total_frames) { - if ((force_key_frame > last_frame) && (force_key_frame < frame)) + if ((force_key_frame > last) && (force_key_frame < frame)) Anim.keys[count++].frame_num = force_key_frame; Anim.keys[count++].frame_num = frame; frame += rate; } - if (force_key_frame > last_frame) + if (force_key_frame > last) Anim.keys[count++].frame_num = force_key_frame; Anim.num_keys = count; @@ -1111,7 +1111,7 @@ int convert_avi_to_anim(char* filename) int convert_frames_to_anim(char *filename) { - int first_frame, frame, pos, width, height, xparent_pal_index, r = -1; + int first, frame, pos, width, height, xparent_pal_index, r = -1; char ani_filename[255], name[255], temp[8]; int rc; FILE *fp; @@ -1121,7 +1121,7 @@ int convert_frames_to_anim(char *filename) strcpy(ani_filename, filename); strcpy(ani_filename + strlen(ani_filename) - 8, ".ani"); pos = strlen(name) - 8; - frame = first_frame = atoi(&name[pos]); + frame = first = atoi(&name[pos]); force_key_frame -= frame; memset(&Anim, 0, sizeof(anim)); @@ -1168,11 +1168,11 @@ int convert_frames_to_anim(char *filename) Xparent_color.b = 0; } - if (anim_save_init(ani_filename, width, height, frame - first_frame)) + if (anim_save_init(ani_filename, width, height, frame - first)) goto done; - while (first_frame < frame) { - sprintf(temp, "%04d", first_frame); + while (first < frame) { + sprintf(temp, "%04d", first); strncpy(&name[pos], temp, 4); rc = pcx_read_bitmap_8bpp(name, cur_frame, Anim.palette); if (rc != PCX_ERROR_NONE) @@ -1181,7 +1181,7 @@ int convert_frames_to_anim(char *filename) if (anim_save_frame()) goto done; - first_frame++; + first++; } if (save_anim_header()) diff --git a/src/anim/packunpack.cpp b/src/anim/packunpack.cpp index b6f98f0..b0b2a65 100644 --- a/src/anim/packunpack.cpp +++ b/src/anim/packunpack.cpp @@ -528,7 +528,9 @@ int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_ break; case PACKING_METHOD_STD_RLE_KEY: { +#ifndef NDEBUG ubyte *dest_start = save; +#endif int i; count = 1; @@ -595,8 +597,9 @@ int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_ // printf("Just packed %d %d times, at end since pixel change\n",last,count); } } - +#ifndef NDEBUG SDL_assert(packed_size == (save-dest_start) ); +#endif return packed_size; break; } @@ -685,8 +688,9 @@ int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, in break; case PACKING_METHOD_STD_RLE: { // high bit count regular RLE frame - +#ifndef NDEBUG ubyte *dest_start = save; +#endif count = 1; @@ -755,8 +759,9 @@ int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, in packed_size += 2; } } - +#ifndef NDEBUG SDL_assert(packed_size == (save-dest_start) ); +#endif return packed_size; break; } diff --git a/src/debris/debris.cpp b/src/debris/debris.cpp index 1a6e4bd..b695a8d 100644 --- a/src/debris/debris.cpp +++ b/src/debris/debris.cpp @@ -874,17 +874,17 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto int ship_info_flag = Ship_info[Ships[source_obj->instance].ship_info_index].flags; if (ship_info_flag & (SIF_SMALL_SHIP | SIF_NOT_FLYABLE | SIF_HARMLESS)) { if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_SMALL_DEBRIS*MAX_SPEED_SMALL_DEBRIS) { - float scale = MAX_SPEED_SMALL_DEBRIS / vm_vec_mag(&obj->phys_info.vel); + scale = MAX_SPEED_SMALL_DEBRIS / vm_vec_mag(&obj->phys_info.vel); vm_vec_scale(&obj->phys_info.vel, scale); } } else if (ship_info_flag & SIF_BIG_SHIP) { if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_BIG_DEBRIS*MAX_SPEED_BIG_DEBRIS) { - float scale = MAX_SPEED_BIG_DEBRIS / vm_vec_mag(&obj->phys_info.vel); + scale = MAX_SPEED_BIG_DEBRIS / vm_vec_mag(&obj->phys_info.vel); vm_vec_scale(&obj->phys_info.vel, scale); } } else if (ship_info_flag & SIF_HUGE_SHIP) { if (vm_vec_mag_squared(&obj->phys_info.vel) > MAX_SPEED_CAPITAL_DEBRIS*MAX_SPEED_CAPITAL_DEBRIS) { - float scale = MAX_SPEED_CAPITAL_DEBRIS / vm_vec_mag(&obj->phys_info.vel); + scale = MAX_SPEED_CAPITAL_DEBRIS / vm_vec_mag(&obj->phys_info.vel); vm_vec_scale(&obj->phys_info.vel, scale); } } else { diff --git a/src/debugconsole/console.cpp b/src/debugconsole/console.cpp index 1299c54..dada63a 100644 --- a/src/debugconsole/console.cpp +++ b/src/debugconsole/console.cpp @@ -730,7 +730,6 @@ void debug_console( void (*_func)() ) last_oldcommand++; SDL_strlcpy( oldcommand_line[last_oldcommand], command_line, SDL_arraysize(oldcommand_line[0]) ); } else { - int i; for (i=0; inum_chars; @@ -343,14 +343,14 @@ void fonttool_add_char( font *fnt, int x1, int y1, int real_w, int h, ubyte *dat free(fnt->pixel_data); fnt->pixel_data = NULL; } - offset = fnt->pixel_data_size; + coffset = fnt->pixel_data_size; fnt->pixel_data_size += w*h; fnt->pixel_data = new_pixel_data; - new_pixel_data = fnt->pixel_data + offset; + new_pixel_data = fnt->pixel_data + coffset; new_char->byte_width = w; new_char->spacing = real_w; - new_char->offset = offset; + new_char->offset = coffset; new_char->kerning_entry = -1; new_char->user_data = 0; @@ -360,7 +360,7 @@ void fonttool_add_char( font *fnt, int x1, int y1, int real_w, int h, ubyte *dat if ( x >= real_w) c = 0; else - c = data[x+y*rowsize]; + c = cdata[x+y*rowsize]; if ( c > 15 ) { num_bad_pixels++; c = 15; @@ -526,9 +526,9 @@ void fonttool_read( char *filename, font *fnt ) int i,x,y; x = y = 0; for (i=0; inum_chars; i++ ) { - ubyte * fp; + ubyte * pd; int x1, y1; - fp = &fnt->pixel_data[fnt->char_data[i].offset]; + pd = &fnt->pixel_data[fnt->char_data[i].offset]; if ( x + fnt->char_data[i].byte_width >= fnt->bm_w ) { x = 0; y += fnt->h; @@ -541,7 +541,7 @@ void fonttool_read( char *filename, font *fnt ) for( y1=0; y1h; y1++ ) { for (x1=0; x1char_data[i].byte_width; x1++ ) { - uint c = *fp++; + uint c = *pd++; if ( c > 14 ) c = 14; fnt->bm_data[(x+x1)+(y+y1)*fnt->bm_w] = (unsigned char)(c); } diff --git a/src/fonttool/fontkern.cpp b/src/fonttool/fontkern.cpp index e30e676..ece9159 100644 --- a/src/fonttool/fontkern.cpp +++ b/src/fonttool/fontkern.cpp @@ -529,7 +529,8 @@ void fonttool_edit_kerning(char *fname1) gr_string( 20, 360+th+20, SampleText ); } - int x = 5, y = 200; + x = 5; + int y = 200; int widest = 0; //= ( 330 - 200 ) / KernFont.h; diff --git a/src/freespace2/freespace.cpp b/src/freespace2/freespace.cpp index 4bb58ad..4a8c599 100644 --- a/src/freespace2/freespace.cpp +++ b/src/freespace2/freespace.cpp @@ -3048,7 +3048,7 @@ void player_repair_frame(float frametime) #ifndef NDEBUG #define NUM_FRAMES_TEST 300 #define NUM_MIXED_SOUNDS 16 -void do_timing_test(float flFrametime) +void do_timing_test(float frametime) { static int framecount = 0; static int test_running = 0; @@ -3059,7 +3059,7 @@ void do_timing_test(float flFrametime) if ( test_running ) { framecount++; - test_time += flFrametime; + test_time += frametime; if ( framecount >= NUM_FRAMES_TEST ) { test_running = 0; nprintf(("General", "%d frames took %.3f seconds\n", NUM_FRAMES_TEST, test_time)); @@ -6563,7 +6563,7 @@ void game_spew_pof_info_sub(int model_num, polymodel *pm, int sm, CFILE *out, in *out_destroyed_total += sub_total_destroyed; } -#define BAIL() do { int idx; for(idx=0; idxnum_chars; i++ ) { - ubyte * fp; + ubyte * fpp; int x1, y1; - fp = &fnt->pixel_data[fnt->char_data[i].offset]; + fpp = &fnt->pixel_data[fnt->char_data[i].offset]; if ( x + fnt->char_data[i].byte_width >= fnt->bm_w ) { x = 0; y += fnt->h; @@ -660,7 +660,7 @@ int gr_create_font(const char * typeface) for( y1=0; y1h; y1++ ) { for (x1=0; x1char_data[i].byte_width; x1++ ) { - uint c = *fp++; + uint c = *fpp++; if ( c > 14 ) c = 14; fnt->bm_data[(x+x1)+(y+y1)*fnt->bm_w] = (unsigned char)(c); } diff --git a/src/graphics/grgl1render.cpp b/src/graphics/grgl1render.cpp index f982198..3cd60ca 100644 --- a/src/graphics/grgl1render.cpp +++ b/src/graphics/grgl1render.cpp @@ -212,7 +212,7 @@ static void opengl1_tmapper_internal( int nv, vertex ** verts, uint flags, int i float oy = gr_screen.offset_y * 16.0f; if (flags & TMAP_FLAG_PIXEL_FOG) { - int r, g, b; + int fr, fg, fb; int ra, ga, ba; float sx, sy; @@ -224,11 +224,11 @@ static void opengl1_tmapper_internal( int nv, vertex ** verts, uint flags, int i sx = (va->sx * 16.0f + ox) / 16.0f; sy = (va->sy * 16.0f + oy) / 16.0f; - neb2_get_pixel((int)sx, (int)sy, &r, &g, &b); + neb2_get_pixel((int)sx, (int)sy, &fr, &fg, &fb); - ra += r; - ga += g; - ba += b; + ra += fr; + ga += fg; + ba += fb; } ra /= nv; @@ -245,12 +245,12 @@ static void opengl1_tmapper_internal( int nv, vertex ** verts, uint flags, int i float sx, sy, sz = 0.99f, rhw = 1.0f; bool bZval = (Gr_zbuffering || (flags & TMAP_FLAG_NEBULA)); - bool bCorrect = (flags & TMAP_FLAG_CORRECT); - bool bAlpha = (flags & TMAP_FLAG_ALPHA); - bool bNebula = (flags & TMAP_FLAG_NEBULA); + bool bCorrect = ((flags & TMAP_FLAG_CORRECT) == TMAP_FLAG_CORRECT); + bool bAlpha = ((flags & TMAP_FLAG_ALPHA) == TMAP_FLAG_ALPHA); + bool bNebula = ((flags & TMAP_FLAG_NEBULA) == TMAP_FLAG_NEBULA); bool bRamp = ((flags & TMAP_FLAG_RAMP) && (flags & TMAP_FLAG_GOURAUD)); bool bRGB = ((flags & TMAP_FLAG_RGB) && (flags & TMAP_FLAG_GOURAUD)); - bool bTextured = (flags & TMAP_FLAG_TEXTURED); + bool bTextured = ((flags & TMAP_FLAG_TEXTURED) == TMAP_FLAG_TEXTURED); for (i = nv-1; i >= 0; i--) { vertex *va = verts[i]; @@ -273,16 +273,16 @@ static void opengl1_tmapper_internal( int nv, vertex ** verts, uint flags, int i if (bRGB) { // Make 0.75 be 256.0f - r = Gr_gamma_lookup[va->r]; - g = Gr_gamma_lookup[va->g]; - b = Gr_gamma_lookup[va->b]; + r = (ubyte)Gr_gamma_lookup[va->r]; + g = (ubyte)Gr_gamma_lookup[va->g]; + b = (ubyte)Gr_gamma_lookup[va->b]; } else if (bNebula) { int pal = (va->b*(NEBULA_COLORS-1))/255; r = gr_palette[pal*3+0]; g = gr_palette[pal*3+1]; b = gr_palette[pal*3+2]; } else if (bRamp) { - r = g = b = Gr_gamma_lookup[va->b]; + r = g = b = (ubyte)Gr_gamma_lookup[va->b]; } render_buffer[rb_offset].r = r; diff --git a/src/graphics/grgl2render.cpp b/src/graphics/grgl2render.cpp index f144213..62cd3d8 100644 --- a/src/graphics/grgl2render.cpp +++ b/src/graphics/grgl2render.cpp @@ -96,7 +96,7 @@ static void opengl2_tmapper_internal(int nv, vertex **verts, uint flags, int is_ float oy = gr_screen.offset_y * 16.0f; if (flags & TMAP_FLAG_PIXEL_FOG) { - int r, g, b; + int fr, fg, fb; int ra, ga, ba; float sx, sy; @@ -108,11 +108,11 @@ static void opengl2_tmapper_internal(int nv, vertex **verts, uint flags, int is_ sx = (va->sx * 16.0f + ox) / 16.0f; sy = (va->sy * 16.0f + oy) / 16.0f; - neb2_get_pixel((int)sx, (int)sy, &r, &g, &b); + neb2_get_pixel((int)sx, (int)sy, &fr, &fg, &fb); - ra += r; - ga += g; - ba += b; + ra += fr; + ga += fg; + ba += fb; } ra /= nv; @@ -129,13 +129,13 @@ static void opengl2_tmapper_internal(int nv, vertex **verts, uint flags, int is_ float sx, sy, sz = 0.99f, rhw = 1.0f; bool bZval = (Gr_zbuffering || (flags & TMAP_FLAG_NEBULA)); - bool bCorrect = (flags & TMAP_FLAG_CORRECT); - bool bAlpha = (flags & TMAP_FLAG_ALPHA); - bool bNebula = (flags & TMAP_FLAG_NEBULA); + bool bCorrect = ((flags & TMAP_FLAG_CORRECT) == TMAP_FLAG_CORRECT); + bool bAlpha = ((flags & TMAP_FLAG_ALPHA) == TMAP_FLAG_ALPHA); + bool bNebula = ((flags & TMAP_FLAG_NEBULA) == TMAP_FLAG_NEBULA); bool bRamp = ((flags & TMAP_FLAG_RAMP) && (flags & TMAP_FLAG_GOURAUD)); bool bRGB = ((flags & TMAP_FLAG_RGB) && (flags & TMAP_FLAG_GOURAUD)); - bool bTextured = (flags & TMAP_FLAG_TEXTURED); - bool bFog = (flags & TMAP_FLAG_PIXEL_FOG); + bool bTextured = ((flags & TMAP_FLAG_TEXTURED) == TMAP_FLAG_TEXTURED); + bool bFog = ((flags & TMAP_FLAG_PIXEL_FOG) == TMAP_FLAG_PIXEL_FOG); for (i = nv-1; i >= 0; i--) { vertex *va = verts[i]; @@ -158,16 +158,16 @@ static void opengl2_tmapper_internal(int nv, vertex **verts, uint flags, int is_ if (bRGB) { // Make 0.75 be 256.0f - r = Gr_gamma_lookup[va->r]; - g = Gr_gamma_lookup[va->g]; - b = Gr_gamma_lookup[va->b]; + r = (ubyte)Gr_gamma_lookup[va->r]; + g = (ubyte)Gr_gamma_lookup[va->g]; + b = (ubyte)Gr_gamma_lookup[va->b]; } else if (bNebula) { int pal = (va->b*(NEBULA_COLORS-1))/255; r = gr_palette[pal*3+0]; g = gr_palette[pal*3+1]; b = gr_palette[pal*3+2]; } else if (bRamp) { - r = g = b = Gr_gamma_lookup[va->b]; + r = g = b = (ubyte)Gr_gamma_lookup[va->b]; } render_buffer[rb_offset].r = r; diff --git a/src/hud/hudsquadmsg.cpp b/src/hud/hudsquadmsg.cpp index e72cd6a..ce60190 100644 --- a/src/hud/hudsquadmsg.cpp +++ b/src/hud/hudsquadmsg.cpp @@ -1674,7 +1674,9 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, int ai_mode, ai_submode; // ai mode and submode needed for ship commands char *target_shipname; // ship number of possible targets int message_sent, message; +#ifndef NDEBUG int target_team = -1, wing_team = -1; // team for the wing and the player's target +#endif ship *ordering_shipp; // quick short circuit here because of actually showing comm menu even though you cannot message. @@ -1734,7 +1736,9 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, case ATTACK_TARGET_ITEM: if ( Objects[ainfo->target_objnum].type == OBJ_SHIP ) { SDL_assert( target_shipname ); +#ifndef NDEBUG SDL_assert( wing_team != target_team ); +#endif if ( (Ships[Objects[ainfo->target_objnum].instance].wingnum != -1) && (Ships[Objects[ainfo->target_objnum].instance].wingnum == wingnum) ) { message = MESSAGE_NOSIR; ai_mode = AI_GOAL_NONE; @@ -1754,7 +1758,9 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, case DISABLE_TARGET_ITEM: SDL_assert( target_shipname ); +#ifndef NDEBUG SDL_assert( wing_team != target_team ); +#endif ai_mode = AI_GOAL_DISABLE_SHIP; ai_submode = -SUBSYSTEM_ENGINE; @@ -1763,7 +1769,9 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, case DISARM_TARGET_ITEM: SDL_assert( target_shipname ); +#ifndef NDEBUG SDL_assert( wing_team != target_team ); +#endif ai_mode = AI_GOAL_DISARM_SHIP; ai_submode = -SUBSYSTEM_TURRET; @@ -1772,7 +1780,9 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, case DISABLE_SUBSYSTEM_ITEM: SDL_assert( target_shipname ); +#ifndef NDEBUG SDL_assert( wing_team != target_team ); +#endif SDL_assert( ainfo->targeted_subsys != NULL ); SDL_assert( ainfo->targeted_subsys->current_hits > 0.0f); @@ -1784,7 +1794,9 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, case PROTECT_TARGET_ITEM: SDL_assert( target_shipname ); +#ifndef NDEBUG SDL_assert( wing_team == target_team ); +#endif ai_mode = AI_GOAL_GUARD; ai_submode = AIS_GUARD_PATROL; @@ -1793,7 +1805,9 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, case IGNORE_TARGET_ITEM: SDL_assert( target_shipname ); +#ifndef NDEBUG SDL_assert( wing_team != target_team ); +#endif ai_mode = AI_GOAL_IGNORE; ai_submode = 0; // actually, a don't care. diff --git a/src/hud/hudtarget.cpp b/src/hud/hudtarget.cpp index a497874..7d545f5 100644 --- a/src/hud/hudtarget.cpp +++ b/src/hud/hudtarget.cpp @@ -1459,7 +1459,7 @@ ship_obj *get_ship_obj_ptr_from_index(int index); // NOTE: this function is only allows targeting bombs void hud_target_missile(object *source_obj, int next_flag) { - missile_obj *end, *start, *mo; + missile_obj *end, *begin, *mo; object *A, *target_objp; ai_info *aip; weapon *wp; @@ -1480,9 +1480,9 @@ void hud_target_missile(object *source_obj, int next_flag) } } - start = advance_missile_obj(end, next_flag); + begin = advance_missile_obj(end, next_flag); - for ( mo = start; mo != end; mo = advance_missile_obj(mo, next_flag) ) { + for ( mo = begin; mo != end; mo = advance_missile_obj(mo, next_flag) ) { if ( mo == &Missile_obj_list ){ continue; } @@ -3938,7 +3938,6 @@ void hud_show_lead_indicator(vector *target_world_pos) bank_to_fire = hud_get_best_primary_bank(&prange); if ( bank_to_fire < 0 ) return; - wip = &Weapon_info[swp->primary_bank_weapons[bank_to_fire]]; if (po->n_guns && bank_to_fire != -1 ) { rel_pos = &po->gun_banks[bank_to_fire].pnt[0]; @@ -3963,7 +3962,6 @@ void hud_show_lead_indicator(vector *target_world_pos) srange = ship_get_secondary_weapon_range(Player_ship); if ( swp->current_secondary_bank >= 0 ) { - weapon_info *wip; int bank = swp->current_secondary_bank; wip = &Weapon_info[swp->secondary_bank_weapons[bank]]; if ( wip->wi_flags & WIF_HOMING_ASPECT ) { @@ -3980,6 +3978,8 @@ void hud_show_lead_indicator(vector *target_world_pos) indicator_frame = Lead_indicator_gauge.first_frame + frame_offset; + wip = &Weapon_info[swp->primary_bank_weapons[bank_to_fire]]; + SDL_assert(wip->max_speed != 0); time_to_target = dist_to_target / wip->max_speed; diff --git a/src/lighting/lighting.cpp b/src/lighting/lighting.cpp index e075b69..0449f97 100644 --- a/src/lighting/lighting.cpp +++ b/src/lighting/lighting.cpp @@ -745,8 +745,7 @@ ubyte light_apply( vector *pos, vector * norm, float static_light_level ) if (Detail.lighting==0) { // No static light - ubyte l = ubyte(fl2i(static_light_level*255.0f)); - return l; + return ubyte(fl2i(static_light_level*255.0f)); } if ( Lighting_off ) return 191; @@ -811,9 +810,9 @@ ubyte light_apply( vector *pos, vector * norm, float static_light_level ) lval += l->intensity*dot; } else if ( dist < l->rad2_squared ) { // dist from 0 to - float n = dist - l->rad1_squared; + float x = dist - l->rad1_squared; float d = l->rad2_squared - l->rad1_squared; - float ltmp = (1.0f - n / d )*dot*l->intensity; + float ltmp = (1.0f - x / d )*dot*l->intensity; lval += ltmp; } if ( lval > 1.0f ) { @@ -834,10 +833,10 @@ void light_apply_rgb( ubyte *param_r, ubyte *param_g, ubyte *param_b, vector *po if (Detail.lighting==0) { // No static light - ubyte l = ubyte(fl2i(static_light_level*255.0f)); - *param_r = l; - *param_g = l; - *param_b = l; + ubyte s = ubyte(fl2i(static_light_level*255.0f)); + *param_r = s; + *param_g = s; + *param_b = s; return; } @@ -956,9 +955,9 @@ void light_apply_rgb( ubyte *param_r, ubyte *param_g, ubyte *param_b, vector *po } else if ( dist < l->rad2_squared ) { float ratio; // dist from 0 to - float n = dist - l->rad1_squared; + float x = dist - l->rad1_squared; float d = l->rad2_squared - l->rad1_squared; - ratio = (1.0f - n / d)*dot*l->intensity; + ratio = (1.0f - x / d)*dot*l->intensity; ratio *= 0.25f; rval += l->r*ratio; gval += l->g*ratio; diff --git a/src/math/vecmat.cpp b/src/math/vecmat.cpp index 31d13cd..84c5ca7 100644 --- a/src/math/vecmat.cpp +++ b/src/math/vecmat.cpp @@ -584,14 +584,14 @@ float vm_vec_mag_quick(vector *v) c = v->xyz.z; if (a < b) { - float t=a; a=b; b=t; + t=a; a=b; b=t; } if (b < c) { - float t=b; b=c; c=t; + t=b; b=c; c=t; if (a < b) { - float t=a; a=b; b=t; + t=a; a=b; b=t; } } diff --git a/src/menuui/techmenu.cpp b/src/menuui/techmenu.cpp index 5106a33..a048806 100644 --- a/src/menuui/techmenu.cpp +++ b/src/menuui/techmenu.cpp @@ -702,10 +702,10 @@ void techroom_render_desc(int xo, int yo, int h) // can be scrolled down int more_txt_x = Tech_desc_coords[gr_screen.res][0] + (Tech_desc_coords[gr_screen.res][2]/2) - 10; // FIXME should move these to constants since they dont move int more_txt_y = Tech_desc_coords[gr_screen.res][1] + Tech_desc_coords[gr_screen.res][3]; // located below brief text, centered - int w, h; - gr_get_string_size(&w, &h, XSTR("more", 1469), strlen(XSTR("more", 1469))); + int width, height; + gr_get_string_size(&width, &height, XSTR("more", 1469), strlen(XSTR("more", 1469))); gr_set_color_fast(&Color_black); - gr_rect(more_txt_x-2, more_txt_y, w+3, h); + gr_rect(more_txt_x-2, more_txt_y, width+3, height); gr_set_color_fast(&Color_red); gr_string(more_txt_x, more_txt_y, XSTR("more", 1469)); // base location on the input x and y? } diff --git a/src/mission/missionparse.cpp b/src/mission/missionparse.cpp index f805d96..e325091 100644 --- a/src/mission/missionparse.cpp +++ b/src/mission/missionparse.cpp @@ -1706,7 +1706,7 @@ int parse_create_object(p_object *objp) Objects[objnum].shields[0] = (float) objp->initial_shields; } else { - int max_allowed_sparks, num_sparks, i; + int max_allowed_sparks, num_sparks; polymodel *pm; // Ships[shipnum].hull_hit_points_taken = (float)objp->initial_hull * sip->max_hull_hit_points / 100.0f; @@ -2141,13 +2141,12 @@ int parse_object(mission *pm, int flag, p_object *objp) // if the ship is supposed to be destroyed before the mission, then blow up the ship, mark the pieces // as last forever. Only call this stuff when you are blowing up the ship if ( destroy_before_mission_time >= 0 ) { - object *objp; + object *robjp; - objp = &Objects[real_objnum]; + robjp = &Objects[real_objnum]; if ( !Fred_running ) { - int i; - shipfx_blow_up_model( objp, Ships[objp->instance].modelnum, 0, 0, &objp->pos ); - objp->flags |= OF_SHOULD_BE_DEAD; + shipfx_blow_up_model( robjp, Ships[robjp->instance].modelnum, 0, 0, &robjp->pos ); + robjp->flags |= OF_SHOULD_BE_DEAD; // once the ship is exploded, find the debris pieces belonging to this object, mark them // as not to expire, and move them forward in time N seconds @@ -2164,13 +2163,13 @@ int parse_object(mission *pm, int flag, p_object *objp) db->lifeleft = -1.0f; // be sure that lifeleft == -1.0 so that it really doesn't expire! // now move the debris along it's path for N seconds - objp = &Objects[db->objnum]; - physics_sim( &objp->pos, &objp->orient, &objp->phys_info, (float)destroy_before_mission_time ); + robjp = &Objects[db->objnum]; + physics_sim( &robjp->pos, &robjp->orient, &robjp->phys_info, (float)destroy_before_mission_time ); } } else { // be sure to set the variable in the ships structure for the final death time!!! - Ships[objp->instance].final_death_time = destroy_before_mission_time; - Ships[objp->instance].flags |= SF_KILL_BEFORE_MISSION; + Ships[robjp->instance].final_death_time = destroy_before_mission_time; + Ships[robjp->instance].flags |= SF_KILL_BEFORE_MISSION; } } } @@ -4496,8 +4495,6 @@ void mission_eval_arrivals() // check the support ship arrival list if ( Arriving_support_ship ) { - int objnum; - objnum = mission_did_ship_arrive( Arriving_support_ship ); if ( objnum != -1 ) { diff --git a/src/missionui/missionbrief.cpp b/src/missionui/missionbrief.cpp index 9bfdfd8..8d49e89 100644 --- a/src/missionui/missionbrief.cpp +++ b/src/missionui/missionbrief.cpp @@ -1475,11 +1475,7 @@ void brief_render_closeup(int ship_class, float frametime) void brief_render(float frametime) { int z; - int w; - -#ifndef NDEBUG - int h; -#endif + int w, h; if ( Num_brief_stages <= 0 ) { gr_set_color_fast(&Color_white); @@ -1515,7 +1511,6 @@ void brief_render(float frametime) // can be scrolled down int more_txt_x = Brief_text_coords[gr_screen.res][0] + (Brief_max_line_width[gr_screen.res]/2) - 10; int more_txt_y = Brief_text_coords[gr_screen.res][1] + Brief_text_coords[gr_screen.res][3] - 2; // located below brief text, centered - int w, h; gr_get_string_size(&w, &h, XSTR("more", 1469), strlen(XSTR("more", 1469))); gr_set_color_fast(&Color_black); gr_rect(more_txt_x-2, more_txt_y, w+3, h); diff --git a/src/missionui/missionshipchoice.cpp b/src/missionui/missionshipchoice.cpp index 3719b43..8e03fb8 100644 --- a/src/missionui/missionshipchoice.cpp +++ b/src/missionui/missionshipchoice.cpp @@ -756,14 +756,14 @@ const char *ss_tooltip_handler(const char *str) return Ship_info[Selected_ss_class].manufacturer_str; } else if (!SDL_strcasecmp(str, NOX("@ship_desc"))) { - char *str; + char *desc; int x, y, w, h; - str = Ship_info[Selected_ss_class].desc; - if (!str) + desc = Ship_info[Selected_ss_class].desc; + if (!desc) return NULL; - gr_get_string_size(&w, &h, str); + gr_get_string_size(&w, &h, desc); x = SHIP_DESC_X - w / 2; y = SHIP_DESC_Y - h / 2; @@ -771,7 +771,7 @@ const char *ss_tooltip_handler(const char *str) gr_rect(x - 5, y - 5, w + 10, h + 10); gr_set_color_fast(&Color_bright_white); - gr_string(x, y, str); + gr_string(x, y, desc); return NULL; } diff --git a/src/missionui/missionweaponchoice.cpp b/src/missionui/missionweaponchoice.cpp index 96095a0..b5bbc1d 100644 --- a/src/missionui/missionweaponchoice.cpp +++ b/src/missionui/missionweaponchoice.cpp @@ -953,11 +953,11 @@ const char *wl_tooltip_handler(const char *str) return NULL; if (!SDL_strcasecmp(str, "@weapon_desc")) { - char *str; + char *desc; int x, y, w, h; - str = Weapon_info[Selected_wl_class].desc; - gr_get_string_size(&w, &h, str); + desc = Weapon_info[Selected_wl_class].desc; + gr_get_string_size(&w, &h, desc); x = Wl_weapon_desc_coords[gr_screen.res][0] - w / 2; y = Wl_weapon_desc_coords[gr_screen.res][1] - h / 2; @@ -965,7 +965,7 @@ const char *wl_tooltip_handler(const char *str) gr_rect(x - 5, y - 5, w + 10, h + 10); gr_set_color_fast(&Color_bright_white); - gr_string(x, y, str); + gr_string(x, y, desc); return NULL; } diff --git a/src/model/modelinterp.cpp b/src/model/modelinterp.cpp index 8a9b32b..016ea69 100644 --- a/src/model/modelinterp.cpp +++ b/src/model/modelinterp.cpp @@ -720,7 +720,7 @@ void model_interp_flatpoly(ubyte * p,polymodel * pm) } if (Interp_flags & (MR_SHOW_OUTLINE|MR_SHOW_OUTLINE_PRESET)) { - int i, j; + int j; if ( Interp_flags & MR_SHOW_OUTLINE ) { gr_set_color_fast( &Interp_outline_color ); diff --git a/src/model/modelread.cpp b/src/model/modelread.cpp index f3e9b0c..5fc7bef 100644 --- a/src/model/modelread.cpp +++ b/src/model/modelread.cpp @@ -1410,7 +1410,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode pm->num_xc = cfread_int(fp); if (pm->num_xc > 0) { pm->xc = (cross_section*) malloc(pm->num_xc*sizeof(cross_section)); - for (int i=0; inum_xc; i++) { + for (i=0; inum_xc; i++) { pm->xc[i].z = cfread_float(fp); pm->xc[i].radius = cfread_float(fp); } @@ -1682,7 +1682,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode break; } - case ID_FUEL: + case ID_FUEL: { char props[MAX_PROP_LEN]; pm->n_thrusters = cfread_int(fp); pm->thrusters = (thruster_bank *)malloc(sizeof(thruster_bank) * pm->n_thrusters); @@ -1750,12 +1750,13 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode } break; + } case ID_TGUN: case ID_TMIS: { int n_banks, n_slots, parent; model_subsystem *subsystemp; - int i, j, snum=-1; + int snum=-1; vector bogus; n_banks = cfread_int(fp); // number of turret points @@ -1844,7 +1845,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode } case ID_TXTR: { //Texture filename list - int i,n; + int n; // char name_buf[128]; //mprintf(0,"Got chunk TXTR, len=%d\n",len); @@ -1953,7 +1954,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode case ID_EYE: // an eye position(s) { - int num_eyes, i; + int num_eyes; // all eyes points are stored simply as vectors and their normals. // 0th element is used as usual player view position. diff --git a/src/movie/mveplayer.cpp b/src/movie/mveplayer.cpp index 3f00a42..b74a557 100644 --- a/src/movie/mveplayer.cpp +++ b/src/movie/mveplayer.cpp @@ -513,10 +513,10 @@ static void mve_convert_and_draw() // convert from abgr to rgba px = (1<<15)|*pSrcs; - r = (px & 0x7C00) >> 10; - g = (px & 0x3E0) >> 5; - b = (px & 0x1F) >> 0; - a = (px & 0x8000) >> 15; + r = ubyte((px & 0x7C00) >> 10); + g = ubyte((px & 0x3E0) >> 5); + b = ubyte((px & 0x1F) >> 0); + a = ubyte((px & 0x8000) >> 15); pDests[x] = (r << 11) | (g << 6) | (b << 1) | (a << 0); diff --git a/src/nebedit/nebedit.cpp b/src/nebedit/nebedit.cpp index b8eab87..8429c7b 100644 --- a/src/nebedit/nebedit.cpp +++ b/src/nebedit/nebedit.cpp @@ -432,7 +432,7 @@ void nebula_draw_2d() gr_line(End_pos_x, Orig_pos_y, Orig_pos_x, Orig_pos_y); } else { gr_set_color(0,100,0); - for (int i=0;i-1)) { diff --git a/src/network/multi_endgame.cpp b/src/network/multi_endgame.cpp index b58f184..095a407 100644 --- a/src/network/multi_endgame.cpp +++ b/src/network/multi_endgame.cpp @@ -544,7 +544,6 @@ void multi_endgame_cleanup() // close all open SPX/TCP reliable sockets if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ - int idx; // do it for all players, since we're leaving anyway. for(idx=0;idxflags & NETINFO_FLAG_AM_MASTER) ) { - int i, player_num; + int player_num; player_num = NET_PLAYER_NUM(pl); code = INGAME_PLAYER_CHOICE; @@ -1846,6 +1844,7 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo) uint respawn_count; ubyte val, num_secondary_banks; p_object *pobj; + int player_num; // get the code GET_INT(code); @@ -1853,7 +1852,6 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo) switch(code){ // a request for a ship from an ingame joiner case INGAME_SR_REQUEST: - int player_num; ushort sig_request; // lookup the player and make sure he doesn't already have an objnum (along with possible error conditions) @@ -2029,9 +2027,7 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo) break; case INGAME_PLAYER_CHOICE: { - int player_num; ushort net_signature; - object *objp; // get the player number of this guy, and the net signature of the ship he has chosen GET_INT(player_num); diff --git a/src/network/multi_pinfo.cpp b/src/network/multi_pinfo.cpp index bd38839..d502894 100644 --- a/src/network/multi_pinfo.cpp +++ b/src/network/multi_pinfo.cpp @@ -575,7 +575,7 @@ void multi_pinfo_popup_close() void multi_pinfo_blit_pilot_image() { char place_text[100]; - int w; + int w, h; // if we don't have a bitmap handle, blit a placeholder if(Mp_pilot.bitmap == -1){ @@ -607,7 +607,6 @@ void multi_pinfo_blit_pilot_image() gr_set_bitmap(Mp_pilot.bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); // get width and heigh - int w, h; bm_get_info(Mp_pilot.bitmap, &w, &h, NULL, NULL, NULL, NULL); gr_bitmap(Multi_pinfo_pilot_coords[gr_screen.res][0] + ((Multi_pinfo_pilot_coords[gr_screen.res][2] - w)/2), @@ -621,7 +620,7 @@ void multi_pinfo_blit_squadron_logo() { #ifndef MAKE_FS1 // no squads in FS1 char place_text[100]; - int w; + int w, h; player *p = Multi_pinfo_popup_player->player; // if we don't have a bitmap handle, blit a placeholder @@ -655,7 +654,6 @@ void multi_pinfo_blit_squadron_logo() // gr_bitmap(MPI_SQUAD_X, MPI_SQUAD_Y); // get width and heigh - int w, h; bm_get_info(Mp_squad.bitmap, &w, &h, NULL, NULL, NULL, NULL); gr_bitmap(Multi_pinfo_squad_coords[gr_screen.res][0] + ((Multi_pinfo_squad_coords[gr_screen.res][2] - w)/2), diff --git a/src/network/multi_pxo.cpp b/src/network/multi_pxo.cpp index 6a86c7c..0488458 100644 --- a/src/network/multi_pxo.cpp +++ b/src/network/multi_pxo.cpp @@ -2519,7 +2519,6 @@ void multi_pxo_api_process() SDL_strlcpy(Multi_pxo_channel_current.name, cmd->data, SDL_arraysize(Multi_pxo_channel_current.name)); // if we don't already have this guy on the list, add him - pxo_channel *lookup; lookup = multi_pxo_find_channel(Multi_pxo_channel_current.name,Multi_pxo_channels); if(lookup == NULL){ // create a new channel with the given name and place it on the channel list, return a pointer or NULL on fail @@ -2759,7 +2758,6 @@ void multi_pxo_make_channels(char *chan_str) // if we don't already have this guy on the list, add him if(ON_CHANNEL()){ - pxo_channel *lookup; lookup = multi_pxo_find_channel(Multi_pxo_channel_current.name,Multi_pxo_channels); if(lookup == NULL){ // create a new channel with the given name and place it on the channel list, return a pointer or NULL on fail diff --git a/src/network/multimsgs.cpp b/src/network/multimsgs.cpp index 3ea78ba..914ee7a 100644 --- a/src/network/multimsgs.cpp +++ b/src/network/multimsgs.cpp @@ -2299,7 +2299,7 @@ void process_netgame_update_packet( ubyte *data, header *hinfo ) void send_netgame_descript_packet(net_addr *addr, int code) { ubyte data[MAX_PACKET_SIZE],val; - int len; + int length; int packet_size = 0; // build the header @@ -2310,12 +2310,12 @@ void send_netgame_descript_packet(net_addr *addr, int code) if(code == 1){ // add as much of the description as we dare - len = strlen(The_mission.mission_desc); - if(len > MAX_PACKET_SIZE - 10){ - len = MAX_PACKET_SIZE - 10; - ADD_INT(len); - memcpy(data+packet_size,The_mission.mission_desc,len); - packet_size += len; + length = strlen(The_mission.mission_desc); + if(length > MAX_PACKET_SIZE - 10){ + length = MAX_PACKET_SIZE - 10; + ADD_INT(length); + memcpy(data+packet_size,The_mission.mission_desc,length); + packet_size += length; } else { ADD_STRING(The_mission.mission_desc); } @@ -6987,7 +6987,7 @@ void process_client_update_packet(ubyte *data, header *hinfo) // if we have hull information, then read it in. if ( have_hull_info ) { - float val; + float fval; ship_info *sip; ship *shipp; ubyte hull_percent, shield_percent[MAX_SHIELD_SECTIONS], n_subsystems, subsystem_percent[MAX_MODEL_SUBSYSTEMS], threats; @@ -7031,12 +7031,12 @@ void process_client_update_packet(ubyte *data, header *hinfo) objp = Player_obj; sip = &Ship_info[shipp->ship_info_index]; - val = hull_percent * sip->initial_hull_strength / 100.0f; - objp->hull_strength = val; + fval = hull_percent * sip->initial_hull_strength / 100.0f; + objp->hull_strength = fval; for ( i = 0; i < MAX_SHIELD_SECTIONS; i++ ) { - val = (shield_percent[i] * sip->shields / 100.0f) / MAX_SHIELD_SECTIONS; - objp->shields[i] = val; + fval = (shield_percent[i] * sip->shields / 100.0f) / MAX_SHIELD_SECTIONS; + objp->shields[i] = fval; } // for sanity, be sure that the number of susbystems that I read in matches the player. If not, @@ -7047,13 +7047,13 @@ void process_client_update_packet(ubyte *data, header *hinfo) for ( subsysp = GET_FIRST(&shipp->subsys_list); subsysp != END_OF_LIST(&shipp->subsys_list); subsysp = GET_NEXT(subsysp) ) { int subsys_type; - val = subsystem_percent[n_subsystems] * subsysp->system_info->max_hits / 100.0f; - subsysp->current_hits = val; + fval = subsystem_percent[n_subsystems] * subsysp->system_info->max_hits / 100.0f; + subsysp->current_hits = fval; // add the value just generated (it was zero'ed above) into the array of generic system types subsys_type = subsysp->system_info->type; // this is the generic type of subsystem SDL_assert ( subsys_type < SUBSYSTEM_MAX ); - shipp->subsys_info[subsys_type].current_hits += val; + shipp->subsys_info[subsys_type].current_hits += fval; n_subsystems++; } } diff --git a/src/network/multiui.cpp b/src/network/multiui.cpp index 91b57f3..c42bb65 100644 --- a/src/network/multiui.cpp +++ b/src/network/multiui.cpp @@ -7533,7 +7533,6 @@ void multi_jw_plist_process() // if the player has clicked somewhere in the player list area if(Multi_jw_plist_select_button.pressed()){ short player_id; - int player_index; player_id = multi_jw_get_mouse_id(); player_index = find_player_id(player_id); diff --git a/src/network/multiutil.cpp b/src/network/multiutil.cpp index 1e4fd0a..28ef914 100644 --- a/src/network/multiutil.cpp +++ b/src/network/multiutil.cpp @@ -1303,7 +1303,7 @@ void multi_unpack_orient_matrix(ubyte *data,matrix *m) m->v.fvec.xyz.y *= (data[16] & (1<<4)) ? -1.0f : 1.0f; } -void multi_do_client_warp(float flFrametime) +void multi_do_client_warp(float frametime) { ship_obj *moveup; @@ -1311,7 +1311,7 @@ void multi_do_client_warp(float flFrametime) while(moveup!=END_OF_LIST(&Ship_obj_list)){ // do all _necessary_ ship warp in (arrival) processing if ( Ships[Objects[moveup->objnum].instance].flags & SF_ARRIVING ) - shipfx_warpin_frame( &Objects[moveup->objnum], flFrametime ); + shipfx_warpin_frame( &Objects[moveup->objnum], frametime ); moveup = GET_NEXT(moveup); } } @@ -3869,7 +3869,6 @@ int multi_pack_unpack_vel( int write, ubyte *data, matrix *orient, vector *pos, return bitbuffer_write_flush(&buf); } else { // unpack velocity - float r, u, f; a = bitbuffer_get_signed(&buf,10); b = bitbuffer_get_signed(&buf,10); c = bitbuffer_get_signed(&buf,10); diff --git a/src/network/psnet2.cpp b/src/network/psnet2.cpp index 5ea26f1..9b5745c 100644 --- a/src/network/psnet2.cpp +++ b/src/network/psnet2.cpp @@ -2089,7 +2089,6 @@ unsigned int psnet_ras_status() for (i = 0; i < num_connections; i++ ) { RASCONNSTATUS status; - unsigned long size; ml_printf("Connection %d:", i); ml_printf("Entry Name: %s", rasbuffer[i].szEntryName); diff --git a/src/object/object.cpp b/src/object/object.cpp index 04bb827..edf50cb 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -1914,7 +1914,7 @@ void obj_client_simulate(float frametime) } #endif -void obj_observer_move(float flFrametime) +void obj_observer_move(float frametime) { object *objp; float ft; @@ -1931,9 +1931,9 @@ void obj_observer_move(float flFrametime) objp->last_pos = objp->pos; objp->last_orient = objp->orient; // save the orientation -- useful in multiplayer. - ft = flFrametime; + ft = frametime; obj_move_call_physics( objp, ft ); - obj_move_all_post(objp, flFrametime); + obj_move_all_post(objp, frametime); objp->flags &= ~OF_JUST_UPDATED; } diff --git a/src/parse/sexp.cpp b/src/parse/sexp.cpp index 5444c69..b237b69 100644 --- a/src/parse/sexp.cpp +++ b/src/parse/sexp.cpp @@ -1313,7 +1313,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, case OPF_AWACS_SUBSYSTEM: case OPF_SUBSYSTEM: { char *shipname; - int shipnum,ship_class, i; + int shipnum,ship_class; int ship_index; if (type2 != SEXP_ATOM_STRING){ @@ -1444,7 +1444,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, } if (Fred_running) { - int ship_num, ship2, i, w = 0, z; + int ship_num, ship2, w = 0; ship_num = ship_name_lookup(CTEXT(Sexp_nodes[op_index].rest)); if (ship_num < 0) { @@ -1678,7 +1678,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, return SEXP_CHECK_TYPE_MISMATCH; if (Fred_running) { - int ship_num, model, i, z; + int ship_num, model; z = find_parent_operator(op_index); ship_num = ship_name_lookup(CTEXT(Sexp_nodes[z].rest)); @@ -1706,7 +1706,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, return SEXP_CHECK_TYPE_MISMATCH; if (Fred_running) { - int ship_num, model, i, z; + int ship_num, model; ship_num = ship_name_lookup(CTEXT(Sexp_nodes[op_index].rest)); if (ship_num < 0) { diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 84331ae..98e1e6f 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -596,12 +596,12 @@ void particle_render_all() int framenum = p->optional_data; if ( p->nframes > 1 ) { - int n = fl2i(pct_complete * p->nframes + 0.5); + int f = fl2i(pct_complete * p->nframes + 0.5); - if ( n < 0 ) n = 0; - else if ( n > p->nframes-1 ) n = p->nframes-1; + if ( f < 0 ) f = 0; + else if ( f > p->nframes-1 ) f = p->nframes-1; - framenum += n; + framenum += f; } // set the bitmap diff --git a/src/playerman/managepilot.cpp b/src/playerman/managepilot.cpp index eceb280..61bad77 100644 --- a/src/playerman/managepilot.cpp +++ b/src/playerman/managepilot.cpp @@ -867,13 +867,13 @@ int read_pilot_file(const char *callsign, int single, player *p) Num_recent_missions = cfread_int( file ); SDL_assert(Num_recent_missions <= MAX_RECENT_MISSIONS); for ( i = 0; i < Num_recent_missions; i++ ) { - char *p; + char *c; cfread_string_len( Recent_missions[i], MAX_FILENAME_LEN, file); // Remove the extension - p = SDL_strchr(Recent_missions[i], '.'); - if (p) - *p = 0; + c = SDL_strchr(Recent_missions[i], '.'); + if (c) + *c = 0; } // use this block of stats from now on @@ -969,7 +969,7 @@ int read_pilot_file(const char *callsign, int single, player *p) return 0; } -void read_stats_block(CFILE *file, int Player_file_version, scoring_struct *stats) +void read_stats_block(CFILE *file, int file_version, scoring_struct *stats) { int i, total; @@ -979,7 +979,7 @@ void read_stats_block(CFILE *file, int Player_file_version, scoring_struct *stat stats->assists = cfread_int(file); #ifndef MAKE_FS1 - if (Player_file_version < 139) { + if (file_version < 139) { // support for FS2_DEMO pilots that still have FS1 medal info in the .plr files for (i=0; i < NUM_MEDALS_FS1; i++) { cfread_int(file); // dummy read diff --git a/src/playerman/playercontrol.cpp b/src/playerman/playercontrol.cpp index 701d3bf..1eef9c5 100644 --- a/src/playerman/playercontrol.cpp +++ b/src/playerman/playercontrol.cpp @@ -1870,6 +1870,7 @@ void player_generate_killer_weapon_name(int weapon_info_index, int killer_specie // a pointer to the text is returned char *player_generate_death_text( player *player_p, char *death_text, const int max_dtlen ) { + int ship_index; char weapon_name[NAME_LENGTH]; weapon_name[0] = 0; @@ -1888,7 +1889,6 @@ char *player_generate_death_text( player *player_p, char *death_text, const int SDL_assert(weapon_name[0]); // is this from a friendly ship? - int ship_index; ship_index = ship_name_lookup(player_p->killer_parent_name, 1); if((ship_index >= 0) && (Player_ship != NULL) && (Player_ship->team == Ships[ship_index].team)){ SDL_snprintf(death_text, max_dtlen, XSTR( "%s was killed by friendly fire from %s", 1338), player_p->callsign, player_p->killer_parent_name); @@ -1917,7 +1917,6 @@ char *player_generate_death_text( player *player_p, char *death_text, const int SDL_snprintf(death_text, max_dtlen, XSTR( "%s was killed by a beam from an unknown source", 1081), player_p->callsign); } else { // is this from a friendly ship? - int ship_index; ship_index = ship_name_lookup(player_p->killer_parent_name, 1); if((ship_index >= 0) && (Player_ship != NULL) && (Player_ship->team == Ships[ship_index].team)){ SDL_snprintf(death_text, max_dtlen, XSTR( "%s was destroyed by friendly beam fire from %s", 1339), player_p->callsign, player_p->killer_parent_name); diff --git a/src/ship/aicode.cpp b/src/ship/aicode.cpp index ac0065b..b7910d2 100644 --- a/src/ship/aicode.cpp +++ b/src/ship/aicode.cpp @@ -957,7 +957,7 @@ void garbage_collect_path_points() if ((aip->path_length > 0) && (aip->path_start > -1)) { - for (int i=aip->path_start; ipath_start + aip->path_length; i++) { + for (i=aip->path_start; ipath_start + aip->path_length; i++) { SDL_assert(pp_xlate[i] == 0); // If this is not 0, then two paths use this point! pp_xlate[i] = 1; } @@ -8419,9 +8419,10 @@ void ai_chase() if (!(En_objp->flags & OF_PROTECTED)) { ai_choose_secondary_weapon(Pl_objp, aip, En_objp); int current_bank = tswp->current_secondary_bank; - weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[tswp->current_secondary_bank]]; if (current_bank > -1) { + weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]]; + if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) { if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) { swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f)); @@ -8429,58 +8430,55 @@ void ai_chase() } if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) { - if (tswp->current_secondary_bank >= 0) { - weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[tswp->current_secondary_bank]]; - float firing_range; + float firing_range; - if (swip->wi_flags & WIF_BOMB) - firing_range = swip->max_speed * swip->lifetime * 0.75f; - else - firing_range = swip->max_speed * swip->lifetime * (Game_skill_level + 1 + aip->ai_class/2)/NUM_SKILL_LEVELS; - - // reduce firing range in nebula - extern int Nebula_sec_range; - if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) { - firing_range *= 0.8f; - } + if (swip->wi_flags & WIF_BOMB) + firing_range = swip->max_speed * swip->lifetime * 0.75f; + else + firing_range = swip->max_speed * swip->lifetime * (Game_skill_level + 1 + aip->ai_class/2)/NUM_SKILL_LEVELS; + + // reduce firing range in nebula + extern int Nebula_sec_range; + if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) { + firing_range *= 0.8f; + } - // If firing a spawn weapon, distance doesn't matter. - int spawn_fire = 0; + // If firing a spawn weapon, distance doesn't matter. + int spawn_fire = 0; - if (swip->wi_flags & WIF_SPAWN) { - int count; + if (swip->wi_flags & WIF_SPAWN) { + int count; - count = num_nearby_fighters(get_enemy_team_mask(OBJ_INDEX(Pl_objp)), &Pl_objp->pos, 1000.0f); + count = num_nearby_fighters(get_enemy_team_mask(OBJ_INDEX(Pl_objp)), &Pl_objp->pos, 1000.0f); - if (count > 3) - spawn_fire = 1; - else if (count >= 1) { - float hull_percent = Pl_objp->hull_strength/sip->initial_hull_strength; + if (count > 3) + spawn_fire = 1; + else if (count >= 1) { + float hull_percent = Pl_objp->hull_strength/sip->initial_hull_strength; - if (hull_percent < 0.01f) - hull_percent = 0.01f; + if (hull_percent < 0.01f) + hull_percent = 0.01f; - if (frand() < 0.25f/(30.0f*hull_percent) * count) // With timestamp below, this means could fire in 30 seconds if one enemy. - spawn_fire = 1; - } + if (frand() < 0.25f/(30.0f*hull_percent) * count) // With timestamp below, this means could fire in 30 seconds if one enemy. + spawn_fire = 1; } + } - if (spawn_fire || (dist_to_enemy < firing_range)) { - if (ai_fire_secondary_weapon(Pl_objp)) { - // Only if weapon was fired do we specify time until next fire. If not fired, done in ai_fire_secondary... - float t; + if (spawn_fire || (dist_to_enemy < firing_range)) { + if (ai_fire_secondary_weapon(Pl_objp)) { + // Only if weapon was fired do we specify time until next fire. If not fired, done in ai_fire_secondary... + float t; - if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) { - t = swip->fire_wait; - } else { - t = set_secondary_fire_delay(aip, temp_shipp, swip); - } - //nprintf(("AI", "Next secondary to be fired in %7.3f seconds.\n", t)); - swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f)); + if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) { + t = swip->fire_wait; + } else { + t = set_secondary_fire_delay(aip, temp_shipp, swip); } - } else { - swp->next_secondary_fire_stamp[current_bank] = timestamp(250); + //nprintf(("AI", "Next secondary to be fired in %7.3f seconds.\n", t)); + swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f)); } + } else { + swp->next_secondary_fire_stamp[current_bank] = timestamp(250); } } } @@ -10174,7 +10172,6 @@ void ai_dock() float dist = dock_orient_and_approach(Pl_objp, &Objects[aip->goal_objnum], DOA_DOCK); SDL_assert(dist != UNINITIALIZED_VALUE); - object *goal_objp = &Objects[aip->goal_objnum]; SDL_assert(goal_objp->type == OBJ_SHIP); ship *goal_shipp = &Ships[goal_objp->instance]; ai_info *goal_aip = &Ai_info[goal_shipp->ai_index]; @@ -12018,9 +12015,6 @@ void ai_maybe_launch_cmeasure(object *objp, ai_info *aip) aip->nearest_locked_distance = dist; // Verify that this object is really homing on us. - object *weapon_objp; - - weapon_objp = &Objects[aip->nearest_locked_object]; float fire_chance; @@ -13083,9 +13077,6 @@ void ai_maybe_warp_out(object *objp) return; if (!(shipp->flags & SF_DEPARTING)) { - ship_info *sip; - - sip = &Ship_info[shipp->ship_info_index]; if (sip->flags & (SIF_FIGHTER | SIF_BOMBER)) { if (aip->warp_out_timestamp == 0) { //if (ship_get_subsystem_strength(shipp, SUBSYSTEM_WEAPONS) == 0.0f) { diff --git a/src/ship/ship.cpp b/src/ship/ship.cpp index 94c91d3..318161b 100644 --- a/src/ship/ship.cpp +++ b/src/ship/ship.cpp @@ -5278,7 +5278,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) if ( obj == Player_obj ) { if ( winfo_p->launch_snd != -1 ) { weapon_info *wip; - ship_weapon *swp; + ship_weapon *swp2; // HACK if(winfo_p->launch_snd == SND_AUTOCANNON_SHOT){ @@ -5288,9 +5288,9 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) } // snd_play( &Snds[winfo_p->launch_snd] ); - swp = &Player_ship->weapons; - if (swp->current_primary_bank >= 0) { - wip = &Weapon_info[swp->primary_bank_weapons[swp->current_primary_bank]]; + swp2 = &Player_ship->weapons; + if (swp2->current_primary_bank >= 0) { + wip = &Weapon_info[swp->primary_bank_weapons[swp2->current_primary_bank]]; joy_ff_play_primary_shoot((int) ((wip->armor_factor + wip->shield_factor * 0.2f) * (wip->damage * wip->damage - 7.5f) * 0.45f + 0.6f) * 10 + 2000); } } @@ -5826,17 +5826,17 @@ int ship_fire_secondary( object *obj, int allow_swarm ) if ( obj == Player_obj ) { if ( Weapon_info[weapon].launch_snd != -1 ) { - weapon_info *wip; - ship_weapon *swp; + weapon_info *wip2; + ship_weapon *swp2; snd_play( &Snds[Weapon_info[weapon].launch_snd], 0.0f, 1.0f, SND_PRIORITY_MUST_PLAY ); - swp = &Player_ship->weapons; - if (swp->current_secondary_bank >= 0) { - wip = &Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]]; + swp2 = &Player_ship->weapons; + if (swp2->current_secondary_bank >= 0) { + wip2 = &Weapon_info[swp2->secondary_bank_weapons[swp2->current_secondary_bank]]; if (Player_ship->flags & SF_SECONDARY_DUAL_FIRE){ - joy_ff_play_secondary_shoot((int) (wip->cargo_size * 2.0f)); + joy_ff_play_secondary_shoot((int) (wip2->cargo_size * 2.0f)); } else { - joy_ff_play_secondary_shoot((int) wip->cargo_size); + joy_ff_play_secondary_shoot((int) wip2->cargo_size); } } } @@ -9421,7 +9421,6 @@ void ship_update_artillery_lock() HUD_printf("Firing artillery"); - vector temp; vm_vec_unrotate(&temp, &aip->artillery_lock_pos, &Objects[aip->artillery_objnum].orient); vm_vec_add2(&temp, &Objects[aip->artillery_objnum].pos); ssm_create(&temp, &Objects[so->objnum].pos, 0, NULL); diff --git a/src/ship/shiphit.cpp b/src/ship/shiphit.cpp index 6b215ef..6d853ec 100644 --- a/src/ship/shiphit.cpp +++ b/src/ship/shiphit.cpp @@ -554,7 +554,7 @@ void do_subobj_destroyed_stuff( ship *ship_p, ship_subsys *subsys, vector* hitpo vector temp_vec, center_to_subsys, rand_vec; vm_vec_sub(¢er_to_subsys, &g_subobj_pos, &objp->pos); - for (int i=0; i -1) { - int w; + int width; if (flags & UI_INPUTBOX_FLAG_PASSWD) { - gr_get_string_size(&w, NULL, passwd_text); + gr_get_string_size(&width, NULL, passwd_text); } else { - gr_get_string_size(&w, NULL, text); + gr_get_string_size(&width, NULL, text); } - if (w > pixel_limit) { + if (width > pixel_limit) { position--; locked = 1; text[position] = 0; diff --git a/src/ui/window.cpp b/src/ui/window.cpp index 886a098..52cc5de 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -490,10 +490,10 @@ void UI_WINDOW::draw_tooltip() void UI_WINDOW::render_tooltip(const char *str) { - int w, h; + int width, height; - gr_get_string_size(&w, &h, str); - SDL_assert(w < gr_screen.max_w - 4 && h < gr_screen.max_h - 4); + gr_get_string_size(&width, &height, str); + SDL_assert(width < gr_screen.max_w - 4 && height < gr_screen.max_h - 4); if (ttx < 2) ttx = 2; @@ -501,14 +501,14 @@ void UI_WINDOW::render_tooltip(const char *str) if (tty < 2) tty = 2; - if (ttx + w + 2 > gr_screen.max_w) - ttx = gr_screen.max_w - w; + if (ttx + width + 2 > gr_screen.max_w) + ttx = gr_screen.max_w - width; - if (tty + h + 2 > gr_screen.max_h) - tty = gr_screen.max_h - h; + if (tty + height + 2 > gr_screen.max_h) + tty = gr_screen.max_h - height; gr_set_color_fast(&Color_black); - gr_rect(ttx - 1, tty - 1, w + 2, h + 1); + gr_rect(ttx - 1, tty - 1, width + 2, height + 1); gr_set_color_fast(&Color_bright_white); gr_string(ttx, tty, str); @@ -596,7 +596,7 @@ void UI_WINDOW::add_XSTR(const char *string, int _xstr_id, int _x, int _y, UI_GA { int idx; int found = -1; - UI_XSTR *x; + UI_XSTR *xp; // try and find a free xstr for(idx=0; idxxstr = strdup(string); - if(x->xstr == NULL){ - free(x); + xp->xstr = strdup(string); + if(xp->xstr == NULL){ + free(xp); xstrs[idx] = NULL; return; } - x->xstr_id = _xstr_id; - x->x = _x; - x->y = _y; - x->assoc = _assoc; - x->font_id = _font_id; - x->clr = _color_type; - SDL_assert((x->clr >= 0) && (x->clr < UI_NUM_XSTR_COLORS)); - if((x->clr < 0) || (x->clr >= UI_NUM_XSTR_COLORS)){ - x->clr = 0; + xp->xstr_id = _xstr_id; + xp->x = _x; + xp->y = _y; + xp->assoc = _assoc; + xp->font_id = _font_id; + xp->clr = _color_type; + SDL_assert((xp->clr >= 0) && (xp->clr < UI_NUM_XSTR_COLORS)); + if((xp->clr < 0) || (xp->clr >= UI_NUM_XSTR_COLORS)){ + xp->clr = 0; } } @@ -642,7 +642,7 @@ void UI_WINDOW::add_XSTR(UI_XSTR *xstr) { int idx; int found = -1; - UI_XSTR *x; + UI_XSTR *xp; // try and find a free xstr for(idx=0; idxxstr = strdup(xstr->xstr); - if(x->xstr == NULL){ - free(x); + xp->xstr = strdup(xstr->xstr); + if(xp->xstr == NULL){ + free(xp); xstrs[idx] = NULL; return; } - x->xstr_id = xstr->xstr_id; - x->x = xstr->x; - x->y = xstr->y; - x->assoc = xstr->assoc; - x->font_id = xstr->font_id; - x->clr = xstr->clr; - SDL_assert((x->clr >= 0) && (x->clr < UI_NUM_XSTR_COLORS)); - if((x->clr < 0) || (x->clr >= UI_NUM_XSTR_COLORS)){ - x->clr = 0; + xp->xstr_id = xstr->xstr_id; + xp->x = xstr->x; + xp->y = xstr->y; + xp->assoc = xstr->assoc; + xp->font_id = xstr->font_id; + xp->clr = xstr->clr; + SDL_assert((xp->clr >= 0) && (xp->clr < UI_NUM_XSTR_COLORS)); + if((xp->clr < 0) || (xp->clr >= UI_NUM_XSTR_COLORS)){ + xp->clr = 0; } } -void UI_WINDOW::draw_one_xstr(UI_XSTR *x, int frame) +void UI_WINDOW::draw_one_xstr(UI_XSTR *xp, int frame) { font *f_backup = NULL; char str[255] = ""; // sanity - if((x == NULL) || (x->xstr == NULL)){ + if((xp == NULL) || (xp->xstr == NULL)){ return; } // if it has an associated gadet that is hidden, do nothing - if((x->assoc != NULL) && (x->assoc->hidden)){ + if((xp->assoc != NULL) && (xp->assoc->hidden)){ return; } // maybe set the font - if(x->font_id >= 0){ + if(xp->font_id >= 0){ // backup the current font SDL_assert(Current_font != NULL); f_backup = Current_font; // set the new font - gr_set_font(x->font_id); + gr_set_font(xp->font_id); } // set the color - if(x->assoc == NULL){ + if(xp->assoc == NULL){ gr_set_color_fast(&Color_normal); } else { // just buttons for now - switch(x->assoc->kind){ + switch(xp->assoc->kind){ case UI_KIND_BUTTON: // override case if((frame != -1) && (frame < 3)){ - gr_set_color_fast(Xstr_colors[x->clr][frame]); + gr_set_color_fast(Xstr_colors[xp->clr][frame]); } // normal checking else { // if the button is pressed - if(((UI_BUTTON*)x->assoc)->button_down()){ - gr_set_color_fast(Xstr_colors[x->clr][2]); + if(((UI_BUTTON*)xp->assoc)->button_down()){ + gr_set_color_fast(Xstr_colors[xp->clr][2]); } // if the mouse is just over it - else if(x->assoc->is_mouse_on()){ - gr_set_color_fast(Xstr_colors[x->clr][1]); + else if(xp->assoc->is_mouse_on()){ + gr_set_color_fast(Xstr_colors[xp->clr][1]); } else { - gr_set_color_fast(Xstr_colors[x->clr][0]); + gr_set_color_fast(Xstr_colors[xp->clr][0]); } break; } @@ -739,28 +739,28 @@ void UI_WINDOW::draw_one_xstr(UI_XSTR *x, int frame) // all other controls just draw the normal frame default : if((frame != -1) && (frame < 3)){ - gr_set_color_fast(Xstr_colors[x->clr][frame]); + gr_set_color_fast(Xstr_colors[xp->clr][frame]); } else { - gr_set_color_fast(Xstr_colors[x->clr][0]); + gr_set_color_fast(Xstr_colors[xp->clr][0]); } break; } // if the gadget disabled, just draw the normal nonhighlighted frame - if(x->assoc->disabled()){ - gr_set_color_fast(Xstr_colors[x->clr][0]); + if(xp->assoc->disabled()){ + gr_set_color_fast(Xstr_colors[xp->clr][0]); } } // print this puppy out - int xoffset = lcl_get_xstr_offset(x->xstr_id, gr_screen.res); - SDL_strlcpy(str, XSTR(x->xstr, x->xstr_id), SDL_arraysize(str)); + int xoffset = lcl_get_xstr_offset(xp->xstr_id, gr_screen.res); + SDL_strlcpy(str, XSTR(xp->xstr, xp->xstr_id), SDL_arraysize(str)); if(str[0] == '&'){ if(strlen(str) > 1){ - gr_string((x->x) + xoffset, x->y, str + 1); + gr_string((xp->x) + xoffset, xp->y, str + 1); } } else { - gr_string((x->x) + xoffset, x->y, str); + gr_string((xp->x) + xoffset, xp->y, str); } // maybe restore the old font diff --git a/src/weapon/beam.cpp b/src/weapon/beam.cpp index e2d9fe5..72d134a 100644 --- a/src/weapon/beam.cpp +++ b/src/weapon/beam.cpp @@ -3083,9 +3083,12 @@ void beam_test(int whee) int s1, s2; object *orion, *fenris; ship_subsys *lookup; - ship_subsys *orion_turret = NULL, *orion_radar = NULL; - ship_subsys *fenris_turret = NULL, *fenris_radar = NULL; + ship_subsys *orion_turret = NULL; + ship_subsys *fenris_turret = NULL; beam_fire_info f; +#ifndef NDEBUG + ship_subsys *orion_radar = NULL, *fenris_radar = NULL; +#endif nprintf(("General", "Running beam test\n")); @@ -3115,7 +3118,7 @@ void beam_test(int whee) lookup = GET_NEXT(lookup); } SDL_assert(orion_turret != NULL); - SDL_assert(orion_radar != NULL); + lookup = GET_FIRST(&Ships[s2].subsys_list); while(lookup != END_OF_LIST(&Ships[s2].subsys_list)){ // turret @@ -3133,7 +3136,11 @@ void beam_test(int whee) lookup = GET_NEXT(lookup); } SDL_assert(fenris_turret != NULL); + +#ifndef NDEBUG + SDL_assert(orion_radar != NULL); SDL_assert(fenris_radar != NULL); +#endif memset(&f, 0, sizeof(beam_fire_info)); f.accuracy = beam_accuracy; -- 2.39.2