diff --git a/game/things.go b/game/things.go index 147cebe..e87ddff 100644 --- a/game/things.go +++ b/game/things.go @@ -544,19 +544,7 @@ func (g *RogueGame) addLinePaged(line string, isFlush bool) { } if pg.lineCnt >= NumLines-1 || isFlush { - if g.Options.InvType == InvOver && isFlush && !pg.newpage { - g.addLineOverlay(prompt) - } else { - g.scr.Hw.MvAddStr(NumLines-1, 0, prompt) - g.scr.RefreshWin(g.scr.Hw) - g.waitFor(' ') - g.scr.Hw.Clear() - g.refresh() - } - - pg.newpage = true - pg.lineCnt = 0 - pg.maxlen = len(prompt) + g.addLinePageBreak(prompt, isFlush) } if !isFlush && (pg.lineCnt != 0 || line != "") { @@ -571,6 +559,25 @@ func (g *RogueGame) addLinePaged(line string, isFlush bool) { } } +// addLinePageBreak prompts at a full page and starts a fresh one +// (things.c add_line). +func (g *RogueGame) addLinePageBreak(prompt string, isFlush bool) { + pg := &g.invPage + if g.Options.InvType == InvOver && isFlush && !pg.newpage { + g.addLineOverlay(prompt) + } else { + g.scr.Hw.MvAddStr(NumLines-1, 0, prompt) + g.scr.RefreshWin(g.scr.Hw) + g.waitFor(' ') + g.scr.Hw.Clear() + g.refresh() + } + + pg.newpage = true + pg.lineCnt = 0 + pg.maxlen = len(prompt) +} + // addLineOverlay draws the accumulated list in a box at the top right // of the screen, prompts, and restores what was beneath (things.c // add_line).