diagnostic tool fixes
This commit is contained in:
@ -3,12 +3,13 @@ package gamemap
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/items"
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/mob"
|
||||
"lab.zaar.be/thefish/alchemyst-go/engine/types"
|
||||
"lab.zaar.be/thefish/alchemyst-go/util"
|
||||
"lab.zaar.be/thefish/alchemyst-go/util/appctx"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var invalidBlit = errors.New("trying to blit on existing good tile")
|
||||
@ -27,7 +28,7 @@ func (r *Room) Put (x, y int, tileFunc interface{}) {
|
||||
if tf == nil {
|
||||
return //fixme error
|
||||
}
|
||||
if r.InBounds(types.Coords{x, y}) {
|
||||
if r.InBounds(types.Coords{X: x, Y: y}) {
|
||||
r.Geometry[x+y*r.W] = tf
|
||||
}
|
||||
}
|
||||
@ -39,7 +40,7 @@ func (room *Room) BlitToLevel(l *Level) error {
|
||||
for j := 0; j < room.H; j++ {
|
||||
|
||||
for i := 0; i < room.W; i++ {
|
||||
mapCoords := types.Coords{room.X + i, room.Y + j}
|
||||
mapCoords := types.Coords{X: room.X + i, Y: room.Y + j}
|
||||
underlyingTile := l.GetTile(mapCoords)
|
||||
|
||||
tileFunc := room.Geometry[i+j*room.W]
|
||||
@ -85,17 +86,17 @@ func NewRandomRectRoom(rng *util.RNG, w, h int, fillage types.RectFill) Room {
|
||||
w,
|
||||
h,
|
||||
),
|
||||
Center: types.Coords{w / 2, h /2 },
|
||||
Center: types.Coords{X: w / 2, Y: h /2 },
|
||||
Geometry: make([]func()*Tile, w*h),
|
||||
}
|
||||
newRoom.Blit(fillage, &newRoom)
|
||||
//add connectors
|
||||
newRoom.Connectors = append(
|
||||
newRoom.Connectors,
|
||||
types.Coords{rng.Range(1, w - 2), 1},
|
||||
types.Coords{rng.Range(1, w - 2), h -2},
|
||||
types.Coords{1, rng.Range(1, h - 2)},
|
||||
types.Coords{w - 2, rng.Range(1, h - 2)},
|
||||
types.Coords{X: rng.Range(1, w - 2), Y: 1},
|
||||
types.Coords{X: rng.Range(1, w - 2), Y: h -2},
|
||||
types.Coords{X: 1, Y: rng.Range(1, h - 2)},
|
||||
types.Coords{X: w - 2, Y: rng.Range(1, h - 2)},
|
||||
)
|
||||
return newRoom
|
||||
}
|
||||
@ -104,7 +105,7 @@ func (r *Room) String() string {
|
||||
return strings.Join([]string{
|
||||
"room: ",
|
||||
"\t" + fmt.Sprintf(" rect: X: %d, Y: %d, maxX: %d, maxY: %d", r.Rect.X, r.Rect.Y, r.Rect.W + r.X - 1, r.Rect.H + r.Y - 1),
|
||||
"\t" + fmt.Sprintf(" center:", r.Center.X, r.Center.Y),
|
||||
"\t" + fmt.Sprintf(" center: %d, %d", r.Center.X, r.Center.Y),
|
||||
"\t" + fmt.Sprintf(" Connectors: %v", r.Connectors),
|
||||
},"\n") + "\n"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user