AGOS: Silence GCC memset() warnings

Recent GCC versions complain if you memset() a class or struct that
contain non-POD data types. Get around that by either initializing
the object when created, or by adding a reset() method.
This commit is contained in:
Torbjörn Andersson 2019-01-05 20:12:17 +01:00 committed by Filippos Karapetis
parent 71a9def71e
commit b5b136b177
2 changed files with 13 additions and 2 deletions

View File

@ -132,7 +132,18 @@ struct VgaSprite {
uint16 priority;
uint16 windowNum;
uint16 zoneNum;
VgaSprite() { memset(this, 0, sizeof(*this)); }
VgaSprite() { reset(); }
void reset() {
id = 0;
image = 0;
palette = 0;
x = y = 0;
flags = 0;
priority = 0;
windowNum = 0;
zoneNum = 0;
}
};
struct VgaSleepStruct {

View File

@ -1083,7 +1083,7 @@ void AGOSEngine::vc27_resetSprite() {
_lastVgaWaitFor = 0;
memset(&bak, 0, sizeof(bak));
bak.reset();
vsp = _vgaSprites;
while (vsp->id) {