[Scummvm-cvs-logs] scummvm master -> 8d866683d90e69c3313fda5fed63679a603d2b45

somaen einarjohan at somadalen.com
Sun Dec 9 11:09:18 CET 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8d866683d9 WINTERMUTE: Fix the rest of the Common:sort comparators.


Commit: 8d866683d90e69c3313fda5fed63679a603d2b45
    https://github.com/scummvm/scummvm/commit/8d866683d90e69c3313fda5fed63679a603d2b45
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2012-12-09T02:08:04-08:00

Commit Message:
WINTERMUTE: Fix the rest of the Common:sort comparators.

Changed paths:
    engines/wintermute/base/base_surface_storage.cpp
    engines/wintermute/base/base_surface_storage.h
    engines/wintermute/base/particles/part_emitter.cpp
    engines/wintermute/base/particles/part_emitter.h



diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp
index 4e795ca..2205e3e 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 aef8ad2..61738e6 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 bab4d46..e1bc659 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 f2c8f13..3aa55e1 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;






More information about the Scummvm-git-logs mailing list