mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Remove excess pointer from market interface
This commit is contained in:
@@ -149,9 +149,10 @@ TSubgoal CollectRes::whatToDoToTrade()
|
||||
|
||||
markets.erase(boost::remove_if(markets, [](const IMarket * market) -> bool
|
||||
{
|
||||
if (!(market->o->ID == Obj::TOWN && market->o->tempOwner == ai->playerID))
|
||||
auto * o = dynamic_cast<const CGObjectInstance *>(market);
|
||||
if(o && !(o->ID == Obj::TOWN && o->tempOwner == ai->playerID))
|
||||
{
|
||||
if (!ai->isAccessible(market->o->visitablePos()))
|
||||
if(!ai->isAccessible(o->visitablePos()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -182,9 +183,10 @@ TSubgoal CollectRes::whatToDoToTrade()
|
||||
|
||||
if (howManyCanWeBuy >= value)
|
||||
{
|
||||
auto backObj = cb->getTopObj(m->o->visitablePos()); //it'll be a hero if we have one there; otherwise marketplace
|
||||
auto * o = dynamic_cast<const CGObjectInstance *>(m);
|
||||
auto backObj = cb->getTopObj(o->visitablePos()); //it'll be a hero if we have one there; otherwise marketplace
|
||||
assert(backObj);
|
||||
auto objid = m->o->id.getNum();
|
||||
auto objid = o->id.getNum();
|
||||
if (backObj->tempOwner != ai->playerID) //top object not owned
|
||||
{
|
||||
return sptr(VisitObj(objid)); //just go there
|
||||
|
||||
Reference in New Issue
Block a user