From df20d264fd300a26b15f46dfdfc2d9aa94810d5f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 25 Dec 2008 20:40:00 +0000 Subject: [PATCH] Pushing down some header deps (on common/system.h, mostly) svn-id: r35542 --- backends/events/default/default-events.h | 3 ++ common/events.h | 1 - common/xmlparser.cpp | 42 ++++++++++++++++++++---- common/xmlparser.h | 41 ++++------------------- engines/cine/prc.cpp | 3 +- engines/cruise/cruise_main.cpp | 2 +- engines/engine.h | 5 +++ engines/kyra/kyra_v1.h | 1 + engines/parallaction/input.cpp | 1 + engines/parallaction/parallaction.cpp | 1 + engines/queen/music.cpp | 2 +- engines/saga/introproc_ihnm.cpp | 1 + engines/sky/logic.cpp | 1 + engines/sky/sky.cpp | 1 + engines/sword1/detection.cpp | 1 + engines/sword1/sound.cpp | 1 + engines/tucker/locations.cpp | 1 + 17 files changed, 64 insertions(+), 44 deletions(-) diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h index b2cd1354cc0..e481accc3eb 100644 --- a/backends/events/default/default-events.h +++ b/backends/events/default/default-events.h @@ -28,6 +28,9 @@ #include "common/events.h" #include "common/savefile.h" +#include "common/mutex.h" + +class OSystem; /* At some point we will remove pollEvent from OSystem and change diff --git a/common/events.h b/common/events.h index c1655a17f35..0f0b0cf783f 100644 --- a/common/events.h +++ b/common/events.h @@ -29,7 +29,6 @@ #include "common/keyboard.h" #include "common/queue.h" #include "common/rect.h" -#include "common/system.h" #include "common/noncopyable.h" namespace Common { diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 516f4bfcdfb..3e1a7dd4510 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -23,16 +23,46 @@ * */ -#include "common/util.h" -#include "common/system.h" -#include "common/events.h" -#include "common/hashmap.h" -#include "common/hash-str.h" #include "common/xmlparser.h" +#include "common/util.h" +#include "common/archive.h" namespace Common { -using namespace Graphics; +bool XMLParser::loadFile(const Common::String &filename) { + _stream = SearchMan.openFile(filename); + if (!_stream) + return false; + + _fileName = filename; + return true; +} + +bool XMLParser::loadFile(const FSNode &node) { + _stream = node.openForReading(); + if (!_stream) + return false; + + _fileName = node.getName(); + return true; +} + +bool XMLParser::loadBuffer(const byte *buffer, uint32 size, bool disposable) { + _stream = new MemoryReadStream(buffer, size, disposable); + _fileName = "Memory Stream"; + return true; +} + +bool XMLParser::loadStream(Common::SeekableReadStream *stream) { + _stream = stream; + _fileName = "File Stream"; + return true; +} + +void XMLParser::close() { + delete _stream; + _stream = 0; +} bool XMLParser::parserError(const char *errorString, ...) { _state = kParserError; diff --git a/common/xmlparser.h b/common/xmlparser.h index 435e7c7e0c8..08f4565b114 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -27,11 +27,7 @@ #define XML_PARSER_H #include "common/scummsys.h" -#include "common/archive.h" -#include "common/system.h" #include "common/stream.h" -#include "common/file.h" -#include "common/fs.h" #include "common/hashmap.h" #include "common/hash-str.h" @@ -40,6 +36,8 @@ namespace Common { +class FSNode; + /* XMLParser.cpp/h -- Generic XML Parser ===================================== @@ -184,23 +182,9 @@ public: * * @param filename Name of the file to load. */ - bool loadFile(const Common::String &filename) { - _stream = SearchMan.openFile(filename); - if (!_stream) - return false; + bool loadFile(const Common::String &filename); - _fileName = filename; - return true; - } - - bool loadFile(const FSNode &node) { - _stream = node.openForReading(); - if (!_stream) - return false; - - _fileName = node.getName(); - return true; - } + bool loadFile(const FSNode &node); /** * Loads a memory buffer into the parser. @@ -213,22 +197,11 @@ public: * i.e. if it can be freed safely after it's * no longer needed by the parser. */ - bool loadBuffer(const byte *buffer, uint32 size, bool disposable = false) { - _stream = new MemoryReadStream(buffer, size, disposable); - _fileName = "Memory Stream"; - return true; - } + bool loadBuffer(const byte *buffer, uint32 size, bool disposable = false); - bool loadStream(Common::SeekableReadStream *stream) { - _stream = stream; - _fileName = "File Stream"; - return true; - } + bool loadStream(Common::SeekableReadStream *stream); - void close() { - delete _stream; - _stream = 0; - } + void close(); /** * The actual parsing function. diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp index 797a354c4fb..487b8b60a4c 100644 --- a/engines/cine/prc.cpp +++ b/engines/cine/prc.cpp @@ -26,11 +26,12 @@ #include "common/endian.h" #include "common/events.h" +#include "common/config-manager.h" +#include "common/system.h" // for g_system->getEventManager() #include "cine/cine.h" #include "cine/various.h" -#include "common/config-manager.h" namespace Cine { diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 7064f81a90e..44f4f155aaa 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -23,9 +23,9 @@ * */ - #include "common/endian.h" #include "common/events.h" +#include "common/system.h" // for g_system->getEventManager() #include "cruise/cruise_main.h" #include "cruise/cell.h" diff --git a/engines/engine.h b/engines/engine.h index de8523a1b06..e859cf090ba 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -250,6 +250,11 @@ public: */ void openMainMenuDialog(); + + Common::TimerManager *getTimerManager() { return _timer; } + Common::EventManager *getEventManager() { return _eventMan; } + Common::SaveFileManager *getSaveFileManager() { return _saveFileMan; } + public: /** On some systems, check if the game appears to be run from CD. */ diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index 13b6397e449..e38f0b06331 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -30,6 +30,7 @@ #include "common/array.h" #include "common/events.h" +#include "common/system.h" #include "kyra/script.h" diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index 08df4f9fe3d..4904e63df68 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -24,6 +24,7 @@ */ #include "common/events.h" +#include "common/system.h" #include "parallaction/input.h" #include "parallaction/parallaction.h" diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 5628c3c8c65..f61947f29c6 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -27,6 +27,7 @@ #include "common/events.h" #include "common/file.h" #include "common/util.h" +#include "common/system.h" #include "sound/mididrv.h" #include "sound/mixer.h" diff --git a/engines/queen/music.cpp b/engines/queen/music.cpp index a668d38b40e..8a50ae6b406 100644 --- a/engines/queen/music.cpp +++ b/engines/queen/music.cpp @@ -84,7 +84,7 @@ MidiMusic::MidiMusic(QueenEngine *vm) _parser->setMidiDriver(this); _parser->setTimerRate(_driver->getBaseTempo()); - vm->_system->getEventManager()->registerRandomSource(_rnd, "queenMusic"); + vm->getEventManager()->registerRandomSource(_rnd, "queenMusic"); } MidiMusic::~MidiMusic() { diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp index 1cd1079d830..0b4ef6eb6a7 100644 --- a/engines/saga/introproc_ihnm.cpp +++ b/engines/saga/introproc_ihnm.cpp @@ -39,6 +39,7 @@ #include "saga/scene.h" #include "common/events.h" +#include "common/system.h" namespace Saga { diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp index 9f13bf9bee0..fc8ecdca3aa 100644 --- a/engines/sky/logic.cpp +++ b/engines/sky/logic.cpp @@ -27,6 +27,7 @@ #include "common/endian.h" #include "common/rect.h" #include "common/events.h" +#include "common/system.h" #include "sky/autoroute.h" #include "sky/compact.h" diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index 4adce2ebaff..da63e432c25 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -24,6 +24,7 @@ */ #include "common/config-manager.h" +#include "common/system.h" #include "sky/control.h" #include "sky/debug.h" diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 30f0ebcb2b7..657364cc113 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -31,6 +31,7 @@ #include "common/file.h" #include "common/fs.h" #include "common/savefile.h" +#include "common/system.h" #include "graphics/thumbnail.h" #include "engines/metaengine.h" diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index d994ebf69b3..caf6d486135 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -28,6 +28,7 @@ #include "common/util.h" #include "common/events.h" +#include "common/system.h" #include "sword1/sound.h" #include "sword1/resman.h" diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp index b0bd3f1f487..d0e380eea4a 100644 --- a/engines/tucker/locations.cpp +++ b/engines/tucker/locations.cpp @@ -25,6 +25,7 @@ #include "tucker/tucker.h" #include "tucker/graphics.h" +#include "common/system.h" namespace Tucker {