mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Ensure that all member attributes are initialized
I ran the game through cppcheck and it spat out a bunch of member attributes that weren't being initialized. So I initialized them. In the previous version of this commit, I added constructors to GraphicsResources, otherlevelclass, labclass, warpclass, and finalclass, but flibit says this changes the code flow enough that it's risky to merge before 2.4, so I got rid of those constructors, too.
This commit is contained in:
parent
3b6867243b
commit
7703b2c1c2
9 changed files with 88 additions and 21 deletions
|
@ -11,6 +11,7 @@ binaryBlob::binaryBlob()
|
||||||
{
|
{
|
||||||
numberofHeaders = 0;
|
numberofHeaders = 0;
|
||||||
SDL_memset(m_headers, 0, sizeof(m_headers));
|
SDL_memset(m_headers, 0, sizeof(m_headers));
|
||||||
|
SDL_memset(m_memblocks, 0, sizeof(m_memblocks));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VVV_COMPILEMUSIC
|
#ifdef VVV_COMPILEMUSIC
|
||||||
|
|
|
@ -19,6 +19,9 @@ blockclass::blockclass()
|
||||||
r = 0;
|
r = 0;
|
||||||
g = 0;
|
g = 0;
|
||||||
b = 0;
|
b = 0;
|
||||||
|
|
||||||
|
x = 0.0f;
|
||||||
|
y = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void blockclass::rectset(const int xi, const int yi, const int wi, const int hi)
|
void blockclass::rectset(const int xi, const int yi, const int wi, const int hi)
|
||||||
|
|
|
@ -72,6 +72,28 @@ void entityclass::init()
|
||||||
resetallflags();
|
resetallflags();
|
||||||
SDL_memset(collect, false, sizeof(collect));
|
SDL_memset(collect, false, sizeof(collect));
|
||||||
SDL_memset(customcollect, false, sizeof(customcollect));
|
SDL_memset(customcollect, false, sizeof(customcollect));
|
||||||
|
|
||||||
|
colpoint1 = point();
|
||||||
|
colpoint2 = point();
|
||||||
|
tempx = 0;
|
||||||
|
tempy = 0;
|
||||||
|
tempw = 0;
|
||||||
|
temph = 0;
|
||||||
|
temp = 0;
|
||||||
|
temp2 = 0;
|
||||||
|
tpx1 = 0;
|
||||||
|
tpy1 = 0;
|
||||||
|
tpx2 = 0;
|
||||||
|
tpy2 = 0;
|
||||||
|
x = 0;
|
||||||
|
k = 0;
|
||||||
|
dx = 0.0f;
|
||||||
|
dy = 0.0f;
|
||||||
|
dr = 0.0f;
|
||||||
|
px = 0;
|
||||||
|
py = 0;
|
||||||
|
linetemp = 0;
|
||||||
|
activetrigger = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void entityclass::resetallflags()
|
void entityclass::resetallflags()
|
||||||
|
|
|
@ -114,6 +114,8 @@ void Graphics::init()
|
||||||
tl = point();
|
tl = point();
|
||||||
towerbuffer = NULL;
|
towerbuffer = NULL;
|
||||||
towerbuffer_lerp = NULL;
|
towerbuffer_lerp = NULL;
|
||||||
|
footerbuffer = NULL;
|
||||||
|
ghostbuffer = NULL;
|
||||||
trinketr = 0;
|
trinketr = 0;
|
||||||
trinketg = 0;
|
trinketg = 0;
|
||||||
trinketb = 0;
|
trinketb = 0;
|
||||||
|
|
|
@ -109,26 +109,31 @@ void GraphicsResources::init(void)
|
||||||
|
|
||||||
void GraphicsResources::destroy(void)
|
void GraphicsResources::destroy(void)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(im_tiles);
|
#define CLEAR(img) \
|
||||||
SDL_FreeSurface(im_tiles2);
|
SDL_FreeSurface(img); \
|
||||||
SDL_FreeSurface(im_tiles3);
|
img = NULL;
|
||||||
SDL_FreeSurface(im_entcolours);
|
|
||||||
SDL_FreeSurface(im_sprites);
|
|
||||||
SDL_FreeSurface(im_flipsprites);
|
|
||||||
SDL_FreeSurface(im_bfont);
|
|
||||||
SDL_FreeSurface(im_teleporter);
|
|
||||||
|
|
||||||
SDL_FreeSurface(im_image0);
|
CLEAR(im_tiles);
|
||||||
SDL_FreeSurface(im_image1);
|
CLEAR(im_tiles2);
|
||||||
SDL_FreeSurface(im_image2);
|
CLEAR(im_tiles3);
|
||||||
SDL_FreeSurface(im_image3);
|
CLEAR(im_entcolours);
|
||||||
SDL_FreeSurface(im_image4);
|
CLEAR(im_sprites);
|
||||||
SDL_FreeSurface(im_image5);
|
CLEAR(im_flipsprites);
|
||||||
SDL_FreeSurface(im_image6);
|
CLEAR(im_bfont);
|
||||||
SDL_FreeSurface(im_image7);
|
CLEAR(im_teleporter);
|
||||||
SDL_FreeSurface(im_image8);
|
|
||||||
SDL_FreeSurface(im_image9);
|
CLEAR(im_image0);
|
||||||
SDL_FreeSurface(im_image10);
|
CLEAR(im_image1);
|
||||||
SDL_FreeSurface(im_image11);
|
CLEAR(im_image2);
|
||||||
SDL_FreeSurface(im_image12);
|
CLEAR(im_image3);
|
||||||
|
CLEAR(im_image4);
|
||||||
|
CLEAR(im_image5);
|
||||||
|
CLEAR(im_image6);
|
||||||
|
CLEAR(im_image7);
|
||||||
|
CLEAR(im_image8);
|
||||||
|
CLEAR(im_image9);
|
||||||
|
CLEAR(im_image10);
|
||||||
|
CLEAR(im_image11);
|
||||||
|
CLEAR(im_image12);
|
||||||
|
#undef CLEAR
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,8 @@ KeyPoll::KeyPoll()
|
||||||
linealreadyemptykludge = false;
|
linealreadyemptykludge = false;
|
||||||
|
|
||||||
pauseStart = 0;
|
pauseStart = 0;
|
||||||
|
|
||||||
|
isActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyPoll::enabletextentry()
|
void KeyPoll::enabletextentry()
|
||||||
|
|
|
@ -76,6 +76,21 @@ mapclass::mapclass()
|
||||||
ypos = 0;
|
ypos = 0;
|
||||||
oldypos = 0;
|
oldypos = 0;
|
||||||
bypos = 0;
|
bypos = 0;
|
||||||
|
|
||||||
|
background = 0;
|
||||||
|
cameramode = 0;
|
||||||
|
cameraseek = 0;
|
||||||
|
minitowermode = false;
|
||||||
|
scrolldir = 0;
|
||||||
|
check = 0;
|
||||||
|
cmode = 0;
|
||||||
|
towercol = 0;
|
||||||
|
tdrawback = false;
|
||||||
|
bscroll = 0;
|
||||||
|
roomtexton = false;
|
||||||
|
kludge_bypos = 0;
|
||||||
|
kludge_colstate = 0;
|
||||||
|
kludge_scrolldir = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Areamap starts at 100,100 and extends 20x20
|
//Areamap starts at 100,100 and extends 20x20
|
||||||
|
|
|
@ -132,6 +132,9 @@ void musicclass::init()
|
||||||
songEnd = 0;
|
songEnd = 0;
|
||||||
|
|
||||||
Mix_HookMusicFinished(&songend);
|
Mix_HookMusicFinished(&songend);
|
||||||
|
|
||||||
|
mmmmmm = false;
|
||||||
|
usingmmmmmm = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void songend()
|
void songend()
|
||||||
|
|
|
@ -13,6 +13,20 @@ textboxclass::textboxclass()
|
||||||
tm = 0;
|
tm = 0;
|
||||||
timer = 0;
|
timer = 0;
|
||||||
allowspecial = false;
|
allowspecial = false;
|
||||||
|
|
||||||
|
xp = 0;
|
||||||
|
yp = 0;
|
||||||
|
r = 0;
|
||||||
|
g = 0;
|
||||||
|
b = 0;
|
||||||
|
tr = 0;
|
||||||
|
tg = 0;
|
||||||
|
tb = 0;
|
||||||
|
max = 0;
|
||||||
|
textrect.x = 0;
|
||||||
|
textrect.y = 0;
|
||||||
|
textrect.w = 0;
|
||||||
|
textrect.h = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void textboxclass::centerx()
|
void textboxclass::centerx()
|
||||||
|
|
Loading…
Reference in a new issue