aboutsummaryrefslogtreecommitdiff
path: root/src/script.hh
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-05-22 19:03:45 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-05-22 19:03:45 -0300
commit4e41f79a50b18b4e9b9fa00bbfa68ecb15fcb63e (patch)
tree7ca2a0f7c3977ba4e2e530a599fc5332a0ae9712 /src/script.hh
parentc595a2c2935b5bfcb2c08cc9ec4a22db55bd1ff7 (diff)
downloadgame-4e41f79a50b18b4e9b9fa00bbfa68ecb15fcb63e.tar.gz
game-4e41f79a50b18b4e9b9fa00bbfa68ecb15fcb63e.zip
implement TWriteStream, T(Dynamic)WriteBuffer, and TWriteBinaryFile
Diffstat (limited to 'src/script.hh')
-rw-r--r--src/script.hh36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/script.hh b/src/script.hh
index 42ddd2e..16e66fe 100644
--- a/src/script.hh
+++ b/src/script.hh
@@ -114,17 +114,17 @@ struct TReadBinaryFile: TReadStream {
// 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;
+ // TODO(fusion): Appended virtual functions. These are not in the base class
+ // VTABLE which can be problematic if we intend to use polymorphism, although
+ // that doesn't seem to be case.
+ virtual ~TReadBinaryFile(void) override; // VTABLE[8]
+ // Duplicate destructor that also calls operator delete. // VTABLE[9]
+
// DATA
// =========================================================================
FILE *File;
@@ -132,4 +132,28 @@ struct TReadBinaryFile: TReadStream {
int FileSize;
};
+struct TWriteBinaryFile: TWriteStream {
+ // REGULAR FUNCTIONS
+ // =========================================================================
+ TWriteBinaryFile(void);
+ void open(char *FileName);
+ void close(void);
+ void error(char *Text);
+
+ // VIRTUAL FUNCTIONS
+ // =========================================================================
+ void writeByte(uint8 Byte) override;
+ void writeBytes(uint8 *Buffer, int Count) override;
+
+ // TODO(fusion): Appended virtual functions. These are not in the base class
+ // VTABLE which can be problematic if we intend to use polymorphism, although
+ // that doesn't seem to be case.
+ virtual ~TWriteBinaryFile(void);
+
+ // DATA
+ // =========================================================================
+ FILE *File;
+ char Filename[4096];
+};
+
#endif //TIBIA_SCRIPT_HH_