1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Merge pull request #5672 from kdmcser/puzzle_map_fix

fix puzzle map never be revealed
This commit is contained in:
Ivan Savenko
2025-05-05 16:10:09 +03:00
committed by GitHub
3 changed files with 8 additions and 1 deletions

View File

@@ -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();
}

View File

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

View File

@@ -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;
}