laneya2

cave exploration game
git clone https://git.ce9e.org/laneya2.git

commit
a5308ddd4a7239545d33390055e73b624cd17223
parent
72467473f3a9f8bdda08369c3682faea1feb7c56
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-04-26 20:08
ignore message on invalid player/monster

instead of stopping the game

Diffstat

M game.go 4 ++--

1 files changed, 2 insertions, 2 deletions


diff --git a/game.go b/game.go

@@ -308,7 +308,7 @@ func (game *Game) run() {
  308   308 			}
  309   309 		case pmsg := <-game.Msg:
  310   310 			if _, ok := game.Players[pmsg.Player]; !ok {
  311    -1 				return
   -1   311 				continue
  312   312 			}
  313   313 			if pmsg.Msg["action"] == "move" {
  314   314 				dir, ok := pmsg.Msg["dir"].(string)
@@ -332,7 +332,7 @@ func (game *Game) run() {
  332   332 			}
  333   333 		case monster := <-game.MMsg:
  334   334 			if _, ok := game.Monsters[monster]; !ok {
  335    -1 				return
   -1   335 				continue
  336   336 			}
  337   337 			monster.Move()
  338   338 		}