Revert change in r4767 that moved radar initialization from stage

two to stage three, since this caused bug #11578: segfault in radar.c
reported by Jan Dittberner.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4775 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-04-26 12:07:07 +00:00
parent 3914e26f1b
commit f39e1617ba
2 changed files with 18 additions and 12 deletions

View File

@ -879,6 +879,13 @@ BOOL stageTwoInitialise(void)
LOADBARCALLBACK(); // loadingScreenCallback();
if(!InitRadar()) // After resLoad cause it needs the game palette initialised.
{
return false;
}
LOADBARCALLBACK(); // loadingScreenCallback();
if(!initMiscImds()) /* Set up the explosions */
{
iV_ShutDown();
@ -968,6 +975,10 @@ BOOL stageTwoShutDown(void)
}
if(!ShutdownRadar()) {
return false;
}
intShutDown();
cmdDroidShutDown();
@ -1018,13 +1029,6 @@ BOOL stageThreeInitialise(void)
game.maxPlayers = 0;
}
if (!InitRadar()) // After resLoad cause it needs the game palette initialised.
{
return false;
}
LOADBARCALLBACK(); // loadingScreenCallback();
preProcessVisibility();
closeLoadingScreen(); // reset the loading screen.
@ -1154,11 +1158,6 @@ BOOL stageThreeShutDown(void)
initPlayerColours(); // reset colours leaving multiplayer game.
}
if (!ShutdownRadar())
{
return false;
}
setScriptWinLoseVideo(PLAY_NONE);
return true;

View File

@ -132,6 +132,7 @@ void resetRadarRedraw(void)
BOOL InitRadar(void)
{
radarBuffer = malloc(RADWIDTH * RADHEIGHT * sizeof(UDWORD));
ASSERT(radarBuffer, "Out of memory");
if (radarBuffer == NULL)
{
return false;
@ -317,6 +318,12 @@ void drawRadar(void)
UWORD boxSizeH,boxSizeV;
static int frameSkip = 0;
ASSERT(radarBuffer, "No radar buffer allocated");
if (!radarBuffer)
{
return;
}
CalcRadarPixelSize(&boxSizeH,&boxSizeV);
CalcRadarScroll(boxSizeH,boxSizeV);