diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/array.h | 4 | ||||
-rw-r--r-- | common/events.h | 4 | ||||
-rw-r--r-- | common/hashmap.h | 2 | ||||
-rw-r--r-- | common/system.h | 8 | ||||
-rw-r--r-- | common/util.cpp | 9 | ||||
-rw-r--r-- | common/util.h | 7 | ||||
-rw-r--r-- | common/xmlparser.cpp | 186 |
7 files changed, 120 insertions, 100 deletions
diff --git a/common/array.h b/common/array.h index 7852cabf06..0b5a65e9bd 100644 --- a/common/array.h +++ b/common/array.h @@ -222,7 +222,7 @@ public: T *old_storage = _storage; _capacity = newCapacity; - _storage = new T[newCapacity](); + _storage = new T[newCapacity]; assert(_storage); if (old_storage) { @@ -273,7 +273,7 @@ protected: // If there is not enough space, allocate more and // copy old elements over. uint newCapacity = roundUpCapacity(_size + n); - newStorage = new T[newCapacity](); + newStorage = new T[newCapacity]; assert(newStorage); copy(_storage, _storage + idx, newStorage); pos = newStorage + idx; diff --git a/common/events.h b/common/events.h index e13d95cf47..82b85e60ea 100644 --- a/common/events.h +++ b/common/events.h @@ -195,7 +195,9 @@ public: * Used when we have returned to the launcher. */ virtual void resetRTL() = 0; - +#ifdef FORCE_RTL + virtual void resetQuit() = 0; +#endif // Optional: check whether a given key is currently pressed ???? //virtual bool isKeyPressed(int keycode) = 0; diff --git a/common/hashmap.h b/common/hashmap.h index fa613782cf..f5059a4bcf 100644 --- a/common/hashmap.h +++ b/common/hashmap.h @@ -383,7 +383,9 @@ template<class Key, class Val, class HashFunc, class EqualFunc> void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(uint newCapacity) { assert(newCapacity > _mask+1); +#ifndef NDEBUG const uint old_size = _size; +#endif const uint old_mask = _mask; Node **old_storage = _storage; diff --git a/common/system.h b/common/system.h index 5b3c208661..5c91296ab1 100644 --- a/common/system.h +++ b/common/system.h @@ -408,10 +408,10 @@ public: */ enum TransactionError { kTransactionSuccess = 0, /**< Everything fine (use EQUAL check for this one!) */ - kTransactionAspectRatioFailed = (1 << 0), /**< Failed switchting aspect ratio correction mode */ - kTransactionFullscreenFailed = (1 << 1), /**< Failed switchting fullscreen mode */ - kTransactionModeSwitchFailed = (1 << 2), /**< Failed switchting the GFX graphics mode (setGraphicsMode) */ - kTransactionSizeChangeFailed = (1 << 3) /**< Failed switchting the screen dimensions (initSize) */ + kTransactionAspectRatioFailed = (1 << 0), /**< Failed switching aspect ratio correction mode */ + kTransactionFullscreenFailed = (1 << 1), /**< Failed switching fullscreen mode */ + kTransactionModeSwitchFailed = (1 << 2), /**< Failed switching the GFX graphics mode (setGraphicsMode) */ + kTransactionSizeChangeFailed = (1 << 3) /**< Failed switching the screen dimensions (initSize) */ }; /** diff --git a/common/util.cpp b/common/util.cpp index e99bbeb12d..869cec4c48 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -24,6 +24,7 @@ #include "common/util.h" #include "common/system.h" +#include "common/config-manager.h" #include "gui/debugger.h" #include "engines/engine.h" @@ -420,6 +421,14 @@ String getGameGUIOptionsDescription(uint32 options) { return res; } +void updateGameGUIOptions(const uint32 options) { + if ((options && !ConfMan.hasKey("guioptions")) || + (ConfMan.hasKey("guioptions") && options != parseGameGUIOptions(ConfMan.get("guioptions")))) { + ConfMan.set("guioptions", getGameGUIOptionsDescription(options)); + ConfMan.flushToDisk(); + } +} + } // End of namespace Common diff --git a/common/util.h b/common/util.h index e50dcebff0..aeadcd1483 100644 --- a/common/util.h +++ b/common/util.h @@ -284,6 +284,13 @@ bool checkGameGUIOption(GameGUIOption option, const String &str); uint32 parseGameGUIOptions(const String &str); String getGameGUIOptionsDescription(uint32 options); +/** + * Updates the GUI options of the current config manager + * domain, when they differ to the ones passed as + * parameter. + */ +void updateGameGUIOptions(const uint32 options); + } // End of namespace Common diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp index 1385af795b..534007b03d 100644 --- a/common/xmlparser.cpp +++ b/common/xmlparser.cpp @@ -276,126 +276,126 @@ bool XMLParser::parse() { continue; switch (_state) { - case kParserNeedHeader: - case kParserNeedKey: - if (_char != '<') { - parserError("Parser expecting key start."); - break; - } + case kParserNeedHeader: + case kParserNeedKey: + if (_char != '<') { + parserError("Parser expecting key start."); + break; + } + + if ((_char = _stream->readByte()) == 0) { + parserError("Unexpected end of file."); + break; + } - if ((_char = _stream->readByte()) == 0) { - parserError("Unexpected end of file."); + if (_state == kParserNeedHeader) { + if (_char != '?') { + parserError("Expecting XML header."); break; } - if (_state == kParserNeedHeader) { - if (_char != '?') { - parserError("Expecting XML header."); - break; - } + _char = _stream->readByte(); + activeHeader = true; + } else if (_char == '/') { + _char = _stream->readByte(); + activeClosure = true; + } else if (_char == '?') { + parserError("Unexpected header. There may only be one XML header per file."); + break; + } - _char = _stream->readByte(); - activeHeader = true; - } else if (_char == '/') { - _char = _stream->readByte(); - activeClosure = true; - } else if (_char == '?') { - parserError("Unexpected header. There may only be one XML header per file."); - break; - } + _state = kParserNeedKeyName; + break; - _state = kParserNeedKeyName; + case kParserNeedKeyName: + if (!parseToken()) { + parserError("Invalid key name."); break; + } - case kParserNeedKeyName: - if (!parseToken()) { - parserError("Invalid key name."); + if (activeClosure) { + if (_activeKey.empty() || _token != _activeKey.top()->name) { + parserError("Unexpected closure."); break; } - - if (activeClosure) { - if (_activeKey.empty() || _token != _activeKey.top()->name) { - parserError("Unexpected closure."); - break; - } - } else { - ParserNode *node = allocNode(); //new ParserNode; - node->name = _token; - node->ignore = false; - node->header = activeHeader; - node->depth = _activeKey.size(); - node->layout = 0; - _activeKey.push(node); + } else { + ParserNode *node = allocNode(); //new ParserNode; + node->name = _token; + node->ignore = false; + node->header = activeHeader; + node->depth = _activeKey.size(); + node->layout = 0; + _activeKey.push(node); + } + + _state = kParserNeedPropertyName; + break; + + case kParserNeedPropertyName: + if (activeClosure) { + if (!closeKey()) { + parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); + break; } - _state = kParserNeedPropertyName; - break; - - case kParserNeedPropertyName: - if (activeClosure) { - if (!closeKey()) { - parserError("Missing data when closing key '%s'.", _activeKey.top()->name.c_str()); - break; - } + activeClosure = false; - activeClosure = false; + if (_char != '>') + parserError("Invalid syntax in key closure."); + else + _state = kParserNeedKey; - if (_char != '>') - parserError("Invalid syntax in key closure."); - else - _state = kParserNeedKey; + _char = _stream->readByte(); + break; + } - _char = _stream->readByte(); - break; - } + selfClosure = false; - selfClosure = false; + if (_char == '/' || (_char == '?' && activeHeader)) { + selfClosure = true; + _char = _stream->readByte(); + } - if (_char == '/' || (_char == '?' && activeHeader)) { - selfClosure = true; + if (_char == '>') { + if (activeHeader && !selfClosure) { + parserError("XML Header must be self-closed."); + } else if (parseActiveKey(selfClosure)) { _char = _stream->readByte(); + _state = kParserNeedKey; } - if (_char == '>') { - if (activeHeader && !selfClosure) { - parserError("XML Header must be self-closed."); - } else if (parseActiveKey(selfClosure)) { - _char = _stream->readByte(); - _state = kParserNeedKey; - } + activeHeader = false; + break; + } - activeHeader = false; - break; - } + if (selfClosure) + parserError("Expecting key closure after '/' symbol."); + else if (!parseToken()) + parserError("Error when parsing key value."); + else + _state = kParserNeedPropertyOperator; - if (selfClosure) - parserError("Expecting key closure after '/' symbol."); - else if (!parseToken()) - parserError("Error when parsing key value."); - else - _state = kParserNeedPropertyOperator; + break; - break; + case kParserNeedPropertyOperator: + if (_char != '=') + parserError("Syntax error after key name."); + else + _state = kParserNeedPropertyValue; - case kParserNeedPropertyOperator: - if (_char != '=') - parserError("Syntax error after key name."); - else - _state = kParserNeedPropertyValue; - - _char = _stream->readByte(); - break; + _char = _stream->readByte(); + break; - case kParserNeedPropertyValue: - if (!parseKeyValue(_token)) - parserError("Invalid key value."); - else - _state = kParserNeedPropertyName; + case kParserNeedPropertyValue: + if (!parseKeyValue(_token)) + parserError("Invalid key value."); + else + _state = kParserNeedPropertyName; - break; + break; - default: - break; + default: + break; } } |