1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-18 03:21:27 +02:00

Fixed obstacles filling and passability view

This commit is contained in:
nordsoft 2022-09-07 03:26:00 +04:00
parent a2c63e7ed2
commit a4686c81ee
3 changed files with 13 additions and 5 deletions

View File

@ -245,14 +245,12 @@ void MapController::commitObstacleFill(int level)
sel.second.placeObstacles(_map.get(), CRandomGenerator::getDefault()); sel.second.placeObstacles(_map.get(), CRandomGenerator::getDefault());
} }
for(auto & t : selection) _mapHandler->invalidateObjects();
{
_mapHandler->invalidate(t.x, t.y, t.z);
}
_scenes[level]->selectionTerrainView.clear(); _scenes[level]->selectionTerrainView.clear();
_scenes[level]->selectionTerrainView.draw(); _scenes[level]->selectionTerrainView.draw();
_scenes[level]->objectsView.draw(); _scenes[level]->objectsView.draw();
_scenes[level]->passabilityView.update();
_miniscenes[level]->updateViews(); _miniscenes[level]->updateViews();
main->mapChanged(); main->mapChanged();
@ -264,6 +262,7 @@ void MapController::commitObjectChange(int level)
//_mapHandler->invalidate(o); //_mapHandler->invalidate(o);
_scenes[level]->objectsView.draw(); _scenes[level]->objectsView.draw();
_scenes[level]->selectionObjectsView.draw(); _scenes[level]->selectionObjectsView.draw();
_scenes[level]->passabilityView.update();
_miniscenes[level]->updateViews(); _miniscenes[level]->updateViews();
main->mapChanged(); main->mapChanged();
@ -307,6 +306,7 @@ void MapController::commitObjectShiftOrCreate(int level)
_scenes[level]->selectionObjectsView.selectionMode = 0; _scenes[level]->selectionObjectsView.selectionMode = 0;
_scenes[level]->objectsView.draw(); _scenes[level]->objectsView.draw();
_scenes[level]->selectionObjectsView.draw(); _scenes[level]->selectionObjectsView.draw();
_scenes[level]->passabilityView.update();
_miniscenes[level]->updateViews(); _miniscenes[level]->updateViews();
main->mapChanged(); main->mapChanged();

View File

@ -425,7 +425,6 @@ void MapHandler::invalidate(int x, int y, int z)
} }
++obj; ++obj;
//invalidate(obj->obj);
} }
stable_sort(objects.begin(), objects.end(), objectBlitOrderSorter); stable_sort(objects.begin(), objects.end(), objectBlitOrderSorter);
@ -494,6 +493,14 @@ std::vector<int3> MapHandler::geTilesUnderObject(CGObjectInstance * obj) const
return result; return result;
} }
void MapHandler::invalidateObjects()
{
for(auto obj : map->objects)
{
invalidate(obj);
}
}
void MapHandler::invalidate(const std::vector<int3> & tiles) void MapHandler::invalidate(const std::vector<int3> & tiles)
{ {
for(auto & currTile : tiles) for(auto & currTile : tiles)

View File

@ -90,6 +90,7 @@ public:
void invalidate(int x, int y, int z); //invalidates all objects in particular tile void invalidate(int x, int y, int z); //invalidates all objects in particular tile
void invalidate(CGObjectInstance *); //invalidates object rects void invalidate(CGObjectInstance *); //invalidates object rects
void invalidate(const std::vector<int3> &); //invalidates all tiles void invalidate(const std::vector<int3> &); //invalidates all tiles
void invalidateObjects(); //invalidates all objects on the map
std::vector<int3> geTilesUnderObject(CGObjectInstance *) const; std::vector<int3> geTilesUnderObject(CGObjectInstance *) const;
/// draws all objects on current tile (higher-level logic, unlike other draw*** methods) /// draws all objects on current tile (higher-level logic, unlike other draw*** methods)