Fixes #14. mtseeder and mtwebmapper now have command line flags -ymin=block and -ymax=block to limit the y range of mapping. Defaults to full range.

This commit is contained in:
Sascha L. Teichmann
2015-07-27 19:03:47 +02:00
parent 464ccbf670
commit e606e2700f
6 changed files with 66 additions and 28 deletions

View File

@ -32,6 +32,8 @@ func main() {
websockets bool
playersFIFO string
version bool
yMin int
yMax int
)
flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
flag.IntVar(&webPort, "p", 8808, "port of the web server (shorthand)")
@ -64,6 +66,8 @@ func main() {
flag.BoolVar(&websockets, "ws", false, "Forward tile changes to clients via websockets (shorthand).")
flag.StringVar(&playersFIFO, "players", "", "Path to FIFO file to read active players from.")
flag.StringVar(&playersFIFO, "ps", "", "Path to FIFO file to read active players from (shorthand).")
flag.IntVar(&yMin, "ymin", common.MinHeight, "Minimum y in blocks.")
flag.IntVar(&yMax, "ymax", common.MaxHeight, "Maximum y in blocks.")
flag.BoolVar(&version, "version", false, "Print version and exit.")
flag.Parse()
@ -113,6 +117,7 @@ func main() {
redisAddress,
allowedUpdateIps,
colors,
yMin, yMax,
transparent,
workers,
btu)

View File

@ -35,6 +35,7 @@ type tileUpdater struct {
redisAddress string
ips []net.IP
colors *common.Colors
yMin, yMax int16
workers int
transparent bool
cond *sync.Cond
@ -71,6 +72,7 @@ func newTileUpdater(
mapDir, redisAddress string,
ips []net.IP,
colors *common.Colors,
yMin, yMax int,
transparent bool,
workers int,
btu baseTilesUpdates) *tileUpdater {
@ -82,6 +84,8 @@ func newTileUpdater(
ips: ips,
changes: map[xz]bool{},
colors: colors,
yMin: int16(yMin),
yMax: int16(yMax),
transparent: transparent,
workers: workers}
tu.cond = sync.NewCond(&tu.mu)
@ -166,7 +170,10 @@ func (tu *tileUpdater) doUpdates() {
log.Printf("WARN: Cannot connect to redis server: %s\n", err)
continue
}
btc := common.NewBaseTileCreator(client, tu.colors, tu.transparent, baseDir, true)
btc := common.NewBaseTileCreator(
client, tu.colors,
tu.yMin, tu.yMax,
tu.transparent, baseDir, true)
done.Add(1)
go updateBaseTiles(jobs, btc, &done)
}