From 315bbd348d490d3edf6f5dcfb58ffcc9ecde83b3 Mon Sep 17 00:00:00 2001 From: eriktorbjorn Date: Mon, 27 Jun 2011 19:25:24 +0200 Subject: CGE: Fix some GCC compile errors and warnings. --- engines/cge/cge_main.cpp | 2 +- engines/cge/general.cpp | 19 +++++++++++-------- engines/cge/general.h | 3 ++- engines/cge/mixer.cpp | 4 ++-- engines/cge/snail.cpp | 2 +- engines/cge/vga13h.h | 2 +- engines/cge/vmenu.h | 2 +- 7 files changed, 19 insertions(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index cd8a8ff9df..90b14d2c70 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -652,7 +652,7 @@ static void PostMiniStep(int stp) { } void SYSTEM::SetPal(void) { - int i; + uint i; DAC *p = VGA::SysPal + 256 - ArrayCount(StdPal); for (i = 0; i < ArrayCount(StdPal); i++) { p[i].R = StdPal[i].R >> 2; diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp index b07ddbc362..1bf4bcd982 100644 --- a/engines/cge/general.cpp +++ b/engines/cge/general.cpp @@ -215,6 +215,7 @@ char *dwtom(uint32 val, char *str, int radix, int len) { IOHAND::IOHAND(IOMODE mode, CRYPT *crpt) : XFILE(mode), Crypt(crpt), Seed(SEED) { + _file = new Common::File(); } IOHAND::IOHAND(const char *name, IOMODE mode, CRYPT *crpt) @@ -222,18 +223,20 @@ IOHAND::IOHAND(const char *name, IOMODE mode, CRYPT *crpt) // TODO: Check if WRI and/or UPD modes are needed, and map to a save file assert(mode == REA); - _file.open(name); + _file = new Common::File(); + _file->open(name); } IOHAND::~IOHAND(void) { - _file.close(); + _file->close(); + delete _file; } uint16 IOHAND::Read(void *buf, uint16 len) { - if (Mode == WRI || !_file.isOpen()) + if (Mode == WRI || !_file->isOpen()) return 0; - uint16 bytesRead = _file.read(buf, len); + uint16 bytesRead = _file->read(buf, len); if (Crypt) Seed = Crypt(buf, len, Seed); return bytesRead; } @@ -255,16 +258,16 @@ uint16 IOHAND::Write(void *buf, uint16 len) { } long IOHAND::Mark(void) { - return _file.pos(); + return _file->pos(); } long IOHAND::Seek(long pos) { - _file.seek(pos, SEEK_SET); - return _file.pos(); + _file->seek(pos, SEEK_SET); + return _file->pos(); } long IOHAND::Size(void) { - return _file.size(); + return _file->size(); } bool IOHAND::Exist(const char *name) { diff --git a/engines/cge/general.h b/engines/cge/general.h index 6fb8e24f9c..4946e40c7b 100644 --- a/engines/cge/general.h +++ b/engines/cge/general.h @@ -173,6 +173,7 @@ public: virtual long Mark(void) = 0; virtual long Size(void) = 0; virtual long Seek(long pos) = 0; + virtual ~XFILE() { } }; @@ -184,7 +185,7 @@ inline uint16 XRead(XFILE *xf, T *t) { class IOHAND : public XFILE { protected: - Common::File _file; + Common::File *_file; uint16 Seed; CRYPT *Crypt; public: diff --git a/engines/cge/mixer.cpp b/engines/cge/mixer.cpp index 864fb6cdba..ecdd2b7533 100644 --- a/engines/cge/mixer.cpp +++ b/engines/cge/mixer.cpp @@ -54,7 +54,7 @@ MIXER::MIXER(CGEEngine *vm, int x, int y) : SPRITE(vm, NULL), Fall(MIX_FALL), _v // slaves - int i; + uint i; for (i = 0; i < MIX_MAX; i++) { static char fn[] = "V00"; wtom(i, fn + 1, 10, 2); @@ -124,7 +124,7 @@ void MIXER::Tick(void) { if (Fall) --Fall; else { - for (int i = 0; i < ArrayCount(Led); i++) + for (uint i = 0; i < ArrayCount(Led); i++) SNPOST_(SNKILL, -1, 0, Led[i]); SNPOST_(SNKILL, -1, 0, this); } diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 24ed08c140..0137ab4cfa 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -92,7 +92,7 @@ static void SNGame(SPRITE *spr, int num) { ++ Stage; if (hand && Stage > DRESSED) ++hand; - if (i >= 0 || dup[i] == spr && new_random(3) == 0) { + if (i >= 0 || (dup[i] == spr && new_random(3) == 0)) { SNPOST(SNSEQ, -1, 3, dup[0]); // yes SNPOST(SNSEQ, -1, 3, dup[1]); // yes SNPOST(SNSEQ, -1, 3, dup[2]); // yes diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index cf4252e5c2..c984e121e8 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -270,7 +270,7 @@ public: QUEUE *ShowQ, *SpareQ; int Mono; static Graphics::Surface *Page[4]; - static DAC *VGA::SysPal; + static DAC *SysPal; VGA(int mode); ~VGA(void); diff --git a/engines/cge/vmenu.h b/engines/cge/vmenu.h index 61645d2c55..3c38576a40 100644 --- a/engines/cge/vmenu.h +++ b/engines/cge/vmenu.h @@ -37,7 +37,7 @@ namespace CGE { typedef struct { - char *Text; + const char *Text; void (CGEEngine::*Proc)(); } CHOICE; -- cgit v1.2.3