Skip to content

Commit

Permalink
d3: replace in-constructor assignments by initializations
Browse files Browse the repository at this point in the history
  • Loading branch information
jengelh committed Nov 3, 2024
1 parent a6d37b6 commit 46fcae0
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 60 deletions.
19 changes: 1 addition & 18 deletions Descent3/BriefingParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,7 @@
#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;
}
CBriefParse::CBriefParse() {}

// destructor
CBriefParse::~CBriefParse() {}
Expand Down
32 changes: 16 additions & 16 deletions Descent3/BriefingParse.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,20 @@ class CBriefParse {
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 +117,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
12 changes: 6 additions & 6 deletions Descent3/hud.h
Original file line number Diff line number Diff line change
Expand Up @@ -652,14 +652,14 @@ struct tMsgList {
//////////////////////////////////////////////////////////////////////////////

class MsgListConsole {
tMsgList *m_list;
tMsgList *m_list = nullptr;
int m_x, m_y, m_w, m_h;
int m_bufline, m_buflen, m_curmsgs, m_numlines;
bool m_opened;
char *m_buffer;
int m_bufline = 0, m_buflen, m_curmsgs, m_numlines;
bool m_opened = false;
char *m_buffer = nullptr;
char m_title[32];
char **m_conlines;
int n_conlines;
char **m_conlines = nullptr;
int n_conlines = 0;
int m_keydownstate; // -1 for up key, 1 for down key, 0 for none.
float m_keydowntime;

Expand Down
9 changes: 1 addition & 8 deletions Descent3/hudmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1604,14 +1604,7 @@ const char *tMsgList::get(int i) {

//////////////////////////////////////////////////////////////////////////////

MsgListConsole::MsgListConsole() {
m_opened = false;
m_list = NULL;
m_buffer = NULL;
m_bufline = 0;
m_conlines = NULL;
n_conlines = 0;
}
MsgListConsole::MsgListConsole() {}

MsgListConsole::~MsgListConsole() {}

Expand Down
4 changes: 2 additions & 2 deletions Descent3/mmItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ void MenuScene(); // display menu scene
class tmmItemQueue {
#define tmmItemSIZE 8
tmmItemFX m_items[tmmItemSIZE];
int16_t m_head, m_tail;
int16_t m_head = 0, m_tail = 0;

public:
tmmItemQueue() { m_head = m_tail = 0; };
tmmItemQueue() {};
~tmmItemQueue(){};
void send(tmmItemFX &item) { // sends an item onto the queue
int16_t temp = m_tail + 1;
Expand Down
9 changes: 3 additions & 6 deletions Descent3/pilot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1821,11 +1821,11 @@ class UIBmpWindow final : public UIStatic {

private:
void DrawBorder();
bool animated;
int bm_handle;
bool animated = false;
int bm_handle = -1;
float start_time;
UIText text;
bool created;
bool created = false;
};

// struct ship_pos
Expand Down Expand Up @@ -2957,10 +2957,7 @@ void UI3DWindow::OnDraw() {
}

UIBmpWindow::UIBmpWindow() {
animated = false;
bm_handle = -1;
start_time = timer_GetTime();
created = false;
}

UIBmpWindow::~UIBmpWindow() {}
Expand Down
4 changes: 2 additions & 2 deletions lib/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ const int OEAPP_WINDOWED = 1, // App will run in a window. May not be supported.
OEAPP_CONSOLE = 8; // App will run in a console style window.
class oeApplication {
protected:
bool m_AppActive;
bool m_AppActive = true;

public:
oeApplication() { m_AppActive = true; };
oeApplication() {};
virtual ~oeApplication(){};
// initializes the object
virtual void init() = 0;
Expand Down
4 changes: 2 additions & 2 deletions lib/psclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ template <class T> class tList {

template <class T, int t_LEN> class tQueue {
T m_items[t_LEN];
int16_t m_head, m_tail;
int16_t m_head = 0, m_tail = 0;

public:
tQueue() { m_head = m_tail = 0; };
tQueue() {};
~tQueue(){};

void send(T &item) { // sends an item onto the queue
Expand Down

0 comments on commit 46fcae0

Please sign in to comment.