diff options
author | Max Horn | 2010-02-03 01:32:59 +0000 |
---|---|---|
committer | Max Horn | 2010-02-03 01:32:59 +0000 |
commit | bb5e34a014c0ae868de86fcea484bc9671ce18b9 (patch) | |
tree | 09bb25253478180fd6069a21789f75fe8104a98c /engines/sci/engine/seg_manager.cpp | |
parent | b2d69649f7e4c484dcf3810e11cd644699b78d2c (diff) | |
download | scummvm-rg350-bb5e34a014c0ae868de86fcea484bc9671ce18b9.tar.gz scummvm-rg350-bb5e34a014c0ae868de86fcea484bc9671ce18b9.tar.bz2 scummvm-rg350-bb5e34a014c0ae868de86fcea484bc9671ce18b9.zip |
SCI: Get rid of EngineState::stack_segment
svn-id: r47833
Diffstat (limited to 'engines/sci/engine/seg_manager.cpp')
-rw-r--r-- | engines/sci/engine/seg_manager.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index 15de668610..430a58fb1f 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -113,34 +113,36 @@ SegmentId SegManager::findFreeSegment() const { SegmentObj *SegManager::allocSegment(SegmentObj *mem, SegmentId *segid) { // Find a free segment - *segid = findFreeSegment(); + SegmentId id = findFreeSegment(); + if (segid) + *segid = id; if (!mem) error("SegManager: invalid mobj"); // ... and put it into the (formerly) free segment. - if (*segid >= (int)_heap.size()) { - assert(*segid == (int)_heap.size()); + if (id >= (int)_heap.size()) { + assert(id == (int)_heap.size()); _heap.push_back(0); } - _heap[*segid] = mem; + _heap[id] = mem; return mem; } -Script *SegManager::allocateScript(int script_nr, SegmentId *seg_id) { +Script *SegManager::allocateScript(int script_nr, SegmentId *segid) { // Check if the script already has an allocated segment. If it // does, return that segment. - *seg_id = _scriptSegMap.getVal(script_nr, 0); - if (*seg_id > 0) { - return (Script *)_heap[*seg_id]; + *segid = _scriptSegMap.getVal(script_nr, 0); + if (*segid > 0) { + return (Script *)_heap[*segid]; } // allocate the SegmentObj - SegmentObj *mem = allocSegment(new Script(), seg_id); + SegmentObj *mem = allocSegment(new Script(), segid); // Add the script to the "script id -> segment id" hashmap - _scriptSegMap[script_nr] = *seg_id; + _scriptSegMap[script_nr] = *segid; return (Script *)mem; } |