[Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.19,1.20 newgui.h,1.14,1.15

Max Horn fingolfin at users.sourceforge.net
Mon Jul 15 13:12:13 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv20792

Modified Files:
	newgui.cpp newgui.h 
Log Message:
replaced EventList and StringList by a universtal List<T> template; remade EventList and StringList using that generic type

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- newgui.cpp	15 Jul 2002 12:59:56 -0000	1.19
+++ newgui.cpp	15 Jul 2002 20:11:39 -0000	1.20
@@ -110,7 +110,7 @@
 		
 		for (int i = 0; i < _eventList.size(); i++)
 		{
-			t = _eventList.getEvent(i);
+			t = _eventList[i];
 		
 			switch(t.event_code) {
 				case OSystem::EVENT_KEYDOWN:

Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- newgui.h	15 Jul 2002 12:59:56 -0000	1.14
+++ newgui.h	15 Jul 2002 20:11:39 -0000	1.15
@@ -24,6 +24,7 @@
 #include "scummsys.h"
 #include "system.h"	// For events
 #include "scumm.h"	// For events
+#include "gui/util.h"
 
 class Dialog;
 class Scumm;
@@ -45,25 +46,7 @@
 	void	pop()				{ if (_size > 0) _stack[--_size] = 0; }
 };
 
-class EventList {
-protected:
-	OSystem::Event	_stack[100];
-	int		_size;
-public:
-	EventList() : _size(0) {}
-
-	void addEvent(const OSystem::Event &d) {
-		if (_size<(100-1))
-			_stack[_size++] = d;
-		else
-			error("EventList overflow.");
-	}
-
-	const OSystem::Event &getEvent(int i) const { return _stack[i]; }
-	int size() const		{ return _size; }
-	void clear()			{ _size = 0; }
-};
-
+typedef List<OSystem::Event> EventList;
 
 // This class hopefully will replace the old Gui class completly one day 
 class NewGui {
@@ -86,7 +69,7 @@
 
 	NewGui(Scumm *s);
 
-	void handleEvent(const OSystem::Event &event) { _eventList.addEvent(event); }
+	void handleEvent(const OSystem::Event &event) { _eventList.push_back(event); }
 
 protected:
 	Scumm		*_s;





More information about the Scummvm-git-logs mailing list