From 2ec58d1a14a1af9f5471362ecb24bc5280e9b596 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Fri, 13 Nov 2026 00:38:10 +0300 Subject: [PATCH] fix AreaMap2D::remove --- src/util/AreaMap2D.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/util/AreaMap2D.hpp b/src/util/AreaMap2D.hpp index 9ec0e439d..8ad3ff1d7 100644 --- a/src/util/AreaMap2D.hpp +++ b/src/util/AreaMap2D.hpp @@ -120,9 +120,14 @@ namespace util { if (lx < 0 || ly < 0 || lx >= sizeX || ly >= sizeY) { return; } + auto& element = firstBuffer[ly * sizeX + lx]; + if (element == T{}) { + return; + } if (outCallback) - outCallback(x, y, firstBuffer[ly * sizeX + lx]); - firstBuffer[ly * sizeX + lx] = T{}; + outCallback(x, y, element); + element = T{}; + valuesCount--; } void setOutCallback(const OutCallback& callback) {