Skip to content

Commit

Permalink
Merge pull request #645 from jengelh/master
Browse files Browse the repository at this point in the history
Resolve 3301 compiler warnings
  • Loading branch information
Lgt2x authored Nov 26, 2024
2 parents 1803f66 + 61439b3 commit 836dd4d
Show file tree
Hide file tree
Showing 191 changed files with 2,961 additions and 5,486 deletions.
12 changes: 6 additions & 6 deletions 2dlib/gr.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class grSurface {
// this is a software bitmap not video driver dependant
// ----------------------------------------------------------------------------

class grMemorySurface : public grSurface {
class grMemorySurface final : public grSurface {
bool m_FirstTimeInit; // do special stuff if we are initializing for first time
bool m_AllowInit; // we only allow initialization if we didn't create it.

Expand All @@ -375,11 +375,11 @@ class grMemorySurface : public grSurface {
// this is a hardware bitmap allocated from the video driver
// ----------------------------------------------------------------------------

class grHardwareSurface : public grSurface {
class grHardwareSurface final : public grSurface {
public:
grHardwareSurface();
grHardwareSurface() = default;
grHardwareSurface(int w, int h, int bpp, unsigned flags = 0, const char *name = NULL);
virtual ~grHardwareSurface();
virtual ~grHardwareSurface() = default;

bool create(int w, int h, int bpp, unsigned flags = 0, const char *name = NULL);
};
Expand All @@ -390,12 +390,12 @@ class grHardwareSurface : public grSurface {
// is used by the grViewport class to draw onto the screen
// ----------------------------------------------------------------------------

class grScreen : public grSurface {
class grScreen final : public grSurface {
friend class grViewport;

public:
grScreen(int w, int h, int bpp, const char *name = NULL);
virtual ~grScreen();
virtual ~grScreen() = default;

void flip();
};
Expand Down
4 changes: 0 additions & 4 deletions 2dlib/hardsurf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@
// constructor and destructor
// ----------------------------------------------------------------------------

grHardwareSurface::grHardwareSurface() : grSurface() {}

grHardwareSurface::grHardwareSurface(int w, int h, int bpp, unsigned flags, const char *name)
: grSurface(w, h, bpp, SURFTYPE_GENERIC, flags, name) {}

grHardwareSurface::~grHardwareSurface() {}

// ----------------------------------------------------------------------------
// initialize a hardware surface with these values
// ----------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions 2dlib/memsurf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ bool grMemorySurface::init(int w, int h, int bpp, char *data, int rowsize, unsig
// internal functions
// ---------------------------------------------------------------------------

static mem_bitmap grMemSurf_object;

bool gr_bm_mem_Blt16(ddgr_surface *dsf, int dx, int dy, ddgr_surface *ssf, int sx, int sy, int sw, int sh);
bool gr_bm_mem_Blt16ck(ddgr_surface *dsf, int dx, int dy, ddgr_surface *ssf, int sx, int sy, int sw, int sh);

Expand Down
1 change: 0 additions & 1 deletion 2dlib/pentext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@

#define STR_BUF_SIZE 512
static char Str_buf[STR_BUF_SIZE]; // String buffer for variable arguments
static char Draw_str_buf[STR_BUF_SIZE]; // used to buffer words in a string

// ---------------------------------------------------------------------------
// Viewport font and text funcitons
Expand Down
2 changes: 0 additions & 2 deletions 2dlib/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
grScreen::grScreen(int w, int h, int bpp, const char *name)
: grSurface(w, h, bpp, SURFTYPE_VIDEOSCREEN, SURFFLAG_BACKBUFFER, name) {}

grScreen::~grScreen() {}

// ---------------------------------------------------------------------------
// screen refresh routines
// ---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion AudioEncode/adecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using namespace AudioDecoder;

namespace {

class InternalAudioDecoder : public IAudioDecoder {
class InternalAudioDecoder final : public IAudioDecoder {
public:
InternalAudioDecoder(ReadDataFunction readerFunction, void *pReaderData);
~InternalAudioDecoder();
Expand Down
2 changes: 1 addition & 1 deletion AudioEncode/adecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace AudioDecoder {

class IAudioDecoder {
public:
virtual ~IAudioDecoder() {}
virtual ~IAudioDecoder() = default;

// Read data from the audio decoder.
// pBuffer: The buffer to receive the data from
Expand Down
3 changes: 0 additions & 3 deletions Descent3/AIGoal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,6 @@ void GoalClearAll(object *obj) {
int GoalAllocSlot(object *obj, int level, float influence) {
float lowest_influence_slot = -1.0;
float lowest_influence = MAX_INFLUENCE + 1.0;
int alloc_slot = AI_INVALID_INDEX;
ai_frame *ai_info = obj->ai_info;
int cur_slot;

Expand Down Expand Up @@ -1421,8 +1420,6 @@ bool GoalIsGoalEnabled(object *obj, int goal_index) {
if (cur_goal->flags & GF_OBJ_IS_TARGET) {
gobj = ObjGet(obj->ai_info->target_handle);
} else if (cur_goal->flags & (GF_OBJS_ARE_SPECIES | GF_OBJS_ARE_ENEMIES | GF_OBJS_ARE_FRIENDS)) {
bool done = false;

if (cur_goal->flags & (GF_OBJS_ARE_SPECIES | GF_OBJS_ARE_FRIENDS)) {
// chrishack -- not done
}
Expand Down
9 changes: 1 addition & 8 deletions Descent3/AImain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,6 @@ bool move_relative_object_vec(object *obj, vector *vec, object *target, float ci
vector from_target;
vector opposite_fvec;
vector goal_pos;
ai_frame *ai_info = obj->ai_info;
bool f_done = false;

from_target = obj->pos - target->pos;
Expand Down Expand Up @@ -2862,8 +2861,7 @@ void AISeeTarget(object *obj, bool f_see) {

// Note: Player position is also updated in the visibility test function
// for MIN_VIS_RECENT_CHECK_INTERVAL seconds
object *targetptr;
object *other_obj = targetptr = ObjGet(ai_info->target_handle);
object *targetptr = ObjGet(ai_info->target_handle);

if (targetptr) {
if (f_see)
Expand Down Expand Up @@ -4533,7 +4531,6 @@ void ai_move(object *obj) {
bool f_dodge = false; // Are there any dodge goals
bool f_avoid = false; // Are there any avoid goals
int highest_influence_goal = -1;
float highest_influence = 0.0f;
float highest_speed = 0.0f;
bool f_turned = true;
bool f_goal_found = false;
Expand Down Expand Up @@ -4814,8 +4811,6 @@ void ai_move(object *obj) {
bool f_orient = AITurnTowardsMatrix(obj, obj->ai_info->max_turn_rate, &orient);

if (f_at_pos && f_orient) {
int goal_index = cur_goal - ai_info->goals;

if (cur_goal->type == AIG_PLACE_OBJ_ON_OBJ) {
UnattachFromParent(child_obj);
AttachObject(g_obj, c_ap, child_obj, p_ap, true);
Expand Down Expand Up @@ -4850,8 +4845,6 @@ void ai_move(object *obj) {
}

if (f_at_pos) {
int goal_index = cur_goal - ai_info->goals;

AttachObject(obj, p_ap, g_obj, rad);

if (cur_goal->g_info.attach_info.flags & GAF_TEMP_CLEAR_ROBOT_COLLISIONS) {
Expand Down
1 change: 0 additions & 1 deletion Descent3/BOA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,6 @@ void ValidateRoomPathPoint(int room, char *message, int len) {
if (IsPathPointValid(room, &pos))
return;

bool f_found = false;
// vector best_pnt;
// float best_distance;

Expand Down
25 changes: 0 additions & 25 deletions Descent3/BriefingParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,6 @@
#include "pserror.h"
#include "voice.h"

// constructor
CBriefParse::CBriefParse() {
AddTextEffect = NULL;
AddBmpEffect = NULL;
AddMovieEffect = NULL;
AddBkgEffect = NULL;
AddPolyEffect = NULL;
AddSoundEffect = NULL;
AddButtonEffect = NULL;
StartScreen = NULL;
EndScreen = NULL;
LoopCallback = NULL;
SetTitle = NULL;
SetStatic = NULL;
SetGlitch = NULL;
AddVoice = NULL;
linenum = 0;
parse_error = false;
}

// destructor
CBriefParse::~CBriefParse() {}

// SetCallbacks
//
// Registers (or changes) the callbacks of the class
Expand Down Expand Up @@ -298,7 +275,6 @@ static int ReadFullLine(char **data, CFILE *ifile) {
// Parses the briefing file (calling the callbacks throughout), check return code
int CBriefParse::ParseBriefing(const char *filename) {
CFILE *ifile;
bool retvalue = false;
bool voice_def_screen = false;
char text_buf[8192], *text_ptr = NULL;
bool abort = 0;
Expand All @@ -308,7 +284,6 @@ int CBriefParse::ParseBriefing(const char *filename) {
int beffect = bfxNONE;
int x = 0, y = 0;
char filen[40];
bool emergency_exit = false;

// the following block of 'globals' are for when parsing a text block, the information is stored
// here until a $endtext is hit
Expand Down
34 changes: 16 additions & 18 deletions Descent3/BriefingParse.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,24 @@ struct tTextBufferDesc {

class CBriefParse {
public:
CBriefParse();
~CBriefParse();
void SetCallbacks(tBriefParseCallbacks *cb);
int ParseBriefing(const char *filename);

private:
void (*AddTextEffect)(TCTEXTDESC* desc, char *text, char *description, int id);
void (*AddBmpEffect)(TCBMPDESC* desc, char *description);
void (*AddMovieEffect)(TCMOVIEDESC* desc, char *description);
void (*AddBkgEffect)(TCBKGDESC* desc, char *description);
void (*AddPolyEffect)(TCPOLYDESC* desc, char *description);
void (*AddSoundEffect)(TCSNDDESC* desc, char *description);
void (*AddButtonEffect)(TCBUTTONDESC* desc, char *description, int id);
void (*StartScreen)(int screen_num, char *desc, char *layout, uint32_t mask_set, uint32_t mask_unset);
void (*EndScreen)();
bool (*LoopCallback)();
void (*SetTitle)(char *title);
void (*SetStatic)(float amount);
void (*SetGlitch)(float amount);
void (*AddVoice)(char *filename, int flags, char *description);
void (*AddTextEffect)(TCTEXTDESC* desc, char *text, char *description, int id) = nullptr;
void (*AddBmpEffect)(TCBMPDESC* desc, char *description) = nullptr;
void (*AddMovieEffect)(TCMOVIEDESC* desc, char *description) = nullptr;
void (*AddBkgEffect)(TCBKGDESC* desc, char *description) = nullptr;
void (*AddPolyEffect)(TCPOLYDESC* desc, char *description) = nullptr;
void (*AddSoundEffect)(TCSNDDESC* desc, char *description) = nullptr;
void (*AddButtonEffect)(TCBUTTONDESC* desc, char *description, int id) = nullptr;
void (*StartScreen)(int screen_num, char *desc, char *layout, uint32_t mask_set, uint32_t mask_unset) = nullptr;
void (*EndScreen)() = nullptr;
bool (*LoopCallback)() = nullptr;
void (*SetTitle)(char *title) = nullptr;
void (*SetStatic)(float amount) = nullptr;
void (*SetGlitch)(float amount) = nullptr;
void (*AddVoice)(char *filename, int flags, char *description) = nullptr;

void ParseError(const char *msg, const char *p = NULL);
const char *ParseComma(const char *p);
Expand All @@ -117,8 +115,8 @@ class CBriefParse {
bool ParseButtonEffect(const char *p);
bool ParseTextEffect(const char *p, tTextBufferDesc *tbd);

int linenum;
bool parse_error;
int linenum = 0;
bool parse_error = false;
};

#endif
4 changes: 1 addition & 3 deletions Descent3/Controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,7 @@ bool Control_poll_flag = false; // determines if system is polling controls now.
static bool Control_system_init = false;
static float Control_interval_time = 0.0f;
static float Control_current_time;
static float Control_frametime;
static float Key_pitch_ramp_time = 0.0f;
static float Key_heading_ramp_time = 0.0f;
// static float Control_frametime;

static tSensitivity Key_ramp;

Expand Down
12 changes: 6 additions & 6 deletions Descent3/Game2DLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ bool InitGameModule(const char *name, module *mod) {
// Clear out error queue
mod_GetLastError();
if (!mod_LoadModule(mod, tmp_dll_name)) {
int err = mod_GetLastError();
mod_GetLastError();
LOG_WARNING.printf("You are missing the DLL %s!", name);
return false;
}
Expand Down Expand Up @@ -640,7 +640,7 @@ int LoadGameDLL(const char *name, int num_teams_to_use) {
mod_GetLastError();
DLLGameInit = (DLLGameInit_fp)mod_GetSymbol(&GameDLLHandle, "DLLGameInit", 12);
if (!DLLGameInit) {
int err = mod_GetLastError();
mod_GetLastError();
LOG_FATAL << "Couldn't get a handle to the dll function DLLGameInit!";
Int3();
FreeGameDLL();
Expand All @@ -650,7 +650,7 @@ int LoadGameDLL(const char *name, int num_teams_to_use) {
mod_GetLastError();
DLLGameCall = (DLLGameCall_fp)mod_GetSymbol(&GameDLLHandle, "DLLGameCall", 8);
if (!DLLGameCall) {
int err = mod_GetLastError();
mod_GetLastError();
LOG_FATAL << "Couldn't get a handle to the dll function DLLGameCall!";
Int3();
FreeGameDLL();
Expand All @@ -660,7 +660,7 @@ int LoadGameDLL(const char *name, int num_teams_to_use) {
mod_GetLastError();
DLLGameClose = (DLLGameClose_fp)mod_GetSymbol(&GameDLLHandle, "DLLGameClose", 0);
if (!DLLGameClose) {
int err = mod_GetLastError();
mod_GetLastError();
LOG_FATAL << "Couldn't get a handle to the dll function DLLGameClose!";
Int3();
FreeGameDLL();
Expand All @@ -670,7 +670,7 @@ int LoadGameDLL(const char *name, int num_teams_to_use) {
mod_GetLastError();
DLLGetGameInfo = (DLLGetGameInfo_fp)mod_GetSymbol(&GameDLLHandle, "DLLGetGameInfo", 4);
if (!DLLGetGameInfo) {
int err = mod_GetLastError();
mod_GetLastError();
LOG_FATAL << "Couldn't get a handle to the dll function DLLGetGameInfo!";
Int3();
FreeGameDLL();
Expand Down Expand Up @@ -753,7 +753,7 @@ bool GetDLLGameInfo(const char *name, tDLLOptions *options) {
mod_GetLastError();
modGetGameInfo = (DLLGetGameInfo_fp)mod_GetSymbol(&mod, "DLLGetGameInfo", 4);
if (!modGetGameInfo) {
int err = mod_GetLastError();
mod_GetLastError();
LOG_FATAL << "Couldn't get a handle to the dll function DLLGetGameInfo!";
Int3();
CloseGameModule(&mod);
Expand Down
6 changes: 3 additions & 3 deletions Descent3/Inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ bool Inventory::AddObject(int object_handle, int flags, const char *description)

ASSERT(obj->type == OBJ_BUILDING || obj->type == OBJ_ROBOT || obj->type == OBJ_POWERUP || obj->type == OBJ_CLUTTER);

inven_item *current = root, *prev = root, *newnode;
inven_item *prev = root, *newnode;

if (count == 0) {
// there are no items in the list...time to add
Expand Down Expand Up @@ -531,7 +531,7 @@ bool Inventory::AddCounterMeasure(int id, int aux_type, int aux_id, int flags, c
return false;
}

inven_item *current = root, *prev = root, *newnode;
inven_item *prev = root, *newnode;

if (count == 0) {
// there are no items in the list...time to add
Expand Down Expand Up @@ -606,7 +606,7 @@ bool Inventory::AddObjectItem(int otype, int oid, int oauxt, int oauxi, int flag
if (count >= MAX_UNIQUE_INVEN_ITEMS)
return false;

inven_item *current = root, *prev = root, *newnode;
inven_item *prev = root, *newnode;

if (count == 0) {
// there are no items in the list...time to add
Expand Down
2 changes: 0 additions & 2 deletions Descent3/LoadLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3686,13 +3686,11 @@ extern bool Disable_editor_rendering;
// Returns 1 if file read ok, else 0
int LoadLevel(char *filename, void (*cb_fn)(const char *, int, int)) {
CFILE *ifile;
char tag[4];
int n, i, retval = 1;

int version;
bool f_read_AABB = false;
bool no_128s = true;
int total = 0;
#ifdef EDITOR
Disable_editor_rendering = 1;
Num_failed_xlate_items = 0;
Expand Down
2 changes: 0 additions & 2 deletions Descent3/Mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,6 @@ bool LoadMission(const char *mssn) {

void FreeMission() {
// Free up mission script
int i; //,j;
// close MN3 file if there is one.
mn3_Close();
// Tell Osiris to shutdown the Osiris Mission Memory System, freeing all memory
Expand Down Expand Up @@ -1265,7 +1264,6 @@ bool LoadMissionLevel(int level) {
}
// Test to see if levels are valid
bool boa = true, terrain = true;
char str[255];

if (BOAGetMineChecksum() != BOA_vis_checksum)
boa = false;
Expand Down
2 changes: 0 additions & 2 deletions Descent3/ObjInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,6 @@ int ObjInitFireball(object *objp) {
}
int ObjInitMarker(object *objp) {
int ret = 1;
static int first = 1;
static int polynum = -1;
ASSERT(objp->type == OBJ_MARKER);
// Set size & shields
objp->shields = 100;
Expand Down
Loading

0 comments on commit 836dd4d

Please sign in to comment.