|
From: Lasse Kärkkäi. <tr...@us...> - 2011-07-06 23:35:13
|
Author: Tapio Vierros <tap...@gm...>
Date: Tue Mar 1 23:54:51 2011 +0200
Add quite a few missing const-qualifiers.
---
game/database.hh | 2 +-
game/ffmpeg.cc | 2 +-
game/ffmpeg.hh | 2 +-
game/joystick.hh | 14 +++++++-------
game/layout_singer.cc | 2 +-
game/layout_singer.hh | 2 +-
game/midifile.cc | 2 +-
game/opengl_text.hh | 8 ++++----
game/songparser-ini.cc | 2 +-
game/songparser-sm.cc | 2 +-
game/songparser-txt.cc | 2 +-
game/songparser.hh | 6 +++---
game/video_driver.cc | 2 +-
game/video_driver.hh | 2 +-
game/webcam.hh | 2 +-
15 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/game/database.hh b/game/database.hh
index 44f30fa..819f7ff 100644
--- a/game/database.hh
+++ b/game/database.hh
@@ -15,7 +15,7 @@ struct ScoreItem {
std::string track; // includes difficulty
std::string track_simple; // no difficulty
Color color;
- bool operator < (ScoreItem const& other) { return score < other.score; }
+ bool operator < (ScoreItem const& other) const { return score < other.score; }
};
/**Access to a database for performous which holds
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 7e1d129..1be7d7f 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -18,7 +18,7 @@ extern "C" {
/*static*/ boost::mutex FFmpeg::s_avcodec_mutex;
FFmpeg::FFmpeg(bool _decodeVideo, bool _decodeAudio, std::string const& _filename, unsigned int rate):
- m_filename(_filename), m_rate(rate), m_quit(), m_running(), m_eof(), m_seekTarget(getNaN()),
+ width(), height(), m_filename(_filename), m_rate(rate), m_quit(), m_running(), m_eof(), m_seekTarget(getNaN()),
pFormatCtx(), pResampleCtx(), img_convert_ctx(), pVideoCodecCtx(), pAudioCodecCtx(), pVideoCodec(), pAudioCodec(),
videoStream(-1), audioStream(-1), decodeVideo(_decodeVideo), decodeAudio(_decodeAudio), m_position(),
m_thread(new boost::thread(boost::ref(*this)))
diff --git a/game/ffmpeg.hh b/game/ffmpeg.hh
index a3b4388..8006df8 100644
--- a/game/ffmpeg.hh
+++ b/game/ffmpeg.hh
@@ -125,7 +125,7 @@ class AudioBuffer {
/// set samples per second
void setSamplesPerSecond(unsigned sps) { m_sps = sps; }
/// get samples per second
- unsigned getSamplesPerSecond() { return m_sps; }
+ unsigned getSamplesPerSecond() const { return m_sps; }
void push(std::vector<int16_t> const& data, double timestamp) {
boost::mutex::scoped_lock l(m_mutex);
while (!condition()) m_cond.wait(l);
diff --git a/game/joystick.hh b/game/joystick.hh
index 83623ee..44f82b8 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -113,13 +113,13 @@ namespace input {
m_pressed[i] = _event.pressed[i];
}
};
- void clearEvents() {m_events.clear();};
- void assign() {m_assigned = true;};
- void unassign() {m_assigned = false; clearEvents();};
- bool assigned() {return m_assigned;};
- bool pressed(int _button) {return m_pressed[_button];};
- std::string name() {return m_instrument.name;};
- bool type_match(DevType _type) {
+ void clearEvents() { m_events.clear(); }
+ void assign() { m_assigned = true; }
+ void unassign() { m_assigned = false; clearEvents(); }
+ bool assigned() const { return m_assigned; }
+ bool pressed(int _button) const { return m_pressed[_button]; }
+ std::string name() const { return m_instrument.name; }
+ bool type_match(DevType _type) const {
return _type == m_instrument.type;
};
int buttonFromSDL(unsigned int sdl_button) {
diff --git a/game/layout_singer.cc b/game/layout_singer.cc
index 625a824..09eac21 100644
--- a/game/layout_singer.cc
+++ b/game/layout_singer.cc
@@ -151,6 +151,6 @@ void LayoutSinger::draw(double time, Position position) {
if (!config["game/karaoke_mode"].b() ) drawScore(position); // draw score if not in karaoke mode
}
-double LayoutSinger::lyrics_begin() {
+double LayoutSinger::lyrics_begin() const {
return m_lyricit->begin;
}
diff --git a/game/layout_singer.hh b/game/layout_singer.hh
index b4f1b8f..1529aea 100644
--- a/game/layout_singer.hh
+++ b/game/layout_singer.hh
@@ -56,7 +56,7 @@ class LayoutSinger {
void reset();
void draw(double time, Position position = LayoutSinger::BOTTOM);
void drawScore(Position position);
- double lyrics_begin();
+ double lyrics_begin() const;
void hideLyrics(bool hide = true) { m_hideLyrics = hide; };
private:
VocalTrack& m_vocal;
diff --git a/game/midifile.cc b/game/midifile.cc
index 5272165..cb1c735 100644
--- a/game/midifile.cc
+++ b/game/midifile.cc
@@ -45,7 +45,7 @@ class MidiStream {
size_t offset;
Riff(MidiStream& ms);
~Riff();
- bool has_more_data() { return offset < size; }
+ bool has_more_data() const { return offset < size; }
uint8_t read_uint8() { consume(1); return ms.f.get(); }
uint16_t read_uint16() { consume(2); return ms.read_uint16(); }
uint32_t read_uint32() { consume(4); return ms.read_uint32(); }
diff --git a/game/opengl_text.hh b/game/opengl_text.hh
index 01847d7..9d96f93 100644
--- a/game/opengl_text.hh
+++ b/game/opengl_text.hh
@@ -49,13 +49,13 @@ class OpenGLText {
/// draws full texture
void draw();
/// @return x
- double x() {return m_x;};
+ double x() const { return m_x; }
/// @return y
- double y() {return m_y;};
+ double y() const { return m_y; }
/// @return x_advance
- double x_advance() {return m_x_advance;};
+ double x_advance() const { return m_x_advance; }
/// @return y_advance
- double y_advance() {return m_y_advance;};
+ double y_advance() const { return m_y_advance; }
/// @returns dimension of texture
Dimensions& dimensions() { return m_surface.dimensions; }
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 36e724b..38e163b 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -12,7 +12,7 @@
using namespace SongParserUtil;
/// 'Magick' to check if this file looks like correct format
-bool SongParser::iniCheck(std::vector<char> const& data) {
+bool SongParser::iniCheck(std::vector<char> const& data) const {
static const std::string header = "[song]";
return std::equal(header.begin(), header.end(), data.begin());
}
diff --git a/game/songparser-sm.cc b/game/songparser-sm.cc
index cb84732..a006b60 100644
--- a/game/songparser-sm.cc
+++ b/game/songparser-sm.cc
@@ -12,7 +12,7 @@
using namespace SongParserUtil;
/// 'Magick' to check if this file looks like correct format
-bool SongParser::smCheck(std::vector<char> const& data) {
+bool SongParser::smCheck(std::vector<char> const& data) const {
if (data[0] != '#' || data[1] < 'A' || data[1] > 'Z') return false;
for (std::vector<char>::const_iterator it = data.begin(); it != data.end(); ++it){
if (*it == '\n') return false;
diff --git a/game/songparser-txt.cc b/game/songparser-txt.cc
index 856ff9f..06221b3 100644
--- a/game/songparser-txt.cc
+++ b/game/songparser-txt.cc
@@ -11,7 +11,7 @@
using namespace SongParserUtil;
/// 'Magick' to check if this file looks like correct format
-bool SongParser::txtCheck(std::vector<char> const& data) {
+bool SongParser::txtCheck(std::vector<char> const& data) const {
return data[0] == '#' && data[1] >= 'A' && data[1] <= 'Z';
}
diff --git a/game/songparser.hh b/game/songparser.hh
index 601fbce..4232731 100644
--- a/game/songparser.hh
+++ b/game/songparser.hh
@@ -32,15 +32,15 @@ class SongParser {
double m_gap;
double m_bpm;
- bool txtCheck(std::vector<char> const& data);
+ bool txtCheck(std::vector<char> const& data) const;
void txtParseHeader();
void txtParse();
bool txtParseField(std::string const& line);
bool txtParseNote(std::string line, VocalTrack &vocal);
- bool iniCheck(std::vector<char> const& data);
+ bool iniCheck(std::vector<char> const& data) const;
void iniParseHeader();
void iniParse();
- bool smCheck(std::vector<char> const& data);
+ bool smCheck(std::vector<char> const& data) const;
void smParseHeader();
void smParse();
bool smParseField(std::string line);
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 4471648..21ed9ff 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -267,7 +267,7 @@ void Window::setFullscreen(bool _fs) {
resize();
}
-bool Window::getFullscreen() {
+bool Window::getFullscreen() const {
return m_fullscreen;
}
diff --git a/game/video_driver.hh b/game/video_driver.hh
index 3b5bd2d..c85cd8e 100644
--- a/game/video_driver.hh
+++ b/game/video_driver.hh
@@ -68,7 +68,7 @@ public:
*/
void setFullscreen(bool _fs);
/// gets fullscreen state
- bool getFullscreen();
+ bool getFullscreen() const;
/// take a screenshot
void screenshot();
diff --git a/game/webcam.hh b/game/webcam.hh
index 9566f2e..33e4358 100644
--- a/game/webcam.hh
+++ b/game/webcam.hh
@@ -30,7 +30,7 @@ class Webcam {
void operator()();
/// Is good?
- bool is_good() { return m_capture != 0 && m_running; }
+ bool is_good() const { return m_capture != 0 && m_running; }
/// When paused, does not get or render frames
void pause(bool do_pause = true);
/// Display frame
|