From 01a6bf15be8f438765c045e25d2c258cff498da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Mon, 14 Oct 2024 10:18:00 +0200 Subject: [PATCH] Fix the position-based selector of !set Broken since the addition of !set in 7ae5eaab79a4. --- src/lua/CommandInterface.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lua/CommandInterface.cpp b/src/lua/CommandInterface.cpp index 28eda0142..997fe1d55 100644 --- a/src/lua/CommandInterface.cpp +++ b/src/lua/CommandInterface.cpp @@ -349,7 +349,15 @@ AnyType CommandInterface::tptS_set(std::deque * words) ui::Point tempPoint = ((PointType)selector).Value(); if(tempPoint.X<0 || tempPoint.Y<0 || tempPoint.Y >= YRES || tempPoint.X >= XRES) throw GeneralException("Invalid position"); - + auto r = sim->pmap[tempPoint.Y][tempPoint.X]; + if (!r) + { + r = sim->photons[tempPoint.Y][tempPoint.X]; + } + if (r) + { + partIndex = ID(r); + } } else partIndex = ((NumberType)selector).Value();