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:
@@ -37,7 +37,7 @@ func (g *RogueGame) newMonster(tp *Monster, typ byte, cp Coord) {
|
||||
tp.Pos = cp
|
||||
g.move(cp.Y, cp.X)
|
||||
tp.OldCh = g.inch()
|
||||
tp.Room = g.roomin(cp)
|
||||
tp.Room = g.roomIn(cp)
|
||||
g.Level.SetMonsterAt(cp.Y, cp.X, tp)
|
||||
mp := &g.Monsters[tp.Type-'A']
|
||||
tp.Stats.Lvl = mp.Stats.Lvl + levAdd
|
||||
@@ -57,7 +57,7 @@ func (g *RogueGame) newMonster(tp *Monster, typ byte, cp Coord) {
|
||||
tp.Pack = nil
|
||||
|
||||
if g.Player.IsWearing(RingAggravateMonsters) {
|
||||
g.runto(cp)
|
||||
g.runTo(cp)
|
||||
}
|
||||
|
||||
if typ == 'X' {
|
||||
@@ -92,7 +92,7 @@ func (g *RogueGame) wanderer() {
|
||||
var cp Coord
|
||||
for {
|
||||
cp, _ = g.findFloor(true)
|
||||
if g.roomin(cp) != g.Player.Room {
|
||||
if g.roomIn(cp) != g.Player.Room {
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ func (g *RogueGame) wanderer() {
|
||||
g.standend()
|
||||
}
|
||||
|
||||
g.runto(tp.Pos)
|
||||
g.runTo(tp.Pos)
|
||||
}
|
||||
|
||||
// wakeMonster is what to do when the hero steps next to a monster
|
||||
|
||||
Reference in New Issue
Block a user