diff --git a/tools/editor/editor_app.hpp b/tools/editor/editor_app.hpp index 890b5772..cf1c143d 100644 --- a/tools/editor/editor_app.hpp +++ b/tools/editor/editor_app.hpp @@ -54,7 +54,16 @@ public: QuestEditor& getQuestEditor() { return questEditor_; } AssetBrowser& getAssetBrowser() { return assetBrowser_; } EditorViewport& getViewport() { return viewport_; } - void setMapName(const std::string& name) { loadedMap_ = name; } + bool setMapName(const std::string& name) { + if (name.empty()) return false; + for (char c : name) { + if (c == '/' || c == '\\' || c == '.' || c == ':' || + c == '*' || c == '?' || c == '"' || c == '<' || + c == '>' || c == '|' || c < 32) return false; + } + loadedMap_ = name; + return true; + } rendering::TerrainRenderer* getTerrainRenderer(); rendering::M2Renderer* getM2Renderer() { return viewport_.getM2Renderer(); } pipeline::AssetManager* getAssetManager() { return assetManager_.get(); } diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index 1b1f9206..5b7f4f6f 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -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()); diff --git a/tools/editor/object_placer.cpp b/tools/editor/object_placer.cpp index 7c252a3b..6a8d82da 100644 --- a/tools/editor/object_placer.cpp +++ b/tools/editor/object_placer.cpp @@ -244,6 +244,8 @@ bool ObjectPlacer::loadFromFile(const std::string& path) { objects_.clear(); undoStack_.clear(); selectedIdx_ = -1; + selectedIndices_.clear(); + uniqueIdCounter_ = 1; for (const auto& jo : arr) { PlacedObject obj;