diagnostic tool fixes

This commit is contained in:
2024-04-22 13:52:17 +03:00
parent 4f18b6db18
commit dc2e6ea2b5
20 changed files with 178 additions and 160 deletions

View File

@ -62,7 +62,7 @@ func (pp *precomputedPermissive) ComputeFov(coords types.Coords, radius int) {
func (pp *precomputedPermissive) PrecomputeFovMap() {
max := pp.MaxTorchRadius
minusMax := (-1) * max
zeroCoords := types.Coords{0, 0}
zeroCoords := types.Coords{X: 0, Y: 0}
var x, y int
//fill list
for x = minusMax; x < max+1; x++ {
@ -70,7 +70,7 @@ func (pp *precomputedPermissive) PrecomputeFovMap() {
if x == 0 && y == 0 {
continue;
}
iterCoords := types.Coords{x, y}
iterCoords := types.Coords{X: x, Y: y}
distance := zeroCoords.DistanceTo(iterCoords)
if distance <= float64(max) {
pp.CellList = append(pp.CellList, &Cell{iterCoords, distance, nil})
@ -101,7 +101,7 @@ func (pp *precomputedPermissive) PrecomputeFovMap() {
roundedX := int(basic.Round(lineX))
roundedY := int(basic.Round(lineY))
idx, cell, err := pp.FindByCoords(types.Coords{roundedX, roundedY})
idx, cell, err := pp.FindByCoords(types.Coords{X: roundedX, Y: roundedY})
if err != nil {
//inexistent coord found
break;

View File

@ -8,12 +8,12 @@ import (
)
func TestPsDistance(t *testing.T) {
iterCoords := types.Coords{0, 0}
iterCoords := types.Coords{X: 0, Y: 0}
fmt.Printf("\n dto: \t %v", iterCoords.DistanceTo(types.Coords{0, 1}))
fmt.Printf("\n dto: \t %v", iterCoords.DistanceTo(types.Coords{0, 5}))
fmt.Printf("\n dto: \t %v", iterCoords.DistanceTo(types.Coords{3, 3}))
fmt.Printf("\n dto: \t %v", iterCoords.DistanceTo(types.Coords{100, 0}))
fmt.Printf("\n dto: \t %v", iterCoords.DistanceTo(types.Coords{X: 0, Y: 1}))
fmt.Printf("\n dto: \t %v", iterCoords.DistanceTo(types.Coords{X: 0, Y: 5}))
fmt.Printf("\n dto: \t %v", iterCoords.DistanceTo(types.Coords{X: 3, Y: 3}))
fmt.Printf("\n dto: \t %v", iterCoords.DistanceTo(types.Coords{X: 100, Y: 0}))
}
func TestPrecompShade(t *testing.T) {
@ -44,7 +44,7 @@ func TestPrecompShade(t *testing.T) {
}
}
playerCoords := types.Coords{10, 10}
playerCoords := types.Coords{X: 10, Y: 10}
level.SetTileByXY(8, 12, gamemap.NewWall())
level.SetTileByXY(10, 8, gamemap.NewWall())