Apply all golangci-lint fixes
This commit is contained in:
parent
945b3299ac
commit
75910efbe5
8 changed files with 19 additions and 22 deletions
|
@ -144,19 +144,6 @@ func (a *Atlas) setObject(chunk int, local vector.Vector, object objects.Object)
|
|||
a.Chunks[chunk] = c
|
||||
}
|
||||
|
||||
// setTileAndObject sets both tile and object information for location in chunk
|
||||
func (a *Atlas) setTileAndObject(chunk int, local vector.Vector, tile byte, object objects.Object) {
|
||||
c := a.Chunks[chunk]
|
||||
if c.Tiles == nil {
|
||||
c.populate(a.ChunkSize)
|
||||
}
|
||||
|
||||
i := a.chunkTileIndex(local)
|
||||
c.Tiles[i] = tile
|
||||
c.Objects[i] = object
|
||||
a.Chunks[chunk] = c
|
||||
}
|
||||
|
||||
// worldSpaceToChunkLocal gets a chunk local coordinate for a tile
|
||||
func (a *Atlas) worldSpaceToChunkLocal(v vector.Vector) vector.Vector {
|
||||
return vector.Vector{X: maths.Pmod(v.X, a.ChunkSize), Y: maths.Pmod(v.Y, a.ChunkSize)}
|
||||
|
|
|
@ -60,7 +60,7 @@ func (d Bearing) ShortString() string {
|
|||
// FromString gets the Direction from a string
|
||||
func FromString(s string) (Bearing, error) {
|
||||
for i, d := range bearingStrings {
|
||||
if strings.ToLower(d.Long) == strings.ToLower(s) || strings.ToLower(d.Short) == strings.ToLower(s) {
|
||||
if strings.EqualFold(d.Long, s) || strings.EqualFold(d.Short, s) {
|
||||
return Bearing(i), nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ func TestWorld_GetSetMovePosition(t *testing.T) {
|
|||
// Place a tile in front of the rover
|
||||
world.Atlas.SetObject(vector.Vector{X: 0, Y: 2}, objects.Object{Type: objects.LargeRock})
|
||||
newPos, err = world.MoveRover(a, b)
|
||||
assert.NoError(t, err, "Failed to move rover")
|
||||
assert.Equal(t, pos, newPos, "Failed to correctly not move position for rover into wall")
|
||||
|
||||
rover, err = world.GetRover(a)
|
||||
|
@ -168,7 +169,9 @@ func TestWorld_RoverStash(t *testing.T) {
|
|||
|
||||
// Recharge the rover
|
||||
for i := 0; i < rover.MaximumCharge; i++ {
|
||||
world.RoverRecharge(a)
|
||||
_, err = world.RoverRecharge(a)
|
||||
assert.NoError(t, err)
|
||||
|
||||
}
|
||||
|
||||
// Place an object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue