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

Prefer to pass CGameState as reference instead of pointer

This commit is contained in:
Ivan Savenko
2025-04-19 14:14:12 +03:00
parent ce436bd63e
commit 4d57a8ed36
67 changed files with 465 additions and 466 deletions

View File

@ -122,10 +122,10 @@ void CGObjectInstance::setType(MapObjectID newID, MapObjectSubID newSubID)
{
auto position = visitablePos();
auto oldOffset = getVisitableOffset();
auto &tile = cb->gameState()->getMap().getTile(position);
auto &tile = cb->gameState().getMap().getTile(position);
//recalculate blockvis tiles - new appearance might have different blockmap than before
cb->gameState()->getMap().hideObject(this);
cb->gameState().getMap().hideObject(this);
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()->getMap().showObject(this);
cb->gameState().getMap().showObject(this);
}
void CGObjectInstance::pickRandomObject(vstd::RNG & rand)