mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-18 02:16:23 -05:00
* Return errors for #790 * Fixing lint issues * Returning nil instead of empty struct pointer
This commit is contained in:
parent
4506380dbb
commit
fb8e25ebdb
@ -612,9 +612,11 @@ func (a *App) ToCreateGame(filePath string, connType d2clientconnectiontype.Clie
|
|||||||
|
|
||||||
// ToCharacterSelect forces the game to transition to the Character Select (load character) screen
|
// ToCharacterSelect forces the game to transition to the Character Select (load character) screen
|
||||||
func (a *App) ToCharacterSelect(connType d2clientconnectiontype.ClientConnectionType, connHost string) {
|
func (a *App) ToCharacterSelect(connType d2clientconnectiontype.ClientConnectionType, connHost string) {
|
||||||
// https://github.com/OpenDiablo2/OpenDiablo2/issues/790
|
characterSelect, err := d2gamescreen.CreateCharacterSelect(a, a.asset, a.renderer, a.inputManager,
|
||||||
characterSelect := d2gamescreen.CreateCharacterSelect(a, a.asset, a.renderer, a.inputManager,
|
|
||||||
a.audio, a.ui, connType, connHost)
|
a.audio, a.ui, connType, connHost)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("unable to create character select screen: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
a.screen.SetNextScreen(characterSelect)
|
a.screen.SetNextScreen(characterSelect)
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,16 @@ func CreateCharacterSelect(
|
|||||||
ui *d2ui.UIManager,
|
ui *d2ui.UIManager,
|
||||||
connectionType d2clientconnectiontype.ClientConnectionType,
|
connectionType d2clientconnectiontype.ClientConnectionType,
|
||||||
connectionHost string,
|
connectionHost string,
|
||||||
) *CharacterSelect {
|
) (*CharacterSelect, error) {
|
||||||
// https://github.com/OpenDiablo2/OpenDiablo2/issues/790
|
playerStateFactory, err := d2hero.NewHeroStateFactory(asset)
|
||||||
playerStateFactory, _ := d2hero.NewHeroStateFactory(asset)
|
if err != nil {
|
||||||
entityFactory, _ := d2mapentity.NewMapEntityFactory(asset)
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
entityFactory, err := d2mapentity.NewMapEntityFactory(asset)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &CharacterSelect{
|
return &CharacterSelect{
|
||||||
selectedCharacter: -1,
|
selectedCharacter: -1,
|
||||||
@ -84,7 +90,7 @@ func CreateCharacterSelect(
|
|||||||
navigator: navigator,
|
navigator: navigator,
|
||||||
uiManager: ui,
|
uiManager: ui,
|
||||||
HeroStateFactory: playerStateFactory,
|
HeroStateFactory: playerStateFactory,
|
||||||
}
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Loading…
Reference in New Issue
Block a user