summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-11-02 14:47:26 +0100
committerKevin Chabowski <kevin@kch42.de>2013-11-02 14:47:26 +0100
commit63b964614135f6381b5d55828714efb3783dfd04 (patch)
tree0505976e6bffadd2d37e377932c74987f9f587c2
parent03eaf07bee24bb12319e53e090a19f2c2a05ad23 (diff)
downloadbiomed-63b964614135f6381b5d55828714efb3783dfd04.tar.gz
biomed-63b964614135f6381b5d55828714efb3783dfd04.tar.bz2
biomed-63b964614135f6381b5d55828714efb3783dfd04.zip
New biome infos are now passed to mapwidget
-rw-r--r--main.go6
-rw-r--r--mapwidget.go10
-rw-r--r--region_wrapper.go8
3 files changed, 17 insertions, 7 deletions
diff --git a/main.go b/main.go
index 288b59d..ba60c97 100644
--- a/main.go
+++ b/main.go
@@ -21,8 +21,8 @@ type GUI struct {
statusContext uint
lastStatus string
- biomes []BiomeInfo
- bioVBox *gtk.VBox
+ biomes []BiomeInfo
+ bioVBox *gtk.VBox
bioVBoxWrap *gtk.VBox
mapw *MapWidget
@@ -246,7 +246,7 @@ func (g *GUI) updateBiomeInfo() {
vbox.ShowAll()
g.bioVBox = vbox
- // TODO: Update mapwidget
+ g.mapw.updateBioLookup(MkBiomeLookup(g.biomes))
}
func (g *GUI) Init() {
diff --git a/mapwidget.go b/mapwidget.go
index 116f069..e04b5eb 100644
--- a/mapwidget.go
+++ b/mapwidget.go
@@ -233,6 +233,16 @@ func (mw *MapWidget) updateGUI() {
mw.dArea.GetWindow().Invalidate(nil, false)
}
+func (mw *MapWidget) updateBioLookup(lookup BiomeLookup) {
+ mw.bioLookup = lookup
+ mw.regWrap.bioLookup = lookup
+
+ if mw.regWrap.RegionLoaded() {
+ mw.regWrap.FlushTiles()
+ mw.regWrap.UpdateTiles()
+ }
+}
+
func NewMapWidget(guicbs GUICallbacks, bioLookup BiomeLookup) *MapWidget {
dArea := gtk.NewDrawingArea()
diff --git a/region_wrapper.go b/region_wrapper.go
index 9a4d958..d27d1ad 100644
--- a/region_wrapper.go
+++ b/region_wrapper.go
@@ -131,11 +131,11 @@ func (rw *RegionWrapper) tileUpdater() {
func (rw *RegionWrapper) SetRegion(region *mcmap.Region) {
if rw.RegionLoaded() {
- rw.flushTiles()
+ rw.FlushTiles()
}
rw.region = NewCachedRegion(region, cacheSize)
- rw.tileUpdates <- true
+ rw.UpdateTiles()
}
func (rw *RegionWrapper) SetChunkBounds(startX, startZ, endX, endZ int) {
@@ -152,7 +152,7 @@ func (rw *RegionWrapper) SetFixSnowIce(b bool) { rw.fixSnowIce = b }
func (rw *RegionWrapper) RegionLoaded() bool { return rw.region != nil }
func (rw *RegionWrapper) ToolSingleClick() bool { return rw.tool.SingleClick() }
-func (rw *RegionWrapper) flushTiles() {
+func (rw *RegionWrapper) FlushTiles() {
if err := rw.region.Flush(); err != nil {
rw.guicbs.reportFail(fmt.Sprintf("Error while flushing cache: %s", err))
return
@@ -171,7 +171,7 @@ func (rw *RegionWrapper) flushTiles() {
}
func (rw *RegionWrapper) Save() {
- rw.flushTiles()
+ rw.FlushTiles()
if err := rw.region.Flush(); err != nil {
rw.guicbs.reportFail(fmt.Sprintf("Error while flushing cache: %s", err))