diff options
-rw-r--r-- | engines/titanic/core/named_item.cpp | 7 | ||||
-rw-r--r-- | engines/titanic/core/named_item.h | 5 | ||||
-rw-r--r-- | engines/titanic/core/tree_item.cpp | 21 | ||||
-rw-r--r-- | engines/titanic/core/tree_item.h | 11 | ||||
-rw-r--r-- | engines/titanic/main_game_window.cpp | 3 |
5 files changed, 47 insertions, 0 deletions
diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index cd798a297e..49cfdb4622 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -26,6 +26,13 @@ namespace Titanic { +CString CNamedItem::dumpItem(int indent) const { + CString result = CTreeItem::dumpItem(indent); + result += " " + _name; + + return result; +} + void CNamedItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeQuotedLine(_name, indent); diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index 6e6178edd4..aac81ec209 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -37,6 +37,11 @@ public: CLASSDEF /** + * Dump the item + */ + virtual CString dumpItem(int indent) const; + + /** * Save the data for the class to file */ virtual void save(SimpleFile *file, int indent) const; diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 3599732080..cda3ca4b2f 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -37,6 +37,27 @@ CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { } +void CTreeItem::dump(int indent) { + CString line = dumpItem(indent); + debug("%s", line.c_str()); + + CTreeItem *item = getFirstChild(); + while (item) { + item->dump(indent + 1); + + item = item->getNextSibling(); + } +} + +CString CTreeItem::dumpItem(int indent) const { + CString result; + for (int idx = 0; idx < indent; ++idx) + result += '\t'; + result += getType()->_className; + + return result; +} + bool CTreeItem::isFileItem() const { return isInstanceOf(CFileItem::_type); } diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 32b76c987e..be381c55c1 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -42,6 +42,17 @@ public: CLASSDEF CTreeItem(); + + /** + * Dump the item and any of it's children + */ + void dump(int indent); + + /** + * Dump the item + */ + virtual CString dumpItem(int indent) const; + /** * Save the data for the class to file */ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 01996e6b13..18b033f1c9 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -67,6 +67,9 @@ void CMainGameWindow::applicationStarting() { _project->loadGame(saveSlot); // TODO: Cursor/image + //***DEBUG**** + _project->dump(0); + return; // Generate starting messages CViewItem *view = _gameManager->_gameState._gameLocation.getView(); |