From 44b4eef64040da0384945f805fbe5118f0846ea4 Mon Sep 17 00:00:00 2001 From: NatureFreshMilk Date: Fri, 8 Feb 2019 08:11:06 +0100 Subject: [PATCH] fix initial rendering glitch --- server/mapblockaccessor/mapblockaccessor.go | 9 +++++++++ server/settings/settings_test.go | 6 ++++++ server/tilerendererjob/common.go | 3 ++- server/tilerendererjob/initial.go | 6 +++--- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/server/mapblockaccessor/mapblockaccessor.go b/server/mapblockaccessor/mapblockaccessor.go index 957e833..ae2e0bd 100644 --- a/server/mapblockaccessor/mapblockaccessor.go +++ b/server/mapblockaccessor/mapblockaccessor.go @@ -177,6 +177,15 @@ func (a *MapBlockAccessor) FindMapBlocksByPos(lastpos *coords.MapBlockCoords, li result.LastPos = newlastpos result.List = mblist + fields = logrus.Fields{ + "len(List)": len(result.List), + "unfilteredCount": result.UnfilteredCount, + "hasMore": result.HasMore, + "limit": limit, + } + logrus.WithFields(fields).Debug("FindMapBlocksByPos:Result") + + return &result, nil } diff --git a/server/settings/settings_test.go b/server/settings/settings_test.go index 311d570..1e81de6 100644 --- a/server/settings/settings_test.go +++ b/server/settings/settings_test.go @@ -46,6 +46,12 @@ func TestStrings(t *testing.T){ t.Fatal("getint failed") } + s.SetInt("i3", -123) + i = s.GetInt("i3", 456) + if i != -123 { + t.Fatal("getint negative failed") + } + if s.GetInt("i2", 111) != 111 { t.Fatal("getint with default failed") } diff --git a/server/tilerendererjob/common.go b/server/tilerendererjob/common.go index 8f110cc..78ab901 100644 --- a/server/tilerendererjob/common.go +++ b/server/tilerendererjob/common.go @@ -10,7 +10,8 @@ import ( ) func getTileKey(tc *coords.TileCoords) string { - return strconv.Itoa(tc.X) + "/" + strconv.Itoa(tc.Y) + "/" + strconv.Itoa(tc.Zoom) + return strconv.Itoa(tc.X) + "/" + strconv.Itoa(tc.Y) + "/" + + strconv.Itoa(tc.Zoom) + "/" + strconv.Itoa(tc.LayerId) } func renderMapblocks(ctx *app.App, jobs chan *coords.TileCoords, mblist []*mapblockparser.MapBlock) int { diff --git a/server/tilerendererjob/initial.go b/server/tilerendererjob/initial.go index 667d3b2..0caa6f7 100644 --- a/server/tilerendererjob/initial.go +++ b/server/tilerendererjob/initial.go @@ -26,9 +26,9 @@ func initialRender(ctx *app.App, jobs chan *coords.TileCoords) { } logrus.WithFields(fields).Info("Starting initial rendering job") - lastx := ctx.Settings.GetInt(settings.SETTING_LASTX, -1) - lasty := ctx.Settings.GetInt(settings.SETTING_LASTY, -1) - lastz := ctx.Settings.GetInt(settings.SETTING_LASTZ, -1) + lastx := ctx.Settings.GetInt(settings.SETTING_LASTX, coords.MinCoord-1) + lasty := ctx.Settings.GetInt(settings.SETTING_LASTY, coords.MinCoord-1) + lastz := ctx.Settings.GetInt(settings.SETTING_LASTZ, coords.MinCoord-1) lastcoords := coords.NewMapBlockCoords(lastx, lasty, lastz)