mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-19 12:02:24 +02:00
VCAI::getFlaggedObjects: use visitableObjs for better performance
This change is drastically improve performance on maps with water. One part that caused issue 2454.
This commit is contained in:
parent
3a1a6cf338
commit
25fd4d85e2
@ -1762,11 +1762,11 @@ void VCAI::retreiveVisitableObjs()
|
|||||||
std::vector<const CGObjectInstance *> VCAI::getFlaggedObjects() const
|
std::vector<const CGObjectInstance *> VCAI::getFlaggedObjects() const
|
||||||
{
|
{
|
||||||
std::vector<const CGObjectInstance *> ret;
|
std::vector<const CGObjectInstance *> ret;
|
||||||
retreiveVisitableObjs(ret, true);
|
for(const CGObjectInstance *obj : visitableObjs)
|
||||||
vstd::erase_if(ret, [](const CGObjectInstance *obj)
|
|
||||||
{
|
{
|
||||||
return obj->tempOwner != ai->playerID;
|
if(obj->tempOwner == ai->playerID)
|
||||||
});
|
ret.push_back(obj);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user