From 25fd4d85e24f60552948ea10ffb47acaddc8ba8c Mon Sep 17 00:00:00 2001 From: Arseniy Shestakov Date: Thu, 11 Aug 2016 03:58:24 +0300 Subject: [PATCH] VCAI::getFlaggedObjects: use visitableObjs for better performance This change is drastically improve performance on maps with water. One part that caused issue 2454. --- AI/VCAI/VCAI.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index c90d5b0a3..2c4c98c00 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -1762,11 +1762,11 @@ void VCAI::retreiveVisitableObjs() std::vector VCAI::getFlaggedObjects() const { std::vector ret; - retreiveVisitableObjs(ret, true); - vstd::erase_if(ret, [](const CGObjectInstance *obj) + for(const CGObjectInstance *obj : visitableObjs) { - return obj->tempOwner != ai->playerID; - }); + if(obj->tempOwner == ai->playerID) + ret.push_back(obj); + } return ret; }