diff options
author | Littleboy | 2012-07-14 14:02:44 -0400 |
---|---|---|
committer | Littleboy | 2012-07-14 14:26:00 -0400 |
commit | 0635d99ec74ad431146e14aba4ad07a5f9e7e221 (patch) | |
tree | 8b4958d1c162be31c93b0d700cf56192f264dfed /engines/lastexpress/data | |
parent | 732a2c80ddde4cf0ffd1b1742f514ae940c5301d (diff) | |
download | scummvm-rg350-0635d99ec74ad431146e14aba4ad07a5f9e7e221.tar.gz scummvm-rg350-0635d99ec74ad431146e14aba4ad07a5f9e7e221.tar.bz2 scummvm-rg350-0635d99ec74ad431146e14aba4ad07a5f9e7e221.zip |
LASTEXPRESS: Cleanup
- Add missing initializer/destructors
- Add some const modifiers
- Remove some unneeded casts
- Use enumeration values in switch constructs
Diffstat (limited to 'engines/lastexpress/data')
-rw-r--r-- | engines/lastexpress/data/cursor.cpp | 2 | ||||
-rw-r--r-- | engines/lastexpress/data/scene.cpp | 12 | ||||
-rw-r--r-- | engines/lastexpress/data/snd.cpp | 9 | ||||
-rw-r--r-- | engines/lastexpress/data/subtitle.cpp | 2 |
4 files changed, 16 insertions, 9 deletions
diff --git a/engines/lastexpress/data/cursor.cpp b/engines/lastexpress/data/cursor.cpp index 205c46f667..d176d963d1 100644 --- a/engines/lastexpress/data/cursor.cpp +++ b/engines/lastexpress/data/cursor.cpp @@ -128,7 +128,7 @@ Common::Rect Icon::draw(Graphics::Surface *surface) { for (int i = 0; i < 32; i++) { // Adjust brightness - if (_brightnessIndex == -1) + if (_brightnessIndex == -1 || _brightnessIndex >= ARRAYSIZE(brigthnessData)) *s = *image; else *s = (*image & brigthnessData[_brightnessIndex]) >> _brightnessIndex; diff --git a/engines/lastexpress/data/scene.cpp b/engines/lastexpress/data/scene.cpp index 79683d8067..fdb1ac6d46 100644 --- a/engines/lastexpress/data/scene.cpp +++ b/engines/lastexpress/data/scene.cpp @@ -121,7 +121,7 @@ bool SceneHotspot::isInside(const Common::Point &point) { // Scene Scene::~Scene() { // Free the hotspots - for (int i = 0; i < (int)_hotspots.size(); i++) + for (uint i = 0; i < _hotspots.size(); i++) delete _hotspots[i]; } @@ -171,7 +171,7 @@ bool Scene::checkHotSpot(const Common::Point &coord, SceneHotspot **hotspot) { bool found = false; int _location = 0; - for (int i = 0; i < (int)_hotspots.size(); i++) { + for (uint i = 0; i < _hotspots.size(); i++) { if (_hotspots[i]->isInside(coord)) { if (_location <= _hotspots[i]->location) { _location = _hotspots[i]->location; @@ -223,7 +223,7 @@ Common::String Scene::toString() { // Hotspots if (_hotspots.size() != 0) { output += "\nHotspots:\n"; - for (int i = 0; i < (int)_hotspots.size(); i++) + for (uint i = 0; i < _hotspots.size(); i++) output += _hotspots[i]->toString() + "\n"; } @@ -240,7 +240,7 @@ SceneLoader::~SceneLoader() { void SceneLoader::clear() { // Remove all scenes - for (int i = 0; i < (int)_scenes.size(); i++) + for (uint i = 0; i < _scenes.size(); i++) delete _scenes[i]; _scenes.clear(); @@ -291,9 +291,9 @@ Scene *SceneLoader::get(SceneIndex index) { return NULL; // Load the hotspots if needed - _scenes[(int)index]->loadHotspots(_stream); + _scenes[(uint)index]->loadHotspots(_stream); - return _scenes[(int)index]; + return _scenes[(uint)index]; } } // End of namespace LastExpress diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp index 5010d6e763..6d64f6b82c 100644 --- a/engines/lastexpress/data/snd.cpp +++ b/engines/lastexpress/data/snd.cpp @@ -356,6 +356,8 @@ public: Audio::ADPCMStream(stream, disposeAfterUse, size, 44100, 1, blockSize) { _currentFilterId = -1; _nextFilterId = filterId; + _stepAdjust1 = 0; + _stepAdjust2 = 0; } int readBuffer(int16 *buffer, const int numSamples) { @@ -453,7 +455,9 @@ void SimpleSound::play(Audio::AudioStream *as) { ////////////////////////////////////////////////////////////////////////// StreamedSound::StreamedSound() : _as(NULL), _loaded(false) {} -StreamedSound::~StreamedSound() {} +StreamedSound::~StreamedSound() { + _as = NULL; +} bool StreamedSound::load(Common::SeekableReadStream *stream, int32 filterId) { if (!stream) @@ -482,6 +486,9 @@ bool StreamedSound::isFinished() { } void StreamedSound::setFilterId(int32 filterId) { + if (_as == NULL) + return; + ((LastExpress_ADPCMStream *)_as)->setFilterId(filterId); } diff --git a/engines/lastexpress/data/subtitle.cpp b/engines/lastexpress/data/subtitle.cpp index 9918cf7689..a9a8284588 100644 --- a/engines/lastexpress/data/subtitle.cpp +++ b/engines/lastexpress/data/subtitle.cpp @@ -150,7 +150,7 @@ SubtitleManager::~SubtitleManager() { } void SubtitleManager::reset() { - for (int i = 0; i < (int)_subtitles.size(); i++) + for (uint i = 0; i < _subtitles.size(); i++) delete _subtitles[i]; _subtitles.clear(); |