diff options
author | Matthew Hoops | 2010-02-08 15:51:00 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-02-08 15:51:00 +0000 |
commit | 7147f8577e08bcb037cba390dbef3e90163fb96f (patch) | |
tree | 2ebed6871a7f97b2b8ed92a232092585c2dd6bac /engines/sci/engine/segment.cpp | |
parent | 6938ca072aa05600ece0b7041e47a0fe8e4abba4 (diff) | |
download | scummvm-rg350-7147f8577e08bcb037cba390dbef3e90163fb96f.tar.gz scummvm-rg350-7147f8577e08bcb037cba390dbef3e90163fb96f.tar.bz2 scummvm-rg350-7147f8577e08bcb037cba390dbef3e90163fb96f.zip |
Search through arrays for outgoing references to fix possible garbage collector problems; minor cleanup.
svn-id: r47989
Diffstat (limited to 'engines/sci/engine/segment.cpp')
-rw-r--r-- | engines/sci/engine/segment.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index 5419de6f0b..49328c7775 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -695,6 +695,26 @@ SegmentRef ArrayTable::dereference(reg_t pointer) { return ret; } +void ArrayTable::freeAtAddress(SegManager *segMan, reg_t sub_addr) { + _table[sub_addr.offset].destroy(); + freeEntry(sub_addr.offset); +} + +void ArrayTable::listAllOutgoingReferences(reg_t addr, void *param, NoteCallback note) { + if (!isValidEntry(addr.offset)) { + warning("Invalid array referenced for outgoing references: %04x:%04x", PRINT_REG(addr)); + return; + } + + SciArray<reg_t> *array = &(_table[addr.offset]); + + for (uint32 i = 0; i < array->getSize(); i++) { + reg_t value = array->getValue(i); + if (value.segment != 0) + note(param, value); + } +} + Common::String SciString::toString() { if (_type != 3) error("SciString::toString(): Array is not a string"); @@ -725,6 +745,11 @@ SegmentRef StringTable::dereference(reg_t pointer) { return ret; } +void StringTable::freeAtAddress(SegManager *segMan, reg_t sub_addr) { + _table[sub_addr.offset].destroy(); + freeEntry(sub_addr.offset); +} + #endif } // End of namespace Sci |