From 218c7c3ffb939d9e23b9670dd57a4c71b2385308 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 4 Jul 2013 11:41:42 +0200 Subject: AVALANCHE: Gyro: change void* to byte*, make memory handling more C++-like. --- engines/avalanche/gyro2.cpp | 16 ++++++++-------- engines/avalanche/gyro2.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'engines/avalanche') diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 04a1d1425f..078eb1c14d 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -252,11 +252,11 @@ Gyro::Gyro() : interrogation(0), oncandopageswap(true) { Gyro::~Gyro() { /* These are allocated in Gyro::setup_vmc */ - free(vmc.andpic); - free(vmc.xorpic); + delete[] vmc.andpic; + delete[] vmc.xorpic; for (int fv = 0; fv < 2; fv ++) { - free(vmc.backpic[fv]); + delete[] vmc.backpic[fv]; } } @@ -480,11 +480,11 @@ void Gyro::wipe_vmc(byte page_) { } void Gyro::setup_vmc() { - vmc.andpic = malloc(mouse_size); - vmc.xorpic = malloc(mouse_size); + vmc.andpic = new byte[mouse_size]; + vmc.xorpic = new byte[mouse_size]; for (int fv = 0; fv < 2; fv ++) { - vmc.backpic[fv] = malloc(mouse_size); + vmc.backpic[fv] = new byte[mouse_size]; vmc.wherewas[fv].x = 32767; } } @@ -512,10 +512,10 @@ void Gyro::load_a_mouse(byte which) { f.seek(mouse_size * 2 * (which - 1) + 134); for (int i = 0; i < mouse_size; i++) - ((byte *) vmc.andpic)[i] = f.readByte(); + vmc.andpic[i] = f.readByte(); for (int i = 0; i < mouse_size; i++) - ((byte *) vmc.xorpic)[i] = f.readByte(); + vmc.xorpic[i] = f.readByte(); f.close(); diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 719d04875f..4aab2236da 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -230,8 +230,8 @@ struct PointType { }; struct vmctype { /* Virtual Mouse Cursor */ - void *andpic, *xorpic; - void *backpic[2]; + byte *andpic, *xorpic; + byte *backpic[2]; PointType wherewas[2]; byte picnumber; int8 ofsx, ofsy; -- cgit v1.2.3