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

@ -13,7 +13,7 @@ type ViewPort struct {
func NewViewPort(x, y, w, h int) *ViewPort {
vp := ViewPort{
Rect: types.Rect{x, y, w, h},
Rect: types.Rect{X: x, Y: y, W: w, H: h},
}
return &vp
}
@ -47,8 +47,8 @@ func (vp *ViewPort) ToVPCoords(c types.Coords) (newCoords types.Coords, err erro
//coords on map to coords on vp
x, y := c.X-vp.CameraCoords.X, c.Y-vp.CameraCoords.Y
if x < 0 || y < 0 || x > vp.W || y > vp.H {
return types.Coords{-1, -1}, fmt.Errorf("Not in viewport: {%d, %d}", x, y)
return types.Coords{X: -1, Y: -1}, fmt.Errorf("Not in viewport: {%d, %d}", x, y)
}
return types.Coords{x, y}, nil
return types.Coords{X: x, Y: y}, nil
}