Fix the position-based selector of !set

Broken since the addition of !set in 7ae5eaab79.
This commit is contained in:
Tamás Bálint Misius
2024-10-14 10:18:00 +02:00
parent 8552aafbce
commit 01a6bf15be

View File

@@ -349,7 +349,15 @@ AnyType CommandInterface::tptS_set(std::deque<String> * 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();