From 045638478207ab1a6e2ca952df62730c03c5fb17 Mon Sep 17 00:00:00 2001 From: Jerboa-app Date: Thu, 22 Aug 2024 07:32:10 +0100 Subject: [PATCH] Fix update priority --- include/jGL/spriteRenderer.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/jGL/spriteRenderer.h b/include/jGL/spriteRenderer.h index c7b37e6..380bd1a 100644 --- a/include/jGL/spriteRenderer.h +++ b/include/jGL/spriteRenderer.h @@ -118,12 +118,13 @@ namespace jGL { if (sprites.find(id) == sprites.end()){ return; } - for (auto & e : ids) + std::multimap::iterator iter; + for (iter = ids.begin(); iter != ids.end(); iter++) { - if (e.second == id) + if (iter->second == id) { - ids.erase(e.first); - ids.insert(std::pair(newPriority, e.second)); + ids.erase(iter); + ids.insert(std::pair(newPriority, id)); break; } }