Fixed an issue with progressbars (#3945)

Additionally if progress was being canceled and a message window was active, the user would be stuck, because no close button would show.

Fixes #3944

Thanks to @teededung, @cahya1992 and @Atemo
This commit is contained in:
Lemongrass3110 2019-02-18 19:31:05 +01:00 committed by GitHub
parent 51d5d9f5ca
commit fc92a97978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10794,19 +10794,32 @@ void clif_progressbar_abort(struct map_session_data * sd)
}
/// Notification from the client, that the progress bar has reached 100% (CZ_PROGRESS).
/// 02f1
void clif_parse_progressbar(int fd, struct map_session_data * sd)
{
int npc_id = sd->progressbar.npc_id;
/// Notification from the client, that the progress bar has reached 100%.
/// 02f1 (CZ_PROGRESS)
void clif_parse_progressbar(int fd, struct map_session_data * sd){
// No progressbar active, ignore it
if( !sd->progressbar.npc_id ){
return;
}
if( gettick() < sd->progressbar.timeout && sd->st )
sd->st->state = END;
int npc_id = sd->progressbar.npc_id;
bool closing = false;
// Check if the progress was canceled
if( gettick() < sd->progressbar.timeout && sd->st ){
closing = true;
sd->st->state = CLOSE; // will result in END in npc_scriptcont
// If a message window was open, offer a close button to the user
if( sd->st->mes_active ){
clif_scriptclose( sd, npc_id );
}
}
sd->progressbar.npc_id = 0;
sd->progressbar.timeout = 0;
sd->state.workinprogress = WIP_DISABLE_NONE;
npc_scriptcont(sd, npc_id, false);
npc_scriptcont(sd, npc_id, closing);
}
/// Displays cast-like progress bar on a NPC