示例#1
0
func loadMap(_hood *hood.Hood, _mapId int, _tilePointTable *TilePointTable) {
	// Create select query to get all tilepoints and layers as one result
	_hood.Select("tilepoint", "tilepoint.x", "tilepoint.y", "tilepointlayer.level", "tilepointlayer.blocking", "tilepointtilelayer.layer", "tilepointtilelayer.tileId")
	_hood.Join(hood.LeftJoin, "tilepointlayer", "tilepointlayer.tilePointId", "tilepoint.tilePointId")
	_hood.Join(hood.LeftJoin, "tilepointtilelayer", "tilepointtilelayer.tilePointLayerId", "tilepointlayer.tilePointLayerId")

	var tilePointRows []TilePointRow
	if err := _hood.Find(&tilePointRows); err != nil {
		log.Error("World", "loadMap", "Error fetching tilepoints from database:\n%s", err.Error())
	} else {
		for _, row := range tilePointRows {
			processTilePoints(row, _tilePointTable)
		}
	}

	processExitChan <- true
}