CGE: Fix some GCC compile errors and warnings.

This commit is contained in:
eriktorbjorn 2011-06-27 19:25:24 +02:00
parent 571c3fc666
commit 315bbd348d
7 changed files with 19 additions and 15 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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:

View File

@ -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);
}

View File

@ -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

View File

@ -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);

View File

@ -37,7 +37,7 @@ namespace CGE {
typedef struct {
char *Text;
const char *Text;
void (CGEEngine::*Proc)();
} CHOICE;