aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/seg_manager.cpp13
-rw-r--r--engines/sci/engine/seg_manager.h5
2 files changed, 14 insertions, 4 deletions
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 3cf9d08ceb..aa70d5f838 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -284,12 +284,11 @@ const char *SegManager::getObjectName(reg_t pos) {
return name;
}
-reg_t SegManager::findObjectByName(const Common::String &name, int index) {
+Common::Array<reg_t> SegManager::findObjectsByName(const Common::String &name) {
Common::Array<reg_t> result;
- uint i;
// Now all values are available; iterate over all objects.
- for (i = 0; i < _heap.size(); i++) {
+ for (uint i = 0; i < _heap.size(); i++) {
const SegmentObj *mobj = _heap[i];
if (!mobj)
@@ -320,12 +319,18 @@ reg_t SegManager::findObjectByName(const Common::String &name, int index) {
}
}
+ return result;
+}
+
+reg_t SegManager::findObjectByName(const Common::String &name, int index) {
+ Common::Array<reg_t> result = findObjectsByName(name);
+
if (result.empty())
return NULL_REG;
if (result.size() > 1 && index < 0) {
debug("findObjectByName(%s): multiple matches:", name.c_str());
- for (i = 0; i < result.size(); i++)
+ for (uint i = 0; i < result.size(); i++)
debug(" %3x: [%04x:%04x]", i, PRINT_REG(result[i]));
return NULL_REG; // Ambiguous
}
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index 916b813eb5..d13edf0ef2 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -411,6 +411,11 @@ public:
const char *getObjectName(reg_t pos);
/**
+ * Finds the addresses of all objects with the given name.
+ */
+ Common::Array<reg_t> findObjectsByName(const Common::String &name);
+
+ /**
* Find the address of an object by its name. In case multiple objects
* with the same name occur, the optional index parameter can be used
* to distinguish between them. If index is -1, then if there is a