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 );
/** @brief The parameters used for the present Video Mode. */
class VideoModeParams
{
public:
@@ -91,24 +92,27 @@ public:
RString sIconFile_,
bool PAL_,
float fDisplayAspectRatio_
)
{
windowed = windowed_;
width = width_;
height = height_;
bpp = bpp_;
rate = rate_;
vsync = vsync_;
interlaced = interlaced_;
bSmoothLines = bSmoothLines_;
bTrilinearFiltering = bTrilinearFiltering_;
bAnisotropicFiltering = bAnisotropicFiltering_;
sWindowTitle = sWindowTitle_;
sIconFile = sIconFile_;
PAL = PAL_;
fDisplayAspectRatio = fDisplayAspectRatio_;
}
VideoModeParams() {}
):
windowed(windowed_),
width(width_),
height(height_),
bpp(bpp_),
rate(rate_),
vsync(vsync_),
interlaced(interlaced_),
bSmoothLines(bSmoothLines_),
bTrilinearFiltering(bTrilinearFiltering_),
bAnisotropicFiltering(bAnisotropicFiltering_),
sWindowTitle(sWindowTitle_),
sIconFile(sIconFile_),
PAL(PAL_),
fDisplayAspectRatio(fDisplayAspectRatio_) {}
VideoModeParams(): windowed(false), width(0), height(0),
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;
int width;
@@ -116,14 +120,14 @@ public:
int bpp;
int rate;
bool vsync;
bool interlaced;
bool bSmoothLines;
bool bTrilinearFiltering;
bool bAnisotropicFiltering;
bool interlaced;
bool PAL;
float fDisplayAspectRatio;
RString sWindowTitle;
RString sIconFile;
bool PAL;
float fDisplayAspectRatio;
};
struct RenderTargetParam
+11 -14
View File
@@ -60,12 +60,9 @@ inline bool IsMouse( InputDevice id ) { return id == DEVICE_MOUSE; }
struct InputDeviceInfo
{
InputDeviceInfo( InputDevice id_, RString sDesc_ )
{
id = id_;
sDesc = sDesc_;
}
InputDeviceInfo( InputDevice id_, RString sDesc_ ):
id(id_), sDesc(sDesc_) {}
InputDevice id;
RString sDesc;
@@ -317,22 +314,22 @@ public:
* (0..1). This should be 0 for analog axes within the dead zone. */
float level;
/* Whether this button is pressed. This is level with a threshold and
* debouncing applied. */
bool bDown;
// Mouse coordinates
unsigned x;
unsigned y;
/* Whether this button is pressed. This is level with a threshold and
* debouncing applied. */
bool bDown;
RageTimer ts;
DeviceInput(): device(InputDevice_Invalid), button(DeviceButton_Invalid), level(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(): 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), x(0), y(0), bDown(l > 0.5f), ts(RageZeroTimer) { }
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 ):
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
{
+2 -7
View File
@@ -78,19 +78,14 @@ enum
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_fileInfo = new RageFile;
g_fileUserLog = new RageFile;
g_Mutex = new RageMutex( "Log" );
m_bLogToDisk = false;
m_bInfoToDisk = false;
m_bUserLogToDisk = false;
m_bFlush = false;
m_bShowLogOutput = false;
}
RageLog::~RageLog()
+7 -20
View File
@@ -39,19 +39,10 @@
#define samplerate() m_pSource->GetSampleRate()
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_fPitch = 1.0f;
m_fSpeed = 1.0f;
StopMode = M_AUTO;
m_bIsCriticalSound = false;
}
m_StartSecond(0), m_LengthSeconds(-1), m_fFadeInSeconds(0),
m_fFadeOutSeconds(0), m_Volume(1.0f), m_fAttractVolume(1.0f),
m_fPitch(1.0f), m_fSpeed(1.0f), m_StartTime( RageZeroTimer ),
StopMode(M_AUTO), m_bIsCriticalSound(false) {}
RageSoundLoadParams::RageSoundLoadParams()
{
@@ -60,15 +51,11 @@ RageSoundLoadParams::RageSoundLoadParams()
}
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 );
m_pSource = NULL;
m_iStreamFrame = 0;
m_iStoppedSourceFrame = 0;
m_bPlaying = false;
m_bDeleteWhenFinished = false;
}
RageSound::~RageSound()
+10 -11
View File
@@ -22,7 +22,10 @@ public:
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. */
struct RageSoundParams
{
@@ -50,17 +53,13 @@ struct RageSoundParams
* If zero, or if not supported, the sound will start immediately. */
RageTimer m_StartTime;
/* M_STOP stops the sound at the end.
* 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.
*/
/** @brief How does the sound stop itself, if it does? */
enum StopMode_t {
M_STOP,
M_LOOP,
M_CONTINUE,
M_AUTO
} StopMode;
M_STOP, /**< The sound is stopped at the end. */
M_LOOP, /**< The sound restarts itself. */
M_CONTINUE, /**< Silence is fed at the end to continue timing longer than the sound. */
M_AUTO /**< The default, the sound stops while obeying filename hints. */
} /** @brief How does the sound stop itself, if it does? */ StopMode;
bool m_bIsCriticalSound; // "is a sound that should be played even during attract"
};
+1 -1
View File
@@ -6,7 +6,7 @@
class RageTimer
{
public:
RageTimer() { Touch(); }
RageTimer(): m_secs(0), m_us(0) { Touch(); }
RageTimer( int secs, int us ): m_secs(secs), m_us(us) { }
/* Time ago this RageTimer represents. */
+2 -1
View File
@@ -150,7 +150,8 @@ private:
float *m_BufferNext; // beginning of the unread data
int m_FramesInBuffer; // total number of frames at 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