Rename the glyphs

This commit is contained in:
Marc Di Luzio 2020-07-19 11:56:05 +01:00
parent f665436007
commit 7e41ac0028
7 changed files with 52 additions and 52 deletions

View file

@ -29,11 +29,11 @@ func (t Tile) Glyph() Glyph {
case TileNone:
return GlyphNone
case TileRock:
return GlyphRock
return GlyphGroundRock
case TileGravel:
return GlyphGravel
return GlyphGroundGravel
case TileSand:
return GlyphSand
return GlyphGroundSand
}
log.Fatalf("Unknown tile type: %c", t)

View file

@ -185,14 +185,14 @@ func TestAtlas_GetSetObject(t *testing.T) {
assert.NotNil(t, a)
// Set the origin tile to 1 and test it
a.SetObject(maths.Vector{X: 0, Y: 0}, Object{Type: ObjectLargeRock})
a.SetObject(maths.Vector{X: 0, Y: 0}, Object{Type: ObjectRockLarge})
_, obj := a.QueryPosition(maths.Vector{X: 0, Y: 0})
assert.Equal(t, Object{Type: ObjectLargeRock}, obj)
assert.Equal(t, Object{Type: ObjectRockLarge}, obj)
// Set another tile to 1 and test it
a.SetObject(maths.Vector{X: 5, Y: -2}, Object{Type: ObjectSmallRock})
a.SetObject(maths.Vector{X: 5, Y: -2}, Object{Type: ObjectRockSmall})
_, obj = a.QueryPosition(maths.Vector{X: 5, Y: -2})
assert.Equal(t, Object{Type: ObjectSmallRock}, obj)
assert.Equal(t, Object{Type: ObjectRockSmall}, obj)
}
func TestAtlas_Grown(t *testing.T) {
@ -238,11 +238,11 @@ func TestAtlas_GetSetCorrect(t *testing.T) {
pos := maths.Vector{X: x, Y: y}
a.SetTile(pos, TileRock)
a.SetObject(pos, Object{Type: ObjectLargeRock})
a.SetObject(pos, Object{Type: ObjectRockLarge})
tile, obj := a.QueryPosition(pos)
assert.Equal(t, TileRock, Tile(tile))
assert.Equal(t, Object{Type: ObjectLargeRock}, obj)
assert.Equal(t, Object{Type: ObjectRockLarge}, obj)
}
}

View file

@ -123,9 +123,9 @@ func (a *chunkBasedAtlas) populate(chunk int) {
var obj = ObjectNone
switch {
case o > 0.6:
obj = ObjectLargeRock
obj = ObjectRockLarge
case o > 0.5:
obj = ObjectSmallRock
obj = ObjectRockSmall
}
if obj != ObjectNone {
c.Objects[j*a.ChunkSize+i] = Object{Type: ObjectType(obj)}
@ -136,9 +136,9 @@ func (a *chunkBasedAtlas) populate(chunk int) {
// Set up any objects
for i := 0; i < len(c.Tiles); i++ {
if rand.Intn(16) == 0 {
c.Objects[i] = Object{Type: ObjectLargeRock}
c.Objects[i] = Object{Type: ObjectRockLarge}
} else if rand.Intn(32) == 0 {
c.Objects[i] = Object{Type: ObjectSmallRock}
c.Objects[i] = Object{Type: ObjectRockSmall}
}
}

View file

@ -7,21 +7,21 @@ const (
// GlyphNone is a keyword for nothing
GlyphNone = Glyph(0)
// GlyphRock is solid rock ground
GlyphRock = Glyph('-')
// GlyphGroundRock is solid rock ground
GlyphGroundRock = Glyph('-')
// GlyphGravel is loose rocks
GlyphGravel = Glyph(':')
// GlyphGroundGravel is loose rocks
GlyphGroundGravel = Glyph(':')
// GlyphSand is sand
GlyphSand = Glyph('~')
// GlyphGroundSand is sand
GlyphGroundSand = Glyph('~')
// GlyphRover represents a live rover
GlyphRover = Glyph('R')
// GlyphRoverLive represents a live rover
GlyphRoverLive = Glyph('R')
// GlyphSmallRock is a small stashable rock
GlyphSmallRock = Glyph('o')
// GlyphRockSmall is a small stashable rock
GlyphRockSmall = Glyph('o')
// GlyphLargeRock is a large blocking rock
GlyphLargeRock = Glyph('O')
// GlyphRockLarge is a large blocking rock
GlyphRockLarge = Glyph('O')
)

View file

@ -11,13 +11,13 @@ const (
ObjectNone = iota
// ObjectRover represents a live rover
ObjectRover
ObjectRoverLive
// ObjectSmallRock is a small stashable rock
ObjectSmallRock
ObjectRockSmall
// ObjectLargeRock is a large blocking rock
ObjectLargeRock
ObjectRockLarge
)
// Glyph returns the glyph for this object type
@ -25,12 +25,12 @@ func (o ObjectType) Glyph() Glyph {
switch o {
case ObjectNone:
return GlyphNone
case ObjectRover:
return GlyphRover
case ObjectSmallRock:
return GlyphSmallRock
case ObjectLargeRock:
return GlyphLargeRock
case ObjectRoverLive:
return GlyphRoverLive
case ObjectRockSmall:
return GlyphRockSmall
case ObjectRockLarge:
return GlyphRockLarge
}
log.Fatalf("Unknown object type: %c", o)
@ -46,8 +46,8 @@ type Object struct {
// IsBlocking checks if an object is a blocking object
func (o *Object) IsBlocking() bool {
var blocking = [...]ObjectType{
ObjectRover,
ObjectLargeRock,
ObjectRoverLive,
ObjectRockLarge,
}
for _, t := range blocking {
@ -61,7 +61,7 @@ func (o *Object) IsBlocking() bool {
// IsStashable checks if an object is stashable
func (o *Object) IsStashable() bool {
var stashable = [...]ObjectType{
ObjectSmallRock,
ObjectRockSmall,
}
for _, t := range stashable {