mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
SCI: Make various SegManager const
svn-id: r50439
This commit is contained in:
parent
a278c07aa6
commit
b3011faaef
@ -168,7 +168,7 @@ int SegManager::deallocate(SegmentId seg, bool recursive) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool SegManager::isHeapObject(reg_t pos) {
|
||||
bool SegManager::isHeapObject(reg_t pos) const {
|
||||
const Object *obj = getObject(pos);
|
||||
if (obj == NULL || (obj && obj->isFreed()))
|
||||
return false;
|
||||
@ -194,36 +194,36 @@ Script *SegManager::getScript(const SegmentId seg) {
|
||||
return (Script *)_heap[seg];
|
||||
}
|
||||
|
||||
Script *SegManager::getScriptIfLoaded(const SegmentId seg) {
|
||||
Script *SegManager::getScriptIfLoaded(const SegmentId seg) const {
|
||||
if (seg < 1 || (uint)seg >= _heap.size() || !_heap[seg] || _heap[seg]->getType() != SEG_TYPE_SCRIPT)
|
||||
return 0;
|
||||
return (Script *)_heap[seg];
|
||||
}
|
||||
|
||||
SegmentId SegManager::findSegmentByType(int type) {
|
||||
SegmentId SegManager::findSegmentByType(int type) const {
|
||||
for (uint i = 0; i < _heap.size(); i++)
|
||||
if (_heap[i] && _heap[i]->getType() == type)
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SegmentObj *SegManager::getSegmentObj(SegmentId seg) {
|
||||
SegmentObj *SegManager::getSegmentObj(SegmentId seg) const {
|
||||
if (seg < 1 || (uint)seg >= _heap.size() || !_heap[seg])
|
||||
return 0;
|
||||
return _heap[seg];
|
||||
}
|
||||
|
||||
SegmentType SegManager::getSegmentType(SegmentId seg) {
|
||||
SegmentType SegManager::getSegmentType(SegmentId seg) const {
|
||||
if (seg < 1 || (uint)seg >= _heap.size() || !_heap[seg])
|
||||
return SEG_TYPE_INVALID;
|
||||
return _heap[seg]->getType();
|
||||
}
|
||||
|
||||
SegmentObj *SegManager::getSegment(SegmentId seg, SegmentType type) {
|
||||
SegmentObj *SegManager::getSegment(SegmentId seg, SegmentType type) const {
|
||||
return getSegmentType(seg) == type ? _heap[seg] : NULL;
|
||||
}
|
||||
|
||||
Object *SegManager::getObject(reg_t pos) {
|
||||
Object *SegManager::getObject(reg_t pos) const {
|
||||
SegmentObj *mobj = getSegmentObj(pos.segment);
|
||||
Object *obj = NULL;
|
||||
|
||||
|
@ -161,7 +161,7 @@ public:
|
||||
* @param seg ID of the script segment to check for
|
||||
* @return A pointer to the Script object, or NULL
|
||||
*/
|
||||
Script *getScriptIfLoaded(SegmentId seg);
|
||||
Script *getScriptIfLoaded(SegmentId seg) const;
|
||||
|
||||
// 2. Clones
|
||||
|
||||
@ -387,33 +387,33 @@ public:
|
||||
* @param type The type of the segment to find
|
||||
* @return The segment number, or -1 if the segment wasn't found
|
||||
*/
|
||||
SegmentId findSegmentByType(int type);
|
||||
SegmentId findSegmentByType(int type) const;
|
||||
|
||||
// TODO: document this
|
||||
SegmentObj *getSegmentObj(SegmentId seg);
|
||||
SegmentObj *getSegmentObj(SegmentId seg) const;
|
||||
|
||||
// TODO: document this
|
||||
SegmentType getSegmentType(SegmentId seg);
|
||||
SegmentType getSegmentType(SegmentId seg) const;
|
||||
|
||||
// TODO: document this
|
||||
SegmentObj *getSegment(SegmentId seg, SegmentType type);
|
||||
SegmentObj *getSegment(SegmentId seg, SegmentType type) const;
|
||||
|
||||
/**
|
||||
* Retrieves an object from the specified location
|
||||
* @param[in] offset Location (segment, offset) of the object
|
||||
* @return The object in question, or NULL if there is none
|
||||
*/
|
||||
Object *getObject(reg_t pos);
|
||||
Object *getObject(reg_t pos) const;
|
||||
|
||||
/**
|
||||
* Checks whether a heap address contains an object
|
||||
* @parm obj The address to check
|
||||
* @return True if it is an object, false otherwise
|
||||
*/
|
||||
bool isObject(reg_t obj) { return getObject(obj) != NULL; }
|
||||
bool isObject(reg_t obj) const { return getObject(obj) != NULL; }
|
||||
|
||||
// TODO: document this
|
||||
bool isHeapObject(reg_t pos);
|
||||
bool isHeapObject(reg_t pos) const;
|
||||
|
||||
/**
|
||||
* Determines the name of an object
|
||||
|
Loading…
Reference in New Issue
Block a user