Effective C++ violations being weeded out.

Not yet below 40K.
This commit is contained in:
Jason Felds
2011-03-14 13:40:38 -04:00
parent c5fda59080
commit 61d36671da
7 changed files with 58 additions and 75 deletions
+25 -21
View File
@@ -71,6 +71,7 @@ enum PixelFormat
}; };
const RString& PixelFormatToString( PixelFormat i ); const RString& PixelFormatToString( PixelFormat i );
/** @brief The parameters used for the present Video Mode. */
class VideoModeParams class VideoModeParams
{ {
public: public:
@@ -91,24 +92,27 @@ public:
RString sIconFile_, RString sIconFile_,
bool PAL_, bool PAL_,
float fDisplayAspectRatio_ float fDisplayAspectRatio_
) ):
{ windowed(windowed_),
windowed = windowed_; width(width_),
width = width_; height(height_),
height = height_; bpp(bpp_),
bpp = bpp_; rate(rate_),
rate = rate_; vsync(vsync_),
vsync = vsync_; interlaced(interlaced_),
interlaced = interlaced_; bSmoothLines(bSmoothLines_),
bSmoothLines = bSmoothLines_; bTrilinearFiltering(bTrilinearFiltering_),
bTrilinearFiltering = bTrilinearFiltering_; bAnisotropicFiltering(bAnisotropicFiltering_),
bAnisotropicFiltering = bAnisotropicFiltering_; sWindowTitle(sWindowTitle_),
sWindowTitle = sWindowTitle_; sIconFile(sIconFile_),
sIconFile = sIconFile_; PAL(PAL_),
PAL = PAL_; fDisplayAspectRatio(fDisplayAspectRatio_) {}
fDisplayAspectRatio = fDisplayAspectRatio_;
} VideoModeParams(): windowed(false), width(0), height(0),
VideoModeParams() {} bpp(0), rate(0), vsync(false), interlaced(false),
bSmoothLines(false), bTrilinearFiltering(false),
bAnisotropicFiltering(false), sWindowTitle(RString()),
sIconFile(RString()), PAL(false), fDisplayAspectRatio(0.0) {}
bool windowed; bool windowed;
int width; int width;
@@ -116,14 +120,14 @@ public:
int bpp; int bpp;
int rate; int rate;
bool vsync; bool vsync;
bool interlaced;
bool bSmoothLines; bool bSmoothLines;
bool bTrilinearFiltering; bool bTrilinearFiltering;
bool bAnisotropicFiltering; bool bAnisotropicFiltering;
bool interlaced;
bool PAL;
float fDisplayAspectRatio;
RString sWindowTitle; RString sWindowTitle;
RString sIconFile; RString sIconFile;
bool PAL;
float fDisplayAspectRatio;
}; };
struct RenderTargetParam struct RenderTargetParam
+10 -13
View File
@@ -60,11 +60,8 @@ inline bool IsMouse( InputDevice id ) { return id == DEVICE_MOUSE; }
struct InputDeviceInfo struct InputDeviceInfo
{ {
InputDeviceInfo( InputDevice id_, RString sDesc_ ) InputDeviceInfo( InputDevice id_, RString sDesc_ ):
{ id(id_), sDesc(sDesc_) {}
id = id_;
sDesc = sDesc_;
}
InputDevice id; InputDevice id;
RString sDesc; RString sDesc;
@@ -317,22 +314,22 @@ public:
* (0..1). This should be 0 for analog axes within the dead zone. */ * (0..1). This should be 0 for analog axes within the dead zone. */
float level; float level;
/* Whether this button is pressed. This is level with a threshold and
* debouncing applied. */
bool bDown;
// Mouse coordinates // Mouse coordinates
unsigned x; unsigned x;
unsigned y; unsigned y;
/* Whether this button is pressed. This is level with a threshold and
* debouncing applied. */
bool bDown;
RageTimer ts; RageTimer ts;
DeviceInput(): device(InputDevice_Invalid), button(DeviceButton_Invalid), level(0), bDown(false), ts(RageZeroTimer) { } DeviceInput(): device(InputDevice_Invalid), button(DeviceButton_Invalid), level(0), x(0), y(0), bDown(false), ts(RageZeroTimer) { }
DeviceInput( InputDevice d, DeviceButton b, float l=0 ): device(d), button(b), level(l), bDown(l > 0.5f), ts(RageZeroTimer) { } DeviceInput( InputDevice d, DeviceButton b, float l=0 ): device(d), button(b), level(l), x(0), y(0), bDown(l > 0.5f), ts(RageZeroTimer) { }
DeviceInput( InputDevice d, DeviceButton b, float l, const RageTimer &t ): DeviceInput( InputDevice d, DeviceButton b, float l, const RageTimer &t ):
device(d), button(b), level(l), bDown(level > 0.5f), ts(t) { } device(d), button(b), level(l), x(0), y(0), bDown(level > 0.5f), ts(t) { }
DeviceInput( InputDevice d, DeviceButton b, const RageTimer &t, unsigned xPos=0, unsigned yPos=0 ): DeviceInput( InputDevice d, DeviceButton b, const RageTimer &t, unsigned xPos=0, unsigned yPos=0 ):
device(d), button(b), x(xPos), y(yPos), bDown(false), ts(t) { } device(d), button(b), level(0), x(xPos), y(yPos), bDown(false), ts(t) { }
bool operator==( const DeviceInput &other ) const bool operator==( const DeviceInput &other ) const
{ {
+2 -7
View File
@@ -78,19 +78,14 @@ enum
WRITE_LOUD = 0x04 WRITE_LOUD = 0x04
}; };
RageLog::RageLog() RageLog::RageLog(): m_bLogToDisk(false), m_bInfoToDisk(false),
m_bUserLogToDisk(false), m_bFlush(false), m_bShowLogOutput(false)
{ {
g_fileLog = new RageFile; g_fileLog = new RageFile;
g_fileInfo = new RageFile; g_fileInfo = new RageFile;
g_fileUserLog = new RageFile; g_fileUserLog = new RageFile;
g_Mutex = new RageMutex( "Log" ); g_Mutex = new RageMutex( "Log" );
m_bLogToDisk = false;
m_bInfoToDisk = false;
m_bUserLogToDisk = false;
m_bFlush = false;
m_bShowLogOutput = false;
} }
RageLog::~RageLog() RageLog::~RageLog()
+7 -20
View File
@@ -39,19 +39,10 @@
#define samplerate() m_pSource->GetSampleRate() #define samplerate() m_pSource->GetSampleRate()
RageSoundParams::RageSoundParams(): RageSoundParams::RageSoundParams():
m_StartTime( RageZeroTimer ) m_StartSecond(0), m_LengthSeconds(-1), m_fFadeInSeconds(0),
{ m_fFadeOutSeconds(0), m_Volume(1.0f), m_fAttractVolume(1.0f),
m_StartSecond = 0; m_fPitch(1.0f), m_fSpeed(1.0f), m_StartTime( RageZeroTimer ),
m_LengthSeconds = -1; StopMode(M_AUTO), m_bIsCriticalSound(false) {}
m_fFadeInSeconds = 0;
m_fFadeOutSeconds = 0;
m_Volume = 1.0f;
m_fAttractVolume = 1.0f;
m_fPitch = 1.0f;
m_fSpeed = 1.0f;
StopMode = M_AUTO;
m_bIsCriticalSound = false;
}
RageSoundLoadParams::RageSoundLoadParams() RageSoundLoadParams::RageSoundLoadParams()
{ {
@@ -60,15 +51,11 @@ RageSoundLoadParams::RageSoundLoadParams()
} }
RageSound::RageSound(): RageSound::RageSound():
m_Mutex( "RageSound" ) m_Mutex( "RageSound" ), m_pSource(NULL), m_iStreamFrame(0),
m_iStoppedSourceFrame(0), m_bPlaying(false),
m_bDeleteWhenFinished(false)
{ {
ASSERT( SOUNDMAN ); ASSERT( SOUNDMAN );
m_pSource = NULL;
m_iStreamFrame = 0;
m_iStoppedSourceFrame = 0;
m_bPlaying = false;
m_bDeleteWhenFinished = false;
} }
RageSound::~RageSound() RageSound::~RageSound()
+10 -11
View File
@@ -22,7 +22,10 @@ public:
virtual RString GetLoadedFilePath() const = 0; virtual RString GetLoadedFilePath() const = 0;
}; };
/* These are parameters to play a sound. These are normally changed before playing begins, /**
* @brief The parameters to play a sound.
*
* These are normally changed before playing begins,
* and are constant from then on. */ * and are constant from then on. */
struct RageSoundParams struct RageSoundParams
{ {
@@ -50,17 +53,13 @@ struct RageSoundParams
* If zero, or if not supported, the sound will start immediately. */ * If zero, or if not supported, the sound will start immediately. */
RageTimer m_StartTime; RageTimer m_StartTime;
/* M_STOP stops the sound at the end. /** @brief How does the sound stop itself, if it does? */
* M_LOOP restarts.
* M_CONTINUE feeds silence, which is useful to continue timing longer than the actual sound.
* M_AUTO (default) stops, obeying filename hints.
*/
enum StopMode_t { enum StopMode_t {
M_STOP, M_STOP, /**< The sound is stopped at the end. */
M_LOOP, M_LOOP, /**< The sound restarts itself. */
M_CONTINUE, M_CONTINUE, /**< Silence is fed at the end to continue timing longer than the sound. */
M_AUTO M_AUTO /**< The default, the sound stops while obeying filename hints. */
} StopMode; } /** @brief How does the sound stop itself, if it does? */ StopMode;
bool m_bIsCriticalSound; // "is a sound that should be played even during attract" bool m_bIsCriticalSound; // "is a sound that should be played even during attract"
}; };
+1 -1
View File
@@ -6,7 +6,7 @@
class RageTimer class RageTimer
{ {
public: public:
RageTimer() { Touch(); } RageTimer(): m_secs(0), m_us(0) { Touch(); }
RageTimer( int secs, int us ): m_secs(secs), m_us(us) { } RageTimer( int secs, int us ): m_secs(secs), m_us(us) { }
/* Time ago this RageTimer represents. */ /* Time ago this RageTimer represents. */
+2 -1
View File
@@ -150,7 +150,8 @@ private:
float *m_BufferNext; // beginning of the unread data float *m_BufferNext; // beginning of the unread data
int m_FramesInBuffer; // total number of frames at m_BufferNext int m_FramesInBuffer; // total number of frames at m_BufferNext
int64_t m_iPosition; // stream frame of m_BufferNext int64_t m_iPosition; // stream frame of m_BufferNext
sound_block() { m_FramesInBuffer = 0; m_iPosition = 0; m_BufferNext = m_Buffer; } sound_block(): m_BufferNext(m_Buffer),
m_FramesInBuffer(0), m_iPosition(0) {}
}; };
struct Sound struct Sound