aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-03-13 16:25:25 -0400
committerPaul Gilbert2016-03-13 16:25:25 -0400
commit0cc014d06ba3b2588dfb7cb46366aa3d0a875d04 (patch)
tree2f90d3c30b6879eb398d717dfea8b204787042e9 /engines
parentb57805bd4b5f9beca9fe6e8e697744c89cad09f3 (diff)
downloadscummvm-rg350-0cc014d06ba3b2588dfb7cb46366aa3d0a875d04.tar.gz
scummvm-rg350-0cc014d06ba3b2588dfb7cb46366aa3d0a875d04.tar.bz2
scummvm-rg350-0cc014d06ba3b2588dfb7cb46366aa3d0a875d04.zip
TITANIC: Implemented dumping of the project hierarchy
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/core/named_item.cpp7
-rw-r--r--engines/titanic/core/named_item.h5
-rw-r--r--engines/titanic/core/tree_item.cpp21
-rw-r--r--engines/titanic/core/tree_item.h11
-rw-r--r--engines/titanic/main_game_window.cpp3
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();