From 07e2ec84748176d7e74200939e9592e15d54a006 Mon Sep 17 00:00:00 2001 From: K Date: Wed, 31 Jul 2024 22:49:11 +0200 Subject: [PATCH] little optimization in MapRenderer When we replace static const std::vector by std::array the compiler generates much shorter and nicer binary which doesn't waste time initializing data structure during runtime. --- client/mapView/MapRendererContext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/mapView/MapRendererContext.cpp b/client/mapView/MapRendererContext.cpp index fd872a210..d375cbd2c 100644 --- a/client/mapView/MapRendererContext.cpp +++ b/client/mapView/MapRendererContext.cpp @@ -113,7 +113,7 @@ const CGPath * MapRendererBaseContext::currentPath() const size_t MapRendererBaseContext::objectGroupIndex(ObjectInstanceID objectID) const { - static const std::vector idleGroups = {0, 13, 0, 1, 2, 3, 4, 15, 14}; + static const std::array idleGroups = {0, 13, 0, 1, 2, 3, 4, 15, 14}; return idleGroups[getObjectRotation(objectID)]; } @@ -403,7 +403,7 @@ size_t MapRendererAdventureMovingContext::objectGroupIndex(ObjectInstanceID obje { if(target == objectID) { - static const std::vector moveGroups = {0, 10, 5, 6, 7, 8, 9, 12, 11}; + static const std::array moveGroups = {0, 10, 5, 6, 7, 8, 9, 12, 11}; return moveGroups[getObjectRotation(objectID)]; } return MapRendererAdventureContext::objectGroupIndex(objectID);