[Scummvm-cvs-logs] SF.net SVN: scummvm: [32958] scummvm/branches/gsoc2008-rtl
cpage88 at users.sourceforge.net
cpage88 at users.sourceforge.net
Tue Jul 8 07:21:06 CEST 2008
Revision: 32958
http://scummvm.svn.sourceforge.net/scummvm/?rev=32958&view=rev
Author: cpage88
Date: 2008-07-07 22:21:05 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
Improved GMM implementation by adding unified quit() and quitGame() methods for all engines. Also implemented a Queue class before and forgot to svn add, common/queue.h is added here.
Modified Paths:
--------------
scummvm/branches/gsoc2008-rtl/engines/engine.h
Added Paths:
-----------
scummvm/branches/gsoc2008-rtl/common/queue.h
Added: scummvm/branches/gsoc2008-rtl/common/queue.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/queue.h (rev 0)
+++ scummvm/branches/gsoc2008-rtl/common/queue.h 2008-07-08 05:21:05 UTC (rev 32958)
@@ -0,0 +1,75 @@
+/* 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: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/branches/gsoc2008-rtl/common/stack.h $
+ * $Id$
+ */
+
+#ifndef COMMON_QUEUE_H
+#define COMMON_QUEUE_H
+
+#include "common/scummsys.h"
+#include "common/array.h"
+
+namespace Common {
+
+/**
+ * Variable size Queue class, implemented using our Array class.
+ */
+template<class T>
+class Queue {
+protected:
+ Array<T> _queue;
+public:
+ Queue<T>() {}
+ Queue<T>(const Array<T> &queueContent) : _queue(queueContent) {}
+
+ bool empty() const {
+ return _queue.empty();
+ }
+ void clear() {
+ _queue.clear();
+ }
+ void push(const T &x) {
+ _queue.push_back(x);
+ }
+ T back() const {
+ const int s = size();
+ return _queue[s - 1];
+ }
+ T front() const {
+ return _queue[0];
+ }
+ T pop() {
+ T tmp = front();
+ _queue.remove_at(0);
+ return tmp;
+ }
+ int size() const {
+ return _queue.size();
+ }
+ T operator[](int i) {
+ return _queue[i];
+ }
+};
+
+} // End of namespace Common
+
+#endif
Property changes on: scummvm/branches/gsoc2008-rtl/common/queue.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Id
Name: svn:eol-style
+ native
Modified: scummvm/branches/gsoc2008-rtl/engines/engine.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/engine.h 2008-07-08 05:02:45 UTC (rev 32957)
+++ scummvm/branches/gsoc2008-rtl/engines/engine.h 2008-07-08 05:21:05 UTC (rev 32958)
@@ -25,6 +25,7 @@
#ifndef ENGINES_ENGINE_H
#define ENGINES_ENGINE_H
+#include "common/events.h"
#include "common/scummsys.h"
#include "common/str.h"
@@ -50,12 +51,8 @@
Audio::Mixer *_mixer;
Common::TimerManager * _timer;
- /** We keep running until this is set to true. */
- bool _quit;
+ bool _quit, _rtl;
- /** This is used when returning from go() to specifiy if we return to the launcher (true), or quit (false). */
- bool _rtl;
-
protected:
Common::EventManager *_eventMan;
Common::SaveFileManager *_saveFileMan;
@@ -121,10 +118,19 @@
void pauseEngine(bool pause);
/**
+ * Quit the engine, sends a Quit event to the Event Manager
+ */
+ void quitGame() { _eventMan->pushEvent(Common::EVENT_QUIT); };
+
+ /**
* Return whether the engine is currently paused or not.
*/
bool isPaused() const { return _pauseLevel != 0; }
+ /**
+ * Return whether or not the engine should quit
+ */
+ bool quit() const { return _eventMan->shouldQuit(); }
/** Run the Global Main Menu Dialog
*/
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