(svn r27627) -Codechange: Deduplicate some cursor magic into SetMouseCursorBusy.

pull/155/head
frosch 8 years ago
parent 93d5995bed
commit 2337d169e8

@ -77,7 +77,7 @@ static void CleanupGeneration()
{
_generating_world = false;
if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
SetMouseCursorBusy(false);
/* Show all vital windows again, because we have hidden them */
if (_gw.threaded && _game_mode != GM_MENU) ShowVitalWindows();
SetModalProgress(false);

@ -1190,7 +1190,7 @@ struct GenerateProgressWindow : public Window {
{
switch (widget) {
case WID_GP_ABORT:
if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
SetMouseCursorBusy(false);
ShowQuery(
STR_GENERATION_ABORT_CAPTION,
STR_GENERATION_ABORT_MESSAGE,

@ -1572,6 +1572,19 @@ void CursorTick()
}
}
/**
* Set or unset the ZZZ cursor.
* @param busy Whether to show the ZZZ cursor.
*/
void SetMouseCursorBusy(bool busy)
{
if (busy) {
if (_cursor.sprite == SPR_CURSOR_MOUSE) SetMouseCursor(SPR_CURSOR_ZZZ, PAL_NONE);
} else {
if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
}
}
/**
* Assign a single non-animated sprite to the cursor.
* @param sprite Sprite to draw for the cursor.

@ -145,6 +145,7 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
/* window.cpp */
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
void SetMouseCursorBusy(bool busy);
void SetMouseCursor(CursorID cursor, PaletteID pal);
void SetAnimatedMouseCursor(const AnimCursor *table);
void CursorTick();

@ -2460,7 +2460,7 @@ static void SaveFileStart()
{
_sl.ff_state = _fast_forward;
_fast_forward = 0;
if (_cursor.sprite == SPR_CURSOR_MOUSE) SetMouseCursor(SPR_CURSOR_ZZZ, PAL_NONE);
SetMouseCursorBusy(true);
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SAVELOAD_START);
_sl.saveinprogress = true;
@ -2470,7 +2470,7 @@ static void SaveFileStart()
static void SaveFileDone()
{
if (_game_mode != GM_MENU) _fast_forward = _sl.ff_state;
if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
SetMouseCursorBusy(false);
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SAVELOAD_FINISH);
_sl.saveinprogress = false;

Loading…
Cancel
Save