1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

CGameState::map is now a private, unique_ptr with accessors

This commit is contained in:
Ivan Savenko
2025-03-03 15:19:38 +00:00
parent b6026084ea
commit 62cb5412ff
26 changed files with 194 additions and 186 deletions

View File

@ -122,10 +122,10 @@ void CGObjectInstance::setType(MapObjectID newID, MapObjectSubID newSubID)
{
auto position = visitablePos();
auto oldOffset = getVisitableOffset();
auto &tile = cb->gameState()->map->getTile(position);
auto &tile = cb->gameState()->getMap().getTile(position);
//recalculate blockvis tiles - new appearance might have different blockmap than before
cb->gameState()->map->removeBlockVisTiles(this, true);
cb->gameState()->getMap().removeBlockVisTiles(this, true);
auto handler = LIBRARY->objtypeh->getHandlerFor(newID, newSubID);
if(!handler->getTemplates(tile.getTerrainID()).empty())
@ -155,7 +155,7 @@ void CGObjectInstance::setType(MapObjectID newID, MapObjectSubID newSubID)
this->ID = Obj(newID);
this->subID = newSubID;
cb->gameState()->map->addBlockVisTiles(this);
cb->gameState()->getMap().addBlockVisTiles(this);
}
void CGObjectInstance::pickRandomObject(vstd::RNG & rand)