Fixed crashing in OpenGL mode

Fixed crashing at exiting game
This commit is contained in:
Pali Rohár 2010-10-15 16:09:51 +02:00
parent 119effc50a
commit b9002ed7ac
2 changed files with 13 additions and 6 deletions

View file

@ -519,6 +519,7 @@ void CMinimap::Update(void)
int my;
int n;
int visiontype; // 0 unexplored, 1 explored, >1 visible.
int bpp;
red_phase_changed = red_phase != (int)((FrameCounter / FRAMES_PER_SECOND) & 1);
if (red_phase_changed) {
@ -535,6 +536,9 @@ void CMinimap::Update(void)
}
if (!UseOpenGL) {
bpp = MinimapSurface->format->BytesPerPixel;
} else {
bpp = 0;
}
//
@ -561,7 +565,6 @@ void CMinimap::Update(void)
}
if ( visiontype == 0 || (visiontype == 1 && ((mx & 1) != (my & 1)))) {
const int bpp = MinimapSurface->format->BytesPerPixel;
if (!UseOpenGL) {
if (bpp == 2) {
*(Uint16 *)&((Uint8 *)MinimapSurface->pixels)[mx * bpp + my * MinimapSurface->pitch] =

View file

@ -128,12 +128,16 @@ void initGuichan()
*/
void freeGuichan()
{
delete Gui->getGraphics();
delete Gui;
delete Input;
if ( Gui ) {
delete Gui->getGraphics();
delete Gui;
Gui = NULL;
}
Gui = NULL;
Input = NULL;
if ( Input ) {
delete Input;
Input = NULL;
}
}
/**