aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/script.h
diff options
context:
space:
mode:
authorMax Horn2010-06-28 11:22:20 +0000
committerMax Horn2010-06-28 11:22:20 +0000
commit30218a2c324bc67f724100051ab9884a351928fb (patch)
tree38b0a0b7a3a723d82a295ac75caf84204ad3c826 /engines/sci/engine/script.h
parent85038e7d6c272555c54d9f4b87665392bfa96aaf (diff)
downloadscummvm-rg350-30218a2c324bc67f724100051ab9884a351928fb.tar.gz
scummvm-rg350-30218a2c324bc67f724100051ab9884a351928fb.tar.bz2
scummvm-rg350-30218a2c324bc67f724100051ab9884a351928fb.zip
SCI: Make Script member vars private; add const qualifiers
Only three Script members remain public (for now) svn-id: r50428
Diffstat (limited to 'engines/sci/engine/script.h')
-rw-r--r--engines/sci/engine/script.h54
1 files changed, 28 insertions, 26 deletions
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index 296570c218..aab073f3a1 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -51,19 +51,12 @@ enum ScriptObjectTypes {
typedef Common::HashMap<uint16, Object> ObjMap;
class Script : public SegmentObj {
-public:
+private:
int _nr; /**< Script number */
byte *_buf; /**< Static data buffer, or NULL if not used */
byte *_heapStart; /**< Start of heap if SCI1.1, NULL otherwise */
- uint32 getScriptSize() { return _scriptSize; }
- uint32 getHeapSize() { return _heapSize; }
- uint32 getBufSize() { return _bufSize; }
-
-protected:
int _lockers; /**< Number of classes and objects that require this script */
-
-private:
size_t _scriptSize;
size_t _heapSize;
uint16 _bufSize;
@@ -77,19 +70,27 @@ private:
int _localsOffset;
uint16 _localsCount;
+ bool _markedAsDeleted;
+
public:
/**
* Table for objects, contains property variables.
* Indexed by the TODO offset.
*/
ObjMap _objects;
+ SegmentId _localsSegment; /**< The local variable segment */
+ LocalVariables *_localsBlock;
+public:
int getLocalsOffset() const { return _localsOffset; }
uint16 getLocalsCount() const { return _localsCount; }
- SegmentId _localsSegment; /**< The local variable segment */
- LocalVariables *_localsBlock;
- bool _markedAsDeleted;
+ uint32 getScriptSize() const { return _scriptSize; }
+ uint32 getHeapSize() const { return _heapSize; }
+ uint32 getBufSize() const { return _bufSize; }
+ const byte *getBuf(uint offset = 0) const { return _buf + offset; }
+
+ int getScriptNumber() const { return _nr; }
public:
Script();
@@ -130,15 +131,6 @@ public:
void scriptObjRemove(reg_t obj_pos);
/**
- * Processes a relocation block witin a script
- * This function is idempotent, but it must only be called after all
- * objects have been instantiated, or a run-time error will occur.
- * @param obj_pos Location (segment, offset) of the block
- * @return Location of the relocation block
- */
- void relocate(reg_t block);
-
- /**
* Initializes the script's local variables
* @param segMan A reference to the segment manager
*/
@@ -153,19 +145,17 @@ public:
/**
* Initializes the script's objects (SCI0)
* @param segMan A reference to the segment manager
+ * @param segmentId The script's segment id
*/
- void initialiseObjectsSci0(SegManager *segMan);
+ void initialiseObjectsSci0(SegManager *segMan, SegmentId segmentId);
/**
* Initializes the script's objects (SCI1.1+)
* @param segMan A reference to the segment manager
+ * @param segmentId The script's segment id
*/
- void initialiseObjectsSci11(SegManager *segMan);
-
-private:
- bool relocateLocal(SegmentId segment, int location);
+ void initialiseObjectsSci11(SegManager *segMan, SegmentId segmentId);
-public:
// script lock operations
/** Increments the number of lockers of this script by one. */
@@ -246,6 +236,18 @@ public:
* Finds the pointer where a block of a specific type starts from
*/
byte *findBlock(int type);
+
+private:
+ /**
+ * Processes a relocation block witin a script
+ * This function is idempotent, but it must only be called after all
+ * objects have been instantiated, or a run-time error will occur.
+ * @param obj_pos Location (segment, offset) of the block
+ * @return Location of the relocation block
+ */
+ void relocate(reg_t block);
+
+ bool relocateLocal(SegmentId segment, int location);
};
} // End of namespace Sci