diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-05-22 17:09:26 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-05-22 17:09:26 -0300 |
| commit | c595a2c2935b5bfcb2c08cc9ec4a22db55bd1ff7 (patch) | |
| tree | 71cfc1618994dcfce80a2d9d31412992eaf8eaa4 /src/script.hh | |
| parent | 74f12f3f2bb6cafc25ba1e943d01583b1ac0d766 (diff) | |
| download | game-c595a2c2935b5bfcb2c08cc9ec4a22db55bd1ff7.tar.gz game-c595a2c2935b5bfcb2c08cc9ec4a22db55bd1ff7.zip | |
implement TReadStream, TReadBuffer, and TReadBinaryFile
Diffstat (limited to 'src/script.hh')
| -rw-r--r-- | src/script.hh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/script.hh b/src/script.hh index 0a83196..42ddd2e 100644 --- a/src/script.hh +++ b/src/script.hh @@ -101,4 +101,35 @@ struct TWriteScriptFile { int Line; }; +struct TReadBinaryFile: TReadStream { + // REGULAR FUNCTIONS + // ========================================================================= + TReadBinaryFile(void); + void open(char *FileName); + int close(void); + void error(char *Text); + int getPosition(void); + int getSize(void); + void seek(int Offset); + + // VIRTUAL FUNCTIONS + // ========================================================================= + // TODO(fusion): `TReadStream` itself doesn't have a destructor on its VTABLE + // which makes me think there is something else going on here or the compiler + // optimized it away because it was never used but it seems problematic. + virtual ~TReadBinaryFile(void) override; // VTABLE[8] + // Duplicate destructor that also calls operator delete. // VTABLE[9] + + uint8 readByte(void) override; + void readBytes(uint8 *Buffer, int Count) override; + bool eof(TReadBinaryFile *this) override; + void skip(int Count) override; + + // DATA + // ========================================================================= + FILE *File; + char Filename[4096]; + int FileSize; +}; + #endif //TIBIA_SCRIPT_HH_ |
