[Scummvm-cvs-logs] SF.net SVN: scummvm:[39928] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Apr 11 11:54:56 CEST 2009


Revision: 39928
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39928&view=rev
Author:   thebluegr
Date:     2009-04-11 09:54:55 +0000 (Sat, 11 Apr 2009)

Log Message:
-----------
Got rid of SortedList

Modified Paths:
--------------
    scummvm/trunk/engines/saga/actor.cpp
    scummvm/trunk/engines/saga/actor.h
    scummvm/trunk/engines/saga/events.h
    scummvm/trunk/engines/saga/font.h
    scummvm/trunk/engines/saga/saga.h
    scummvm/trunk/engines/saga/scene.h
    scummvm/trunk/engines/saga/script.h

Removed Paths:
-------------
    scummvm/trunk/engines/saga/list.h

Modified: scummvm/trunk/engines/saga/actor.cpp
===================================================================
--- scummvm/trunk/engines/saga/actor.cpp	2009-04-11 09:43:42 UTC (rev 39927)
+++ scummvm/trunk/engines/saga/actor.cpp	2009-04-11 09:54:55 UTC (rev 39928)
@@ -960,11 +960,24 @@
 	return result;					// in IHNM, return the last result found (read above)
 }
 
+void Actor::drawOrderListAdd(const CommonObjectDataPointer& element, CompareFunction compareFunction) {
+	int res;
+
+	for (CommonObjectOrderList::iterator i = _drawOrderList.begin(); i !=_drawOrderList.end(); ++i) {
+		res = compareFunction(element, *i);
+		if	(res < 0) {
+			_drawOrderList.insert(i, element);
+			return;
+		}
+	}
+	_drawOrderList.push_back(element);
+}
+
 void Actor::createDrawOrderList() {
 	int i;
 	ActorData *actor;
 	ObjectData *obj;
-	CommonObjectOrderList::CompareFunction compareFunction = 0;
+	CompareFunction compareFunction = 0;
 
 	if (_vm->_scene->getFlags() & kSceneFlagISO) {
 		compareFunction = &tileCommonObjectCompare;
@@ -985,7 +998,7 @@
 			continue;
 
 		if (calcScreenPosition(actor)) {
-			_drawOrderList.insert(actor, compareFunction);
+			drawOrderListAdd(actor, compareFunction);
 		}
 	}
 
@@ -1005,7 +1018,7 @@
 			continue;
 
 		if (calcScreenPosition(obj)) {
-			_drawOrderList.insert(obj, compareFunction);
+			drawOrderListAdd(obj, compareFunction);
 		}
 	}
 }

Modified: scummvm/trunk/engines/saga/actor.h
===================================================================
--- scummvm/trunk/engines/saga/actor.h	2009-04-11 09:43:42 UTC (rev 39927)
+++ scummvm/trunk/engines/saga/actor.h	2009-04-11 09:54:55 UTC (rev 39928)
@@ -32,7 +32,6 @@
 
 #include "saga/sprite.h"
 #include "saga/itedata.h"
-#include "saga/list.h"
 #include "saga/saga.h"
 #include "saga/font.h"
 
@@ -328,7 +327,7 @@
 
 typedef CommonObjectData *CommonObjectDataPointer;
 
-typedef SortedList<CommonObjectDataPointer> CommonObjectOrderList;
+typedef Common::List<CommonObjectDataPointer> CommonObjectOrderList;
 
 class ObjectData: public CommonObjectData {
 public:
@@ -558,8 +557,8 @@
 	}
 };
 
+typedef int (*CompareFunction) (const CommonObjectDataPointer& a, const CommonObjectDataPointer& b);
 
-
 class Actor {
 	friend class IsoMap;
 	friend class SagaEngine;
@@ -662,6 +661,7 @@
 	void stepZoneAction(ActorData *actor, const HitZone *hitZone, bool exit, bool stopped);
 	void loadActorSpriteList(ActorData *actor);
 
+	void drawOrderListAdd(const CommonObjectDataPointer& element, CompareFunction compareFunction);
 	void createDrawOrderList();
 	bool calcScreenPosition(CommonObjectData *commonObjectData);
 	bool getSpriteParams(CommonObjectData *commonObjectData, int &frameNumber, SpriteList *&spriteList);

Modified: scummvm/trunk/engines/saga/events.h
===================================================================
--- scummvm/trunk/engines/saga/events.h	2009-04-11 09:43:42 UTC (rev 39927)
+++ scummvm/trunk/engines/saga/events.h	2009-04-11 09:54:55 UTC (rev 39928)
@@ -28,7 +28,6 @@
 #ifndef SAGA_EVENT_H
 #define SAGA_EVENT_H
 
-#include "saga/list.h"
 
 namespace Saga {
 

Modified: scummvm/trunk/engines/saga/font.h
===================================================================
--- scummvm/trunk/engines/saga/font.h	2009-04-11 09:43:42 UTC (rev 39927)
+++ scummvm/trunk/engines/saga/font.h	2009-04-11 09:54:55 UTC (rev 39928)
@@ -28,7 +28,6 @@
 #ifndef SAGA_FONT_H
 #define SAGA_FONT_H
 
-#include "saga/list.h"
 #include "saga/gfx.h"
 
 namespace Saga {

Deleted: scummvm/trunk/engines/saga/list.h
===================================================================
--- scummvm/trunk/engines/saga/list.h	2009-04-11 09:43:42 UTC (rev 39927)
+++ scummvm/trunk/engines/saga/list.h	2009-04-11 09:54:55 UTC (rev 39928)
@@ -1,59 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-// List functions
-
-#ifndef SAGA_LIST_H
-#define SAGA_LIST_H
-
-#include "common/list.h"
-
-namespace Saga {
-
-template <class T>
-class SortedList : public Common::List<T> {
-public:
-	typedef typename Common::List<T>::iterator iterator;
-	typedef typename Common::List<T>::const_iterator const_iterator;
-	typedef int (*CompareFunction) (const T& a, const T& b);
-
-	iterator insert(const T& element, CompareFunction compareFunction) {
-		int res;
-
-		for (typename Common::List<T>::iterator i = Common::List<T>::begin(); i != Common::List<T>::end(); ++i) {
-			res = compareFunction(element, *i);
-			if	(res < 0) {
-				Common::List<T>::insert(i, element);
-				return --i;
-			}
-		}
-		Common::List<T>::push_back(element);
-		return --Common::List<T>::end();
-	}
-};
-
-} // End of namespace Saga
-
-#endif

Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h	2009-04-11 09:43:42 UTC (rev 39927)
+++ scummvm/trunk/engines/saga/saga.h	2009-04-11 09:54:55 UTC (rev 39928)
@@ -32,7 +32,6 @@
 #include "sound/mididrv.h"
 
 #include "saga/gfx.h"
-#include "saga/list.h"
 
 struct ADGameFileDescription;
 

Modified: scummvm/trunk/engines/saga/scene.h
===================================================================
--- scummvm/trunk/engines/saga/scene.h	2009-04-11 09:43:42 UTC (rev 39927)
+++ scummvm/trunk/engines/saga/scene.h	2009-04-11 09:54:55 UTC (rev 39928)
@@ -29,7 +29,6 @@
 #define SAGA_SCENE_H
 
 #include "saga/font.h"
-#include "saga/list.h"
 #include "saga/actor.h"
 #include "saga/interface.h"
 #include "saga/puzzle.h"

Modified: scummvm/trunk/engines/saga/script.h
===================================================================
--- scummvm/trunk/engines/saga/script.h	2009-04-11 09:43:42 UTC (rev 39927)
+++ scummvm/trunk/engines/saga/script.h	2009-04-11 09:54:55 UTC (rev 39928)
@@ -31,7 +31,6 @@
 #include "common/endian.h"
 
 #include "saga/font.h"
-#include "saga/list.h"
 
 namespace Saga {
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list