Can't plant flower over existing flower.
This commit is contained in:
parent
9f19e4bd92
commit
905aad2afa
5
game.go
5
game.go
@ -163,6 +163,11 @@ func (g *Game) Load() {
|
|||||||
func (g *Game) Pause() { g.setSpeed(GameSpeedPaused) }
|
func (g *Game) Pause() { g.setSpeed(GameSpeedPaused) }
|
||||||
|
|
||||||
func (g *Game) PlantFlower(id string, tile Point) {
|
func (g *Game) PlantFlower(id string, tile Point) {
|
||||||
|
if g.Terrain.HasFlower(tile) {
|
||||||
|
// TODO: notify user it tried to plant on tile with flower?
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
flower, ok := g.Herbarium.Find(id)
|
flower, ok := g.Herbarium.Find(id)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Println("user was able to plant a flower that doesn't exist")
|
log.Println("user was able to plant a flower that doesn't exist")
|
||||||
|
5
map.go
5
map.go
@ -24,6 +24,11 @@ func (m *Map) DigFlower(pos Point) string {
|
|||||||
return flower.ID
|
return flower.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Map) HasFlower(pos Point) bool {
|
||||||
|
_, ok := m.Flowers[pos]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Map) NewFlower(pos Point, id string, traits FlowerTraits) Flower {
|
func (m *Map) NewFlower(pos Point, id string, traits FlowerTraits) Flower {
|
||||||
flower := Flower{
|
flower := Flower{
|
||||||
ID: id,
|
ID: id,
|
||||||
|
Loading…
Reference in New Issue
Block a user