Compare commits

..

No commits in common. "1008b7b34bad0b9ace53d88a679d64ee643d2e47" and "cc8f8da5dfaef58342d3de432b6b89567fab77ce" have entirely different histories.

4 changed files with 3 additions and 17 deletions

View File

@ -163,11 +163,6 @@ func (g *Game) Load() {
func (g *Game) Pause() { g.setSpeed(GameSpeedPaused) }
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)
if !ok {
log.Println("user was able to plant a flower that doesn't exist")

View File

@ -87,10 +87,7 @@ func (c *GameControls) Init(ctx *Context) error {
c.game.SpeedChanged().RegisterItf(c.speedChanged)
c.game.ToolChanged().RegisterItf(c.toolChanged)
c.dialogs.DialogOpened().Register(func() { c.game.Pause() })
c.dialogs.DialogClosed().Register(func() {
c.updateFlowerControls(ctx)
c.game.Resume()
})
c.dialogs.DialogClosed().Register(func() { c.game.Resume() })
c.flowers.Background = MustHexColor("#356dad")
c.flowers.ButtonLength = 64

5
map.go
View File

@ -24,11 +24,6 @@ func (m *Map) DigFlower(pos Point) string {
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 {
flower := Flower{
ID: id,

View File

@ -42,13 +42,12 @@ func (r *terrainRenderer) Handle(ctx *Context, event sdl.Event) bool {
case *sdl.MouseButtonEvent:
if r.project.windowInteractRect.IsPointInside(e.X, e.Y) {
if e.Type == sdl.MOUSEBUTTONDOWN {
controlKeyDown := isControlKeyDown()
if e.Button == sdl.BUTTON_MIDDLE || (e.Button == sdl.BUTTON_LEFT && controlKeyDown) {
if e.Button == sdl.BUTTON_MIDDLE || (e.Button == sdl.BUTTON_LEFT && isControlKeyDown()) {
if !r.drag.IsDragging() {
r.drag.Start(Pt(e.X, e.Y))
}
}
if e.Button == sdl.BUTTON_LEFT && !controlKeyDown {
if e.Button == sdl.BUTTON_LEFT {
pos := r.project.screenToMapInt(e.X, e.Y)
r.game.UserClickedTile(pos)
}