1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Remove usage of ConstTransitivePtr from CTown

This commit is contained in:
Ivan Savenko
2025-03-03 13:49:54 +00:00
parent 4a6a8f9496
commit a061ed04de
24 changed files with 60 additions and 73 deletions

View File

@@ -476,13 +476,12 @@ std::vector <const CGObjectInstance *> CGameInfoCallback::getVisitableObjs(int3
if(!getPlayerID().has_value() || obj->ID != Obj::EVENT) //hide events from players
ret.push_back(obj);
}
return ret;
}
std::vector<ConstTransitivePtr<CGObjectInstance>> CGameInfoCallback::getAllVisitableObjs() const
std::vector<const CGObjectInstance *> CGameInfoCallback::getAllVisitableObjs() const
{
std::vector<ConstTransitivePtr<CGObjectInstance>> ret;
std::vector<const CGObjectInstance *> ret;
for(auto & obj : gs->map->objects)
if(obj && obj->isVisitable() && obj->ID != Obj::EVENT && isVisible(obj))
ret.push_back(obj);
@@ -589,8 +588,7 @@ EBuildingState CGameInfoCallback::canBuildStructure( const CGTownInstance *t, Bu
if(!t->getTown()->buildings.count(ID))
return EBuildingState::BUILDING_ERROR;
const CBuilding * building = t->getTown()->buildings.at(ID);
const auto & building = t->getTown()->buildings.at(ID);
if(t->hasBuilt(ID)) //already built
return EBuildingState::ALREADY_PRESENT;