fix(editor): object ID reset on load, zone name validation

- ObjectPlacer::loadFromFile() now resets uniqueIdCounter_ and clears
  selectedIndices_ to prevent ID collisions on repeated loads
- Zone rename validates against path traversal and special characters
  (rejects slashes, dots, colons, control chars, empty strings)
- UI shows error toast for invalid zone names
This commit is contained in:
Kelsi 2026-05-05 14:15:28 -07:00
parent 16a34afbf6
commit acb519a243
3 changed files with 16 additions and 3 deletions

View file

@ -2254,8 +2254,10 @@ void EditorUI::renderPropertiesPanel(EditorApp& app) {
ImGui::SetNextItemWidth(140);
if (ImGui::InputText("##mapname", renameBuf, sizeof(renameBuf),
ImGuiInputTextFlags_EnterReturnsTrue)) {
app.setMapName(renameBuf);
app.showToast("Zone renamed: " + std::string(renameBuf));
if (app.setMapName(renameBuf))
app.showToast("Zone renamed: " + std::string(renameBuf));
else
app.showToast("Invalid name (no slashes or special chars)");
}
ImGui::SameLine();
ImGui::Text("[%d, %d]", app.getLoadedTileX(), app.getLoadedTileY());