Rename movement/world methods to idiomatic Go; remove all gotos
Refactor step 4. Renames (C breadcrumbs kept in doc comments): doMove→moveHero, beTrapped→springTrap, rndmove→randomStep, doRooms→digRooms, doPassages→digPassages, doMaze→digMaze, chgStr→changeStrength, doRun→startRun, moveStuff→finishMove, turnref→turnRefresh, moveMonst→moveMonster, doChase→chaseStep, setOldch→setOldChar, cansee→canSee, roomin→roomIn, runto→runTo, conn→connectRooms, putpass→putPassage, passnum→numberPassages, numpass→numberPassage, rndPos→randomPos, rndRoom→randomRoom, treasRoom→treasureRoom, accntMaze→accountMaze. All goto/label flows are gone: moveHero uses a retry loop with the PASSGO corner logic extracted into passageTurn; dispatch re-dispatches via a loop; chaseStep re-checks via a loop; saveGame uses a labeled prompt loop. Control flow and RNG call order are unchanged; suite green.
This commit is contained in:
@@ -80,7 +80,7 @@ func (g *RogueGame) doZap() {
|
||||
case WandInvisibility:
|
||||
tp.Flags.Set(Invisible)
|
||||
|
||||
if g.cansee(y, x) {
|
||||
if g.canSee(y, x) {
|
||||
g.mvaddch(y, x, tp.OldCh)
|
||||
}
|
||||
case WandPolymorph:
|
||||
@@ -186,7 +186,7 @@ func (g *RogueGame) doZap() {
|
||||
|
||||
g.Delta.Y = y
|
||||
g.Delta.X = x
|
||||
g.runto(g.Delta)
|
||||
g.runTo(g.Delta)
|
||||
}
|
||||
case WandLightning, WandFire, WandCold:
|
||||
var name string
|
||||
@@ -243,7 +243,7 @@ func (g *RogueGame) drain() {
|
||||
if mp.Stats.HP -= cnt; mp.Stats.HP <= 0 {
|
||||
g.killed(mp, g.seeMonst(mp))
|
||||
} else {
|
||||
g.runto(mp.Pos)
|
||||
g.runTo(mp.Pos)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,7 +339,7 @@ func (g *RogueGame) fireBolt(start Coord, dir *Coord, name string) {
|
||||
}
|
||||
} else if ch != 'M' || tp.Disguise == 'M' {
|
||||
if fromHero {
|
||||
g.runto(pos)
|
||||
g.runTo(pos)
|
||||
}
|
||||
|
||||
if g.Options.Terse {
|
||||
|
||||
Reference in New Issue
Block a user