mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-01 00:45:26 +02:00
* towards ConstTranssitivePointers in CGI
This commit is contained in:
@ -1157,7 +1157,7 @@ CGHeroInstance *CGameState::getHero(int objid)
|
||||
{
|
||||
if(objid<0 || objid>=map->objects.size() || map->objects[objid]->ID!=HEROI_TYPE)
|
||||
return NULL;
|
||||
return static_cast<CGHeroInstance *>(+map->objects[objid]);
|
||||
return static_cast<CGHeroInstance *>(map->objects[objid].get());
|
||||
}
|
||||
|
||||
const CGHeroInstance * CGameState::getHero( int objid ) const
|
||||
@ -1247,13 +1247,13 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
|
||||
{
|
||||
for(unsigned int i=0;i<map->objects.size();i++)
|
||||
{
|
||||
if(map->objects[i]->ID==77 && dynamic_cast<CGTownInstance*>(+map->objects[i])->identifier == info->identifier)
|
||||
if(map->objects[i]->ID==77 && dynamic_cast<CGTownInstance*>(map->objects[i].get())->identifier == info->identifier)
|
||||
{
|
||||
randomizeObject(map->objects[i]); //we have to randomize the castle first
|
||||
faction = map->objects[i]->subID;
|
||||
break;
|
||||
}
|
||||
else if(map->objects[i]->ID==TOWNI_TYPE && dynamic_cast<CGTownInstance*>(+map->objects[i])->identifier == info->identifier)
|
||||
else if(map->objects[i]->ID==TOWNI_TYPE && dynamic_cast<CGTownInstance*>(map->objects[i].get())->identifier == info->identifier)
|
||||
{
|
||||
faction = map->objects[i]->subID;
|
||||
break;
|
||||
@ -1288,13 +1288,13 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
|
||||
{
|
||||
for(unsigned int i=0;i<map->objects.size();i++)
|
||||
{
|
||||
if(map->objects[i]->ID==77 && dynamic_cast<CGTownInstance*>(+map->objects[i])->identifier == info->identifier)
|
||||
if(map->objects[i]->ID==77 && dynamic_cast<CGTownInstance*>(map->objects[i].get())->identifier == info->identifier)
|
||||
{
|
||||
randomizeObject(map->objects[i]); //we have to randomize the castle first
|
||||
faction = map->objects[i]->subID;
|
||||
break;
|
||||
}
|
||||
else if(map->objects[i]->ID==TOWNI_TYPE && dynamic_cast<CGTownInstance*>(+map->objects[i])->identifier == info->identifier)
|
||||
else if(map->objects[i]->ID==TOWNI_TYPE && dynamic_cast<CGTownInstance*>(map->objects[i].get())->identifier == info->identifier)
|
||||
{
|
||||
faction = map->objects[i]->subID;
|
||||
break;
|
||||
@ -2180,7 +2180,7 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
|
||||
{
|
||||
map->objects[i]->initObj();
|
||||
if(map->objects[i]->ID == 62) //prison also needs to initialize hero
|
||||
static_cast<CGHeroInstance*>(+map->objects[i])->initHero();
|
||||
static_cast<CGHeroInstance*>(map->objects[i].get())->initHero();
|
||||
}
|
||||
CGTeleport::postInit(); //pairing subterranean gates
|
||||
}
|
||||
@ -3789,7 +3789,7 @@ int CGameState::victoryCheck( ui8 player ) const
|
||||
const CArmedInstance *ai = NULL;
|
||||
if(map->objects[i]
|
||||
&& map->objects[i]->tempOwner == player //object controlled by player
|
||||
&& (ai = dynamic_cast<const CArmedInstance*>(+map->objects[i]))) //contains army
|
||||
&& (ai = dynamic_cast<const CArmedInstance*>(map->objects[i].get()))) //contains army
|
||||
{
|
||||
for(TSlots::const_iterator i=ai->Slots().begin(); i!=ai->Slots().end(); ++i) //iterate through army
|
||||
if(i->second->type->idNumber == map->victoryCondition.ID) //it's searched creature
|
||||
|
Reference in New Issue
Block a user