mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 01:00:18 +01:00
Terminate all log.Printf with a new line.
This commit is contained in:
parent
91a50a4622
commit
ecd599e44d
@ -31,7 +31,7 @@ func (ct *ChangeTracker) BlockChanged(key []byte) {
|
|||||||
var err error
|
var err error
|
||||||
var coord common.Coord
|
var coord common.Coord
|
||||||
if coord, err = common.DecodeStringBytesToCoord(key); err != nil {
|
if coord, err = common.DecodeStringBytesToCoord(key); err != nil {
|
||||||
log.Printf("decoding key failed: %s", err)
|
log.Printf("decoding key failed: %s\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ct.mutex.Lock()
|
ct.mutex.Lock()
|
||||||
@ -63,12 +63,12 @@ func (ct *ChangeTracker) FlushChanges(url string) {
|
|||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
encoder := json.NewEncoder(&buf)
|
encoder := json.NewEncoder(&buf)
|
||||||
if err = encoder.Encode(changes); err != nil {
|
if err = encoder.Encode(changes); err != nil {
|
||||||
log.Printf("WARN: encode changes to JSON failed: %s", err)
|
log.Printf("WARN: encode changes to JSON failed: %s\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, err = http.Post(
|
if _, err = http.Post(
|
||||||
url, "application/json", bytes.NewBuffer(buf.Bytes())); err != nil {
|
url, "application/json", bytes.NewBuffer(buf.Bytes())); err != nil {
|
||||||
log.Printf("WARN: posting changes to %s failed: %s", url, err)
|
log.Printf("WARN: posting changes to %s failed: %s\n", url, err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
return
|
return
|
||||||
|
@ -285,7 +285,7 @@ func (ldbs *LevelDBSession) plainSpatialQuery(first, second []byte, done chan st
|
|||||||
pos int64
|
pos int64
|
||||||
)
|
)
|
||||||
if pos, err = common.DecodeStringFromBytes(key); err != nil {
|
if pos, err = common.DecodeStringFromBytes(key); err != nil {
|
||||||
log.Printf("decoding key failed: %s", err)
|
log.Printf("decoding key failed: %s\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if pos > to {
|
if pos > to {
|
||||||
@ -298,7 +298,7 @@ func (ldbs *LevelDBSession) plainSpatialQuery(first, second []byte, done chan st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err = it.GetError(); err != nil {
|
if err = it.GetError(); err != nil {
|
||||||
log.Printf("iterating failed: %s", err)
|
log.Printf("iterating failed: %s\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,7 +345,7 @@ func (ldbs *LevelDBSession) interleavedSpatialQuery(first, second []byte, done c
|
|||||||
encodedKey []byte
|
encodedKey []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
//log.Printf("seeking to: %d", zmin)
|
//log.Printf("seeking to: %d\n", zmin)
|
||||||
it.Seek(common.ToBigEndian(zmin))
|
it.Seek(common.ToBigEndian(zmin))
|
||||||
for it.Valid() {
|
for it.Valid() {
|
||||||
zcode := common.FromBigEndian(it.Key())
|
zcode := common.FromBigEndian(it.Key())
|
||||||
@ -356,7 +356,7 @@ func (ldbs *LevelDBSession) interleavedSpatialQuery(first, second []byte, done c
|
|||||||
|
|
||||||
if c := common.InterleavedToCoord(zcode); cub.Contains(c) {
|
if c := common.InterleavedToCoord(zcode); cub.Contains(c) {
|
||||||
if encodedKey, err = common.EncodeStringToBytes(common.CoordToPlain(c)); err != nil {
|
if encodedKey, err = common.EncodeStringToBytes(common.CoordToPlain(c)); err != nil {
|
||||||
log.Printf("error encoding key: %s", err)
|
log.Printf("error encoding key: %s\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
@ -367,14 +367,14 @@ func (ldbs *LevelDBSession) interleavedSpatialQuery(first, second []byte, done c
|
|||||||
it.Next()
|
it.Next()
|
||||||
} else {
|
} else {
|
||||||
next := common.BigMin(zmin, zmax, zcode)
|
next := common.BigMin(zmin, zmax, zcode)
|
||||||
//log.Printf("seeking to: %d", next)
|
//log.Printf("seeking to: %d\n", next)
|
||||||
it.Seek(common.ToBigEndian(next))
|
it.Seek(common.ToBigEndian(next))
|
||||||
//log.Printf("seeking done: %d", next)
|
//log.Printf("seeking done: %d\n", next)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//log.Println("iterating done")
|
//log.Println("iterating done")
|
||||||
if err = it.GetError(); err != nil {
|
if err = it.GetError(); err != nil {
|
||||||
log.Printf("error while iterating: %s", err)
|
log.Printf("error while iterating: %s\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -122,7 +122,7 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
defer listener.Close()
|
defer listener.Close()
|
||||||
log.Printf("Server started at %s", listener.Addr())
|
log.Printf("Server started at %s\n", listener.Addr())
|
||||||
|
|
||||||
connChan := make(chan net.Conn)
|
connChan := make(chan net.Conn)
|
||||||
defer close(connChan)
|
defer close(connChan)
|
||||||
@ -135,12 +135,12 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
log.Printf("Client accepted from: %s", conn.RemoteAddr())
|
log.Printf("Client accepted from: %s\n", conn.RemoteAddr())
|
||||||
connChan <- conn
|
connChan <- conn
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
log.Printf("Doing garbage collection every: %s", gcDur)
|
log.Printf("Doing garbage collection every: %s\n", gcDur)
|
||||||
gcChan := time.Tick(gcDur)
|
gcChan := time.Tick(gcDur)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@ -148,7 +148,7 @@ func main() {
|
|||||||
case conn := <-connChan:
|
case conn := <-connChan:
|
||||||
var session Session
|
var session Session
|
||||||
if session, err = backend.NewSession(); err != nil {
|
if session, err = backend.NewSession(); err != nil {
|
||||||
log.Printf("Cannot create session: %s", err)
|
log.Printf("Cannot create session: %s\n", err)
|
||||||
conn.Close()
|
conn.Close()
|
||||||
} else {
|
} else {
|
||||||
go NewConnection(conn, session, maxBulkStringSize).Run()
|
go NewConnection(conn, session, maxBulkStringSize).Run()
|
||||||
|
@ -173,7 +173,7 @@ func asString(i interface{}) string {
|
|||||||
func (rce *RedisCommandExecutor) execute() bool {
|
func (rce *RedisCommandExecutor) execute() bool {
|
||||||
l := len(rce.args)
|
l := len(rce.args)
|
||||||
if l < 1 {
|
if l < 1 {
|
||||||
log.Printf("WARN: Too less argument for command.")
|
log.Println("WARN: Too less argument for command.")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
cmd := strings.ToUpper(asString(rce.args[0]))
|
cmd := strings.ToUpper(asString(rce.args[0]))
|
||||||
@ -259,7 +259,7 @@ func (rce *RedisCommandExecutor) ConsumeInteger(i int64) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rce *RedisCommandExecutor) ConsumeError(err error) bool {
|
func (rce *RedisCommandExecutor) ConsumeError(err error) bool {
|
||||||
log.Printf("error: %s", err)
|
log.Printf("error: %s\n", err)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ func (ss *SqliteSession) AllKeys(hash []byte, done chan struct{}) (keys chan []b
|
|||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var key int64
|
var key int64
|
||||||
if err := rows.Scan(&key); err != nil {
|
if err := rows.Scan(&key); err != nil {
|
||||||
log.Printf("WARN: %s", err)
|
log.Printf("WARN: %s\n", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
var encoded []byte
|
var encoded []byte
|
||||||
@ -334,14 +334,14 @@ func (ss *SqliteSession) interleavedSpatialQuery(first, second []byte, done chan
|
|||||||
rows *sql.Rows
|
rows *sql.Rows
|
||||||
)
|
)
|
||||||
if rows, err = rangeStmt.Query(zmin, zmax); err != nil {
|
if rows, err = rangeStmt.Query(zmin, zmax); err != nil {
|
||||||
log.Printf("Error in range query: %s", err)
|
log.Printf("Error in range query: %s\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var zcode int64
|
var zcode int64
|
||||||
var data []byte
|
var data []byte
|
||||||
if err = rows.Scan(&zcode, &data); err != nil {
|
if err = rows.Scan(&zcode, &data); err != nil {
|
||||||
log.Printf("Error in scanning row: %s", err)
|
log.Printf("Error in scanning row: %s\n", err)
|
||||||
rows.Close()
|
rows.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -349,7 +349,7 @@ func (ss *SqliteSession) interleavedSpatialQuery(first, second []byte, done chan
|
|||||||
if cub.Contains(c) {
|
if cub.Contains(c) {
|
||||||
var encodedKey []byte
|
var encodedKey []byte
|
||||||
if encodedKey, err = common.EncodeStringToBytes(common.CoordToPlain(c)); err != nil {
|
if encodedKey, err = common.EncodeStringToBytes(common.CoordToPlain(c)); err != nil {
|
||||||
log.Printf("Key encoding failed: %s", err)
|
log.Printf("Key encoding failed: %s\n", err)
|
||||||
rows.Close()
|
rows.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ func (ss *SqliteSession) interleavedSpatialQuery(first, second []byte, done chan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err = rows.Err(); err != nil {
|
if err = rows.Err(); err != nil {
|
||||||
log.Printf("Error in range query: %s", err)
|
log.Printf("Error in range query: %s\n", err)
|
||||||
}
|
}
|
||||||
rows.Close()
|
rows.Close()
|
||||||
}
|
}
|
||||||
@ -413,19 +413,19 @@ func (ss *SqliteSession) plainSpatialQuery(first, second []byte, done chan struc
|
|||||||
// Ordering should not be necessary.
|
// Ordering should not be necessary.
|
||||||
from, to := order(common.CoordToPlain(a), common.CoordToPlain(b))
|
from, to := order(common.CoordToPlain(a), common.CoordToPlain(b))
|
||||||
if rows, err = rangeStmt.Query(from, to); err != nil {
|
if rows, err = rangeStmt.Query(from, to); err != nil {
|
||||||
log.Printf("Error in range query: %s", err)
|
log.Printf("Error in range query: %s\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var key int64
|
var key int64
|
||||||
var data []byte
|
var data []byte
|
||||||
if err = rows.Scan(&key, &data); err != nil {
|
if err = rows.Scan(&key, &data); err != nil {
|
||||||
log.Printf("Error in scanning row: %s", err)
|
log.Printf("Error in scanning row: %s\n", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
var encodedKey []byte
|
var encodedKey []byte
|
||||||
if encodedKey, err = common.EncodeStringToBytes(key); err != nil {
|
if encodedKey, err = common.EncodeStringToBytes(key); err != nil {
|
||||||
log.Printf("Key encoding failed: %s", err)
|
log.Printf("Key encoding failed: %s\n", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
@ -436,7 +436,7 @@ func (ss *SqliteSession) plainSpatialQuery(first, second []byte, done chan struc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err = rows.Err(); err != nil {
|
if err = rows.Err(); err != nil {
|
||||||
log.Printf("Error in range query: %s", err)
|
log.Printf("Error in range query: %s\n", err)
|
||||||
}
|
}
|
||||||
rows.Close()
|
rows.Close()
|
||||||
}
|
}
|
||||||
|
@ -77,9 +77,9 @@ func createBaseLevel(
|
|||||||
|
|
||||||
for x, i := int16(xMin), 0; x <= int16(xMax); x += 16 {
|
for x, i := int16(xMin), 0; x <= int16(xMax); x += 16 {
|
||||||
xDir := filepath.Join(baseDir, strconv.Itoa(i))
|
xDir := filepath.Join(baseDir, strconv.Itoa(i))
|
||||||
log.Printf("creating dir: %s", xDir)
|
log.Printf("creating dir: %s\n", xDir)
|
||||||
if err = os.MkdirAll(xDir, os.ModePerm); err != nil {
|
if err = os.MkdirAll(xDir, os.ModePerm); err != nil {
|
||||||
log.Fatalf("Cannot create directory '%s': %s", xDir, err)
|
log.Fatalf("Cannot create directory '%s': %s\n", xDir, err)
|
||||||
}
|
}
|
||||||
for z, j := int16(zMin), 0; z <= int16(zMax); z += 16 {
|
for z, j := int16(zMin), 0; z <= int16(zMax); z += 16 {
|
||||||
jobs <- blockPos{x: x, z: z, i: i, j: j}
|
jobs <- blockPos{x: x, z: z, i: i, j: j}
|
||||||
|
@ -92,7 +92,7 @@ func main() {
|
|||||||
numBlocks := 0
|
numBlocks := 0
|
||||||
drawBlock := func(block *common.Block) {
|
drawBlock := func(block *common.Block) {
|
||||||
if err := yOrder.RenderBlock(block, colors); err != nil {
|
if err := yOrder.RenderBlock(block, colors); err != nil {
|
||||||
log.Printf("WARN: rendering block failed: %s", err)
|
log.Printf("WARN: rendering block failed: %s\n", err)
|
||||||
}
|
}
|
||||||
numBlocks++
|
numBlocks++
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ func main() {
|
|||||||
log.Fatalf("query failed: %s", err)
|
log.Fatalf("query failed: %s", err)
|
||||||
}
|
}
|
||||||
if err = yOrder.Drain(colors); err != nil {
|
if err = yOrder.Drain(colors); err != nil {
|
||||||
log.Printf("WARN: rendering block failed: %s", err)
|
log.Printf("WARN: rendering block failed: %s\n", err)
|
||||||
}
|
}
|
||||||
if renderer.IsFilled() {
|
if renderer.IsFilled() {
|
||||||
break
|
break
|
||||||
|
@ -97,7 +97,7 @@ func (sb *subBaseLine) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
rw.Header().Set("Content-Type", "image/png")
|
rw.Header().Set("Content-Type", "image/png")
|
||||||
if err = png.Encode(rw, img); err != nil {
|
if err = png.Encode(rw, img); err != nil {
|
||||||
log.Printf("WARN: encoding image failed: %s", err)
|
log.Printf("WARN: encoding image failed: %s\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ func blowUp(src image.Image) *image.RGBA {
|
|||||||
py += dy
|
py += dy
|
||||||
}
|
}
|
||||||
|
|
||||||
//log.Printf("Rendering took: %s", time.Since(start))
|
//log.Printf("Rendering took: %s\n", time.Since(start))
|
||||||
|
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ func blowUpRGBA(src *image.RGBA) *image.RGBA {
|
|||||||
py += dy
|
py += dy
|
||||||
}
|
}
|
||||||
|
|
||||||
//log.Printf("Rendering took: %s", time.Since(start))
|
//log.Printf("Rendering took: %s\n", time.Since(start))
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ func toUint(s string) uint {
|
|||||||
var err error
|
var err error
|
||||||
var x int
|
var x int
|
||||||
if x, err = strconv.Atoi(s); err != nil {
|
if x, err = strconv.Atoi(s); err != nil {
|
||||||
log.Printf("WARN: Cannot convert to int: %s", err)
|
log.Printf("WARN: Cannot convert to int: %s\n", err)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return uint(x)
|
return uint(x)
|
||||||
|
@ -95,7 +95,7 @@ func (tu *tileUpdater) checkIP(r *http.Request) bool {
|
|||||||
|
|
||||||
var host []string
|
var host []string
|
||||||
if host = strings.SplitN(r.RemoteAddr, ":", 2); len(host) < 1 {
|
if host = strings.SplitN(r.RemoteAddr, ":", 2); len(host) < 1 {
|
||||||
log.Printf("WARN: cannot extract host from '%s'\n", r.RemoteAddr)
|
log.Printf("WARN: cannot extract host from '%s'.\n", r.RemoteAddr)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ func (tu *tileUpdater) checkIP(r *http.Request) bool {
|
|||||||
|
|
||||||
func (tu *tileUpdater) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
func (tu *tileUpdater) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
if !tu.checkIP(r) {
|
if !tu.checkIP(r) {
|
||||||
log.Printf("WARN: Unauthorized update request from '%s'", r.RemoteAddr)
|
log.Printf("WARN: Unauthorized update request from '%s'\n", r.RemoteAddr)
|
||||||
http.Error(rw, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
|
http.Error(rw, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ func (tu *tileUpdater) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
var newChanges []xz
|
var newChanges []xz
|
||||||
decoder := json.NewDecoder(r.Body)
|
decoder := json.NewDecoder(r.Body)
|
||||||
if err = decoder.Decode(&newChanges); err != nil {
|
if err = decoder.Decode(&newChanges); err != nil {
|
||||||
log.Printf("WARN: JSON document broken: %s", err)
|
log.Printf("WARN: JSON document broken: %s\n", err)
|
||||||
http.Error(rw, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
|
http.Error(rw, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ func (tu *tileUpdater) doUpdates() {
|
|||||||
var client *common.RedisClient
|
var client *common.RedisClient
|
||||||
var err error
|
var err error
|
||||||
if client, err = common.NewRedisClient("tcp", tu.redisAddress); err != nil {
|
if client, err = common.NewRedisClient("tcp", tu.redisAddress); err != nil {
|
||||||
log.Printf("WARN: Cannot connect to redis server: %s", err)
|
log.Printf("WARN: Cannot connect to redis server: %s\n", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
btc := common.NewBaseTileCreator(client, tu.colors, tu.transparent, baseDir, true)
|
btc := common.NewBaseTileCreator(client, tu.colors, tu.transparent, baseDir, true)
|
||||||
@ -174,7 +174,7 @@ func (tu *tileUpdater) doUpdates() {
|
|||||||
parentJobs := make(map[xz]uint16)
|
parentJobs := make(map[xz]uint16)
|
||||||
|
|
||||||
for c := range changes {
|
for c := range changes {
|
||||||
//log.Printf("job: %+v", c)
|
//log.Printf("job: %+v\n", c)
|
||||||
jobs <- c
|
jobs <- c
|
||||||
pxz := c.parent()
|
pxz := c.parent()
|
||||||
parentJobs[pxz.P] |= pxz.Mask
|
parentJobs[pxz.P] |= pxz.Mask
|
||||||
@ -211,7 +211,7 @@ func updatePyramidTiles(level int, baseDir string, jobs chan xzm, done *sync.Wai
|
|||||||
|
|
||||||
for job := range jobs {
|
for job := range jobs {
|
||||||
if err := updatePyramidTile(scratch, level, baseDir, job); err != nil {
|
if err := updatePyramidTile(scratch, level, baseDir, job); err != nil {
|
||||||
log.Printf("Updating pyramid tile failed: %s", err)
|
log.Printf("Updating pyramid tile failed: %s\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ func updatePyramidTile(scratch *image.RGBA, level int, baseDir string, j xzm) er
|
|||||||
|
|
||||||
for i := uint16(0); i < 4; i++ {
|
for i := uint16(0); i < 4; i++ {
|
||||||
if j.Mask&(1<<i) != 0 {
|
if j.Mask&(1<<i) != 0 {
|
||||||
//log.Printf("level %d: modified %d", level, i)
|
//log.Printf("level %d: modified %d\n", level, i)
|
||||||
o := ofs[i]
|
o := ofs[i]
|
||||||
bx, bz := int(2*j.P.X), int(2*j.P.Z)
|
bx, bz := int(2*j.P.X), int(2*j.P.Z)
|
||||||
path := filepath.Join(
|
path := filepath.Join(
|
||||||
@ -266,7 +266,7 @@ func updatePyramidTile(scratch *image.RGBA, level int, baseDir string, j xzm) er
|
|||||||
if orig == nil {
|
if orig == nil {
|
||||||
orig = common.LoadPNG(origPath)
|
orig = common.LoadPNG(origPath)
|
||||||
}
|
}
|
||||||
//log.Printf("level %d: copied %d", level, i)
|
//log.Printf("level %d: copied %d\n", level, i)
|
||||||
min := orig.Bounds().Min.Add(dps[i])
|
min := orig.Bounds().Min.Add(dps[i])
|
||||||
r := image.Rectangle{min, min.Add(windowSize)}
|
r := image.Rectangle{min, min.Add(windowSize)}
|
||||||
draw.Draw(scratch, r, orig, min, draw.Src)
|
draw.Draw(scratch, r, orig, min, draw.Src)
|
||||||
@ -283,7 +283,7 @@ func updateBaseTiles(jobs chan xz, btc *common.BaseTileCreator, done *sync.WaitG
|
|||||||
xz := job.dequantize()
|
xz := job.dequantize()
|
||||||
//log.Printf("%d/%d %d/%d", x, z, job.X, job.Z)
|
//log.Printf("%d/%d %d/%d", x, z, job.X, job.Z)
|
||||||
if err := btc.CreateTile(xz.X-1, xz.Z-1, int(job.X), int(job.Z)); err != nil {
|
if err := btc.CreateTile(xz.X-1, xz.Z-1, int(job.X), int(job.Z)); err != nil {
|
||||||
log.Printf("WARN: create tile failed: %s", err)
|
log.Printf("WARN: create tile failed: %s\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ func (btc *BaseTileCreator) CreateTile(x, z int16, i, j int) error {
|
|||||||
|
|
||||||
drawBlock := func(block *Block) {
|
drawBlock := func(block *Block) {
|
||||||
if err := btc.yOrder.RenderBlock(block, btc.colors); err != nil {
|
if err := btc.yOrder.RenderBlock(block, btc.colors); err != nil {
|
||||||
log.Printf("WARN: rendering block failed: %s", err)
|
log.Printf("WARN: rendering block failed: %s\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ func (btc *BaseTileCreator) CreateTile(x, z int16, i, j int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := btc.yOrder.Drain(btc.colors); err != nil {
|
if err := btc.yOrder.Drain(btc.colors); err != nil {
|
||||||
log.Printf("WARN: rendering block failed: %s", err)
|
log.Printf("WARN: rendering block failed: %s\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oareas, nareas = nareas, oareas[0:0]
|
oareas, nareas = nareas, oareas[0:0]
|
||||||
@ -123,7 +123,7 @@ func (btc *BaseTileCreator) CreateTile(x, z int16, i, j int) error {
|
|||||||
|
|
||||||
path := filepath.Join(btc.baseDir, strconv.Itoa(i), fmt.Sprintf("%d.png", j))
|
path := filepath.Join(btc.baseDir, strconv.Itoa(i), fmt.Sprintf("%d.png", j))
|
||||||
|
|
||||||
log.Printf("Writing (%d, %d) to file %s", x, z, path)
|
log.Printf("Writing (%d, %d) to file %s\n", x, z, path)
|
||||||
|
|
||||||
if !btc.update {
|
if !btc.update {
|
||||||
return SaveAsPNG(path, image)
|
return SaveAsPNG(path, image)
|
||||||
|
@ -83,14 +83,14 @@ func LoadPNG(path string) image.Image {
|
|||||||
var err error
|
var err error
|
||||||
var file *os.File
|
var file *os.File
|
||||||
if file, err = os.Open(path); err != nil {
|
if file, err = os.Open(path); err != nil {
|
||||||
//log.Printf("WARN: %s", err)
|
//log.Printf("WARN: %s\n", err)
|
||||||
return image.White
|
return image.White
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
reader := bufio.NewReader(file)
|
reader := bufio.NewReader(file)
|
||||||
var img image.Image
|
var img image.Image
|
||||||
if img, err = png.Decode(reader); err != nil {
|
if img, err = png.Decode(reader); err != nil {
|
||||||
log.Printf("WARN: %s", err)
|
log.Printf("WARN: %s\n", err)
|
||||||
return image.White
|
return image.White
|
||||||
}
|
}
|
||||||
return img
|
return img
|
||||||
|
Loading…
Reference in New Issue
Block a user