blob: f4ec11c76a2139f7ee80c6ebad383f7f9b8af1e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package game
import (
"thirdcollapse/internal/net"
"thirdcollapse/internal/player"
)
func (g *Game) doMap(sess *net.Session) {
p := sess.Player.(*player.Player)
mapWidth := p.OptionInt("mapwidth")
mapHeight := p.OptionInt("mapheight")
if mapWidth < 5 {
mapWidth = 5
}
if mapHeight < 5 {
mapHeight = 5
}
lines := buildFullMap(g, p.RoomID, mapWidth, mapHeight, mapGlyphsForPlayer(p.OptionBool("unicode")))
mode := p.OptionString("mappadding")
if mode == "none" || mode == "x" {
lines = stripBlankRows(lines)
}
if mode == "none" || mode == "y" {
lines = leftTrimCommon(lines)
}
if len(lines) == 0 {
sess.WriteLine("\nNo map data to display.")
return
}
sess.WriteLine("")
for _, line := range lines {
sess.WriteLine(line)
}
}
|