aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sherlock')
-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;