mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 23:47:16 -05:00
fixed lint errors
This commit is contained in:
parent
90d4238f38
commit
1fc787023d
@ -260,8 +260,6 @@ func (a *App) LoadConfig() (*d2config.Configuration, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//config.SetPath(filepath.Join(configAsset.Source().Path(), configAsset.Path()))
|
||||
|
||||
a.Infof("loaded configuration file from %s", config.Path())
|
||||
|
||||
return config, nil
|
||||
@ -625,6 +623,11 @@ func (a *App) ToCreateGame(filePath string, connType d2clientconnectiontype.Clie
|
||||
a.Error(err.Error())
|
||||
}
|
||||
|
||||
if gameClient == nil {
|
||||
a.Error("could not create client")
|
||||
return
|
||||
}
|
||||
|
||||
if err = gameClient.Open(host, filePath); err != nil {
|
||||
errorMessage := fmt.Sprintf("can not connect to the host: %s", host)
|
||||
a.Error(errorMessage)
|
||||
|
@ -127,6 +127,7 @@ func (l *Loader) AddSource(path string, sourceType types.SourceType) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Exists checks if the given path exists in at least one source
|
||||
func (l *Loader) Exists(subPath string) bool {
|
||||
subPath = filepath.Clean(subPath)
|
||||
|
||||
|
@ -62,7 +62,6 @@ func TestLoader_AddSource(t *testing.T) {
|
||||
if errE == nil {
|
||||
t.Error("expecting error on bad file path")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// nolint:gocyclo // this is just a test, not a big deal if we ignore linter here
|
||||
|
@ -485,6 +485,7 @@ func (am *AssetManager) commandAssetClear([]string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadDT1 loads and returns the given path as a DT1
|
||||
func (am *AssetManager) LoadDT1(dt1Path string) (*d2dt1.DT1, error) {
|
||||
if dt1Value, found := am.dt1s.Retrieve(dt1Path); found {
|
||||
return dt1Value.(*d2dt1.DT1), nil
|
||||
@ -492,7 +493,7 @@ func (am *AssetManager) LoadDT1(dt1Path string) (*d2dt1.DT1, error) {
|
||||
|
||||
fileData, err := am.LoadFile("/data/global/tiles/" + dt1Path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Could not load /data/global/tiles/%s", dt1Path)
|
||||
return nil, fmt.Errorf("could not load /data/global/tiles/%s", dt1Path)
|
||||
}
|
||||
|
||||
dt1, err := d2dt1.LoadDT1(fileData)
|
||||
@ -507,6 +508,7 @@ func (am *AssetManager) LoadDT1(dt1Path string) (*d2dt1.DT1, error) {
|
||||
return dt1, nil
|
||||
}
|
||||
|
||||
// LoadDS1 loads and returns the given path as a DS1
|
||||
func (am *AssetManager) LoadDS1(ds1Path string) (*d2ds1.DS1, error) {
|
||||
if ds1Value, found := am.dt1s.Retrieve(ds1Path); found {
|
||||
return ds1Value.(*d2ds1.DS1), nil
|
||||
@ -527,9 +529,9 @@ func (am *AssetManager) LoadDS1(ds1Path string) (*d2ds1.DS1, error) {
|
||||
}
|
||||
|
||||
return ds1, nil
|
||||
|
||||
}
|
||||
|
||||
// LoadCOF loads and returns the given path as a COF
|
||||
func (am *AssetManager) LoadCOF(cofPath string) (*d2cof.COF, error) {
|
||||
if cofValue, found := am.cofs.Retrieve(cofPath); found {
|
||||
return cofValue.(*d2cof.COF), nil
|
||||
@ -552,6 +554,7 @@ func (am *AssetManager) LoadCOF(cofPath string) (*d2cof.COF, error) {
|
||||
return cof, nil
|
||||
}
|
||||
|
||||
// LoadDCC loads and returns the given path as a DCC
|
||||
func (am *AssetManager) LoadDCC(dccPath string) (*d2dcc.DCC, error) {
|
||||
if dccValue, found := am.dccs.Retrieve(dccPath); found {
|
||||
return dccValue.(*d2dcc.DCC), nil
|
||||
|
@ -88,11 +88,18 @@ func CreateMapRenderer(asset *d2asset.AssetManager, renderer d2interface.Rendere
|
||||
result.Camera.position = &startPosition
|
||||
result.viewport.SetCamera(&result.Camera)
|
||||
|
||||
if err := term.Bind("mapdebugvis", "set map debug visualization level", []string{"level"}, result.commandMapDebugVis); err != nil {
|
||||
var name, desc, level string
|
||||
|
||||
name, desc = "mapdebugvis", "set map debug visualization level"
|
||||
level = "level"
|
||||
|
||||
if err := term.Bind(name, desc, []string{level}, result.commandMapDebugVis); err != nil {
|
||||
result.Errorf("could not bind the mapdebugvis action, err: %v", err)
|
||||
}
|
||||
|
||||
if err := term.Bind("entitydebugvis", "set entity debug visualization level", []string{"level"}, result.commandEntityDebugVis); err != nil {
|
||||
name, desc = "entitydebugvis", "set entity debug visualization level"
|
||||
|
||||
if err := term.Bind(name, desc, []string{level}, result.commandEntityDebugVis); err != nil {
|
||||
result.Errorf("could not bind the entitydebugvis action, err: %v", err)
|
||||
}
|
||||
|
||||
|
@ -863,6 +863,7 @@ type buttonStateDescriptor struct {
|
||||
|
||||
func (v *Button) createTooltip() {
|
||||
var t *Tooltip
|
||||
|
||||
switch v.buttonLayout.Tooltip {
|
||||
case buttonTooltipNone:
|
||||
return
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
//
|
||||
// The default value is 16 and should be good for 99% usecases.
|
||||
var (
|
||||
callQueue chan func() //nolint:gochecknoglobals
|
||||
callQueue chan func() //nolint:gochecknoglobals // necessary evil for now
|
||||
)
|
||||
|
||||
func checkRun() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user