1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2025-01-26 19:27:31 -05:00

Merge pull request #920 from juander-ux/fix-singleplayer-button-crash

d2gamescreen/char_select: Fix crash on double clicking singleplayer
This commit is contained in:
Tim Sarbin 2020-11-13 09:43:25 -05:00 committed by GitHub
commit ef6f90c01c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,6 +47,7 @@ type CharacterSelect struct {
tickTimer float64 tickTimer float64
storedTickTimer float64 storedTickTimer float64
showDeleteConfirmation bool showDeleteConfirmation bool
loaded bool
connectionType d2clientconnectiontype.ClientConnectionType connectionType d2clientconnectiontype.ClientConnectionType
connectionHost string connectionHost string
@ -195,6 +196,7 @@ func (v *CharacterSelect) OnLoad(loading d2screen.LoadingState) {
} }
v.refreshGameStates() v.refreshGameStates()
v.loaded = true
} }
func (v *CharacterSelect) loadBackground() { func (v *CharacterSelect) loadBackground() {
@ -421,6 +423,10 @@ func (v *CharacterSelect) moveSelectionBox() {
// OnMouseButtonDown is called when a mouse button is clicked // OnMouseButtonDown is called when a mouse button is clicked
func (v *CharacterSelect) OnMouseButtonDown(event d2interface.MouseEvent) bool { func (v *CharacterSelect) OnMouseButtonDown(event d2interface.MouseEvent) bool {
if !v.loaded {
return false
}
if v.showDeleteConfirmation { if v.showDeleteConfirmation {
return false return false
} }
@ -547,5 +553,7 @@ func (v *CharacterSelect) OnUnload() error {
return err return err
} }
v.loaded = false
return nil return nil
} }