aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/inventory.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-04-25 04:42:15 -0500
committerPaul Gilbert2015-04-25 04:42:15 -0500
commit2379824e32fd0cb49e3f2b6c997cb6070f0b0393 (patch)
treeb7278331994774b3e25d08bb44b681f035ee39e1 /engines/sherlock/inventory.cpp
parenteb91c01cf160984f52edf5ba1da3f5db1e2a6519 (diff)
downloadscummvm-rg350-2379824e32fd0cb49e3f2b6c997cb6070f0b0393.tar.gz
scummvm-rg350-2379824e32fd0cb49e3f2b6c997cb6070f0b0393.tar.bz2
scummvm-rg350-2379824e32fd0cb49e3f2b6c997cb6070f0b0393.zip
SHERLOCK: Fix saving and display of inventory items
Diffstat (limited to 'engines/sherlock/inventory.cpp')
-rw-r--r--engines/sherlock/inventory.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp
index 3ba6f9d2bd..808429f643 100644
--- a/engines/sherlock/inventory.cpp
+++ b/engines/sherlock/inventory.cpp
@@ -31,6 +31,17 @@ InventoryItem::InventoryItem(int requiredFlag, const Common::String &name,
_examine(examine), _lookFlag(0) {
}
+/**
+ * Synchronize the data for an inventory item
+ */
+void InventoryItem::synchronize(Common::Serializer &s) {
+ s.syncAsSint16LE(_requiredFlag);
+ s.syncAsSint16LE(_lookFlag);
+ s.syncString(_name);
+ s.syncString(_description);
+ s.syncString(_examine);
+}
+
/*----------------------------------------------------------------*/
Inventory::Inventory(SherlockEngine *vm) : Common::Array<InventoryItem>(), _vm(vm) {
@@ -47,6 +58,9 @@ Inventory::~Inventory() {
freeGraphics();
}
+/**
+ * Free inventory data
+ */
void Inventory::freeInv() {
freeGraphics();
@@ -117,7 +131,7 @@ void Inventory::loadGraphics() {
* and returns the numer that matches the passed name
*/
int Inventory::findInv(const Common::String &name) {
- for (int idx = 0; idx < (int)size(); ++idx) {
+ for (int idx = 0; idx < (int)_names.size(); ++idx) {
if (scumm_stricmp(name.c_str(), _names[idx].c_str()) == 0)
return idx;
}
@@ -502,7 +516,8 @@ void Inventory::synchronize(Common::Serializer &s) {
}
for (uint idx = 0; idx < size(); ++idx) {
- // TODO
+ (*this)[idx].synchronize(s);
+
}
}