go: port foundation — types, RNG, tables, daemon scheduler

Module sneak.berlin/go/rogue, package game:
- types.go: all rogue.h constants, flag types, Coord/Stats/Room/ObjInfo
- creature.go/object.go: the THING union split into Creature (Player/
  Monster) and Object; slices replace the C linked lists
- level.go: Place map with the C column-major layout and chat/flat/moat/
  winat access methods
- tables.go: extern.c + init.c data (bestiary, item tables, name pools)
- rng.go: the exact C LCG (seed*11109+13849), golden-tested against a
  compiled C reference for seed compatibility
- init.go: per-game item appearance randomization (init.c)
- daemon.go/daemons.go: scheduler with DaemonID replacing function
  pointers (ids match the C save format's mapping)
- game.go: RogueGame holds all former globals; NewGame constructor
This commit is contained in:
2026-07-06 18:46:22 +02:00
parent 45dba95678
commit 7fa2048402
13 changed files with 1535 additions and 0 deletions

17
game/daemons.go Normal file
View File

@@ -0,0 +1,17 @@
package game
// daemons.c — the daemon and fuse callbacks. Each callback is ported in the
// phase that owns its subsystem; runDaemon is the dispatch switch that
// replaces the C function pointers.
// runDaemon invokes the callback named by id (the call through d_func in C).
func (g *RogueGame) runDaemon(id DaemonID, arg int) {
_ = arg
switch id {
default:
// Callbacks are added to this switch as their subsystems are
// ported; reaching one that isn't here is a porting bug, not a
// game state.
panic("daemon not yet ported")
}
}