Browse Source

Use upper_bound instead of sort since predicate does not fulfills strict weak ordering requirement for std::sort

Ivan Savenko 11 months ago
parent
commit
e2fe20e26d
1 changed files with 2 additions and 3 deletions
  1. 2 3
      client/mapView/MapRendererContextState.cpp

+ 2 - 3
client/mapView/MapRendererContextState.cpp

@@ -54,9 +54,8 @@ void MapRendererContextState::addObject(const CGObjectInstance * obj)
 			if(LOCPLINT->cb->isInTheMap(currTile) && obj->coveringAt(currTile))
 			{
 				auto & container = objects[currTile.z][currTile.x][currTile.y];
-
-				container.push_back(obj->id);
-				boost::range::sort(container, compareObjectBlitOrder);
+				auto position = std::upper_bound(container.begin(), container.end(), obj->id, compareObjectBlitOrder);
+				container.insert(position, obj->id);
 			}
 		}
 	}