aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-05-09 11:25:05 -0400
committerPaul Gilbert2015-05-09 11:25:05 -0400
commit1518d14c3412fa6cf5aaf2bb3bbedfe61d37c15e (patch)
tree1155dcbae28d7a9c950a2fe76e6918e79f61d8a8 /engines
parent5f71643cba4937367182d3c6751fcfecfbb09573 (diff)
downloadscummvm-rg350-1518d14c3412fa6cf5aaf2bb3bbedfe61d37c15e.tar.gz
scummvm-rg350-1518d14c3412fa6cf5aaf2bb3bbedfe61d37c15e.tar.bz2
scummvm-rg350-1518d14c3412fa6cf5aaf2bb3bbedfe61d37c15e.zip
SHERLOCK: Cleanup fixes for Inventory
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/inventory.cpp8
-rw-r--r--engines/sherlock/inventory.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp
index 99db461ea4..c3e2e14393 100644
--- a/engines/sherlock/inventory.cpp
+++ b/engines/sherlock/inventory.cpp
@@ -79,7 +79,9 @@ void Inventory::freeGraphics() {
_invGraphicsLoaded = false;
}
-/** Load the list of names the inventory items correspond to.
+/**
+ * Load the list of names the inventory items correspond to, if not already loaded,
+ * and then calls loadGraphics to load the associated graphics
*/
void Inventory::loadInv() {
// Exit if the inventory names are already loaded
@@ -88,9 +90,9 @@ void Inventory::loadInv() {
// Load the inventory names
Common::SeekableReadStream *stream = _vm->_res->load("invent.txt");
- _names.clear();
- while (stream->pos() < stream->size()) {
+ int streamSize = stream->size();
+ while (stream->pos() < streamSize) {
Common::String name;
char c;
while ((c = stream->readByte()) != 0)
diff --git a/engines/sherlock/inventory.h b/engines/sherlock/inventory.h
index 68b88bd978..bec26b333d 100644
--- a/engines/sherlock/inventory.h
+++ b/engines/sherlock/inventory.h
@@ -72,7 +72,8 @@ public:
bool _invGraphicsLoaded;
InvMode _invMode;
int _invIndex;
- int _holdings;
+ int _holdings; // Used to hold number of visible items in active inventory.
+ // Since Inventory array also contains some special hidden items
void freeGraphics();
int _oldFlag;
int _invFlag;