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

@ -1,6 +1,8 @@
package gamemap
import (
"fmt"
"lab.zaar.be/thefish/alchemyst-go/engine/ecs"
"lab.zaar.be/thefish/alchemyst-go/engine/types"
"lab.zaar.be/thefish/alchemyst-go/util/appctx"
@ -28,7 +30,7 @@ func (l *Level) GetTileNbs (coords types.Coords) []*Tile {
result := make([]*Tile,0)
for i := coords.X-1; i < coords.X+1; i++ {
for j := coords.Y-1; j < coords.Y+1; j++ {
nbc := types.Coords{i,j}
nbc := types.Coords{X: i,Y: j}
if l.InBounds(nbc){
if nbc == coords {
continue
@ -66,14 +68,14 @@ func (l *Level) Put (x, y int, tileFunc interface{}) {
if tile == nil {
appctx.Logger().Fatal().Msgf("Got non-tile type to put into level: %v", tile)
}
if l.InBounds(types.Coords{x, y}) {
if l.InBounds(types.Coords{X: x, Y: y}) {
l.Tiles[y*l.W+x] = tile
}
}
func NewLevel(branch string, depth int) *Level {
l := &Level{
Name: branch + string(depth),
Name: fmt.Sprintf(branch, depth),
Depth: depth,
Rect: types.NewRect(0,0, mapWidth, mapHeight),
}
@ -84,13 +86,13 @@ func NewLevel(branch string, depth int) *Level {
}
func (l *Level) SetAllInvisible() {
for idx, _ := range l.Tiles {
for idx := range l.Tiles {
l.Tiles[idx].Visible = false
}
}
func (l *Level) SetAllVisible() {
for idx, _ := range l.Tiles {
for idx := range l.Tiles {
l.Tiles[idx].Visible = true
}
}