浏览代码

fix puzzle map never open

kdmcser 5 月之前
父节点
当前提交
935476a86a
共有 3 个文件被更改,包括 8 次插入1 次删除
  1. 2 1
      client/mapView/MapView.cpp
  2. 2 0
      client/mapView/MapView.h
  3. 4 0
      client/windows/CPuzzleWindow.cpp

+ 2 - 1
client/mapView/MapView.cpp

@@ -51,6 +51,7 @@ BasicMapView::BasicMapView(const Point & offset, const Point & dimensions)
 	: model(createModel(dimensions))
 	, tilesCache(new MapViewCache(model))
 	, controller(new MapViewController(model, tilesCache))
+	, needFullUpdate(false)
 {
 	OBJECT_CONSTRUCTION;
 	pos += offset;
@@ -76,7 +77,7 @@ void BasicMapView::tick(uint32_t msPassed)
 void BasicMapView::show(Canvas & to)
 {
 	CanvasClipRectGuard guard(to, pos);
-	render(to, false);
+	render(to, needFullUpdate);
 
 	controller->afterRender();
 }

+ 2 - 0
client/mapView/MapView.h

@@ -35,6 +35,8 @@ protected:
 	void render(Canvas & target, bool fullUpdate);
 
 public:
+	bool needFullUpdate;
+
 	BasicMapView(const Point & offset, const Point & dimensions);
 	~BasicMapView() override;
 

+ 4 - 0
client/windows/CPuzzleWindow.cpp

@@ -43,6 +43,7 @@ CPuzzleWindow::CPuzzleWindow(const int3 & GrailPos, double discoveredRatio)
 	quitb->setBorderColor(Colors::METALLIC_GOLD);
 
 	mapView = std::make_shared<PuzzleMapView>(Point(8,9), Point(591, 544), grailPos);
+	mapView->needFullUpdate = true;
 
 	logo = std::make_shared<CPicture>(ImagePath::builtin("PUZZLOGO"), 607, 3);
 	title = std::make_shared<CLabel>(700, 95, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, LIBRARY->generaltexth->allTexts[463]);
@@ -93,4 +94,7 @@ void CPuzzleWindow::show(Canvas & to)
 		currentAlpha -= animSpeed;
 	}
 	CWindowObject::show(to);
+
+	if(mapView->needFullUpdate && piecesToRemove.empty())
+		mapView->needFullUpdate = false;
 }