diff options
author | Einar Johan Trøan Sømåen | 2012-12-09 11:08:04 +0100 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-12-09 11:08:04 +0100 |
commit | 8d866683d90e69c3313fda5fed63679a603d2b45 (patch) | |
tree | 3f26ce7cff49e8629a29bea408a1c81146efe307 /engines/wintermute/base | |
parent | 517980d43e37a32f860448434b66ec5767ec5dfd (diff) | |
download | scummvm-rg350-8d866683d90e69c3313fda5fed63679a603d2b45.tar.gz scummvm-rg350-8d866683d90e69c3313fda5fed63679a603d2b45.tar.bz2 scummvm-rg350-8d866683d90e69c3313fda5fed63679a603d2b45.zip |
WINTERMUTE: Fix the rest of the Common:sort comparators.
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r-- | engines/wintermute/base/base_surface_storage.cpp | 19 | ||||
-rw-r--r-- | engines/wintermute/base/base_surface_storage.h | 2 | ||||
-rw-r--r-- | engines/wintermute/base/particles/part_emitter.cpp | 11 | ||||
-rw-r--r-- | engines/wintermute/base/particles/part_emitter.h | 2 |
4 files changed, 14 insertions, 20 deletions
diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp index 4e795ca813..2205e3e096 100644 --- a/engines/wintermute/base/base_surface_storage.cpp +++ b/engines/wintermute/base/base_surface_storage.cpp @@ -176,32 +176,29 @@ bool BaseSurfaceStorage::sortSurfaces() { ////////////////////////////////////////////////////////////////////////// -int BaseSurfaceStorage::surfaceSortCB(const void *arg1, const void *arg2) { - const BaseSurface *s1 = *((const BaseSurface *const *)arg1); - const BaseSurface *s2 = *((const BaseSurface *const *)arg2); - +bool BaseSurfaceStorage::surfaceSortCB(const BaseSurface *s1, const BaseSurface *s2) { // sort by life time if (s1->_lifeTime <= 0 && s2->_lifeTime > 0) { - return 1; + return false; } else if (s1->_lifeTime > 0 && s2->_lifeTime <= 0) { - return -1; + return true; } // sort by validity if (s1->_valid && !s2->_valid) { - return -1; + return true; } else if (!s1->_valid && s2->_valid) { - return 1; + return false; } // sort by time else if (s1->_lastUsedTime > s2->_lastUsedTime) { - return 1; + return false; } else if (s1->_lastUsedTime < s2->_lastUsedTime) { - return -1; + return true; } else { - return 0; + return false; } } diff --git a/engines/wintermute/base/base_surface_storage.h b/engines/wintermute/base/base_surface_storage.h index aef8ad23f9..61738e69a2 100644 --- a/engines/wintermute/base/base_surface_storage.h +++ b/engines/wintermute/base/base_surface_storage.h @@ -39,7 +39,7 @@ public: uint32 _lastCleanupTime; bool initLoop(); bool sortSurfaces(); - static int surfaceSortCB(const void *arg1, const void *arg2); + static bool surfaceSortCB(const BaseSurface *arg1, const BaseSurface *arg2); bool cleanup(bool warn = false); //DECLARE_PERSISTENT(BaseSurfaceStorage, BaseClass); diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp index bab4d4609e..e1bc659fdd 100644 --- a/engines/wintermute/base/particles/part_emitter.cpp +++ b/engines/wintermute/base/particles/part_emitter.cpp @@ -373,16 +373,13 @@ bool PartEmitter::sortParticlesByZ() { } ////////////////////////////////////////////////////////////////////////// -int PartEmitter::compareZ(const void *obj1, const void *obj2) { - const PartParticle *p1 = *(const PartParticle *const *)obj1; - const PartParticle *p2 = *(const PartParticle *const *)obj2; - +bool PartEmitter::compareZ(const PartParticle *p1, const PartParticle *p2) { if (p1->_posZ < p2->_posZ) { - return -1; + return true; } else if (p1->_posZ > p2->_posZ) { - return 1; + return false; } else { - return 0; + return false; } } diff --git a/engines/wintermute/base/particles/part_emitter.h b/engines/wintermute/base/particles/part_emitter.h index f2c8f139f1..3aa55e1ac8 100644 --- a/engines/wintermute/base/particles/part_emitter.h +++ b/engines/wintermute/base/particles/part_emitter.h @@ -127,7 +127,7 @@ private: BaseScriptHolder *_owner; PartForce *addForceByName(const Common::String &name); - int static compareZ(const void *obj1, const void *obj2); + bool static compareZ(const PartParticle *p1, const PartParticle *p2); bool initParticle(PartParticle *particle, uint32 currentTime, uint32 timerDelta); bool updateInternal(uint32 currentTime, uint32 timerDelta); uint32 _lastGenTime; |