From 7298b46504c109b13bab26c32d4b94f6985074d5 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 13 Sep 2023 12:33:50 +0200 Subject: [PATCH] Use binary search in CNullDriver::removeTexture() --- source/Irrlicht/CNullDriver.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp index b2d69145..3e5b4834 100644 --- a/source/Irrlicht/CNullDriver.cpp +++ b/source/Irrlicht/CNullDriver.cpp @@ -283,15 +283,13 @@ void CNullDriver::removeTexture(ITexture* texture) { if (!texture) return; + SSurface s; + s.Surface = texture; - for (u32 i=0; idrop(); - Textures.erase(i); - return; - } + s32 index = Textures.binary_search(s); + if (index != -1) { + texture->drop(); + Textures.erase(index); } }