mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(svn r2344) - Fix (regression): [ 1197216 ] Error: !invalid string id 0 in GetString. Dedicated server also had the endgame window shown and because now it is properly no-player anymore it crashed.
This commit is contained in:
parent
1c22cea02d
commit
d3ce687daf
47
player_gui.c
47
player_gui.c
@ -800,14 +800,13 @@ static void EndGameWndProc(Window *w, WindowEvent *e)
|
|||||||
DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640);
|
DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case WE_CLICK: { /* OnClick show the highscore chart */
|
case WE_CLICK: /* Close the window (and show the highscore window) */
|
||||||
int diff = w->window_number; // save values because deletewindow is called
|
|
||||||
int8 rank = WP(w, highscore_d).rank;
|
|
||||||
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
|
|
||||||
DeleteWindow(w);
|
DeleteWindow(w);
|
||||||
|
break;
|
||||||
ShowHighscoreTable(diff, rank);
|
case WE_DESTROY: /* Show the highscore window when this one is closed */
|
||||||
} break;
|
if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
|
||||||
|
ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -841,15 +840,17 @@ static void HighScoreWndProc(Window *w, WindowEvent *e)
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK: /* Onclick get back all hidden windows */
|
case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */
|
||||||
if (_game_mode != GM_MENU && !_networking)
|
|
||||||
ShowVitalWindows();
|
|
||||||
|
|
||||||
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
|
|
||||||
DeleteWindow(w);
|
DeleteWindow(w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WE_DESTROY: /* Get back all the hidden windows */
|
||||||
|
if (_game_mode != GM_MENU) ShowVitalWindows();
|
||||||
|
|
||||||
|
if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static const Widget _highscore_widgets[] = {
|
static const Widget _highscore_widgets[] = {
|
||||||
{ WWT_PANEL, RESIZE_NONE, 16, 0, 640, 0, 480, 0x0, STR_NULL},
|
{ WWT_PANEL, RESIZE_NONE, 16, 0, 640, 0, 480, 0x0, STR_NULL},
|
||||||
@ -879,12 +880,11 @@ void ShowHighscoreTable(int difficulty, int8 ranking)
|
|||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
|
|
||||||
if (!_networking) { // pause game to show chart
|
// pause game to show the chart
|
||||||
DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
|
if (!_networking) DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
|
||||||
/* Close all always on-top windows to get a clean screen */
|
|
||||||
if (_game_mode != GM_MENU)
|
/* Close all always on-top windows to get a clean screen */
|
||||||
HideVitalWindows();
|
if (_game_mode != GM_MENU) HideVitalWindows();
|
||||||
}
|
|
||||||
|
|
||||||
DeleteWindowById(WC_HIGHSCORE_ENDSCREEN, 0);
|
DeleteWindowById(WC_HIGHSCORE_ENDSCREEN, 0);
|
||||||
w = AllocateWindowDesc(&_highscore_desc);
|
w = AllocateWindowDesc(&_highscore_desc);
|
||||||
@ -903,11 +903,12 @@ void ShowEndGameChart(void)
|
|||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
|
|
||||||
if (!_networking) { // pause the game and hide all windows to show end-chart
|
/* Dedicated server doesn't need the highscore window */
|
||||||
DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
|
if (_network_dedicated) return;
|
||||||
HideVitalWindows();
|
/* Pause in single-player to have a look at the highscore at your own leisure */
|
||||||
}
|
if (!_networking) DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
|
||||||
|
|
||||||
|
HideVitalWindows();
|
||||||
DeleteWindowById(WC_HIGHSCORE_ENDSCREEN, 0);
|
DeleteWindowById(WC_HIGHSCORE_ENDSCREEN, 0);
|
||||||
w = AllocateWindowDesc(&_endgame_desc);
|
w = AllocateWindowDesc(&_endgame_desc);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user