fix(editor): ID counter resets, quest panel guard, zone rename, load paths

Bug fixes:
- ObjectPlacer::clearAll() now resets uniqueIdCounter_ to 1
- NpcSpawner::clearAll() added with idCounter_ reset (was manual clear)
- clearAllObjects() uses NpcSpawner::clearAll() instead of manual clear
- Quest panel has terrain-loaded guard (prevents crash before loading)

Features:
- Zone rename: editable map name field in Info panel (press Enter)
- Load objects/creatures/quests from both output/ and custom_zones/
  directories (WOT zones from custom_zones now get their NPCs loaded)
This commit is contained in:
Kelsi 2026-05-05 14:10:47 -07:00
parent 10a63f0581
commit 16a34afbf6
5 changed files with 31 additions and 13 deletions

View file

@ -1814,6 +1814,10 @@ void EditorUI::renderQuestPanel(EditorApp& app) {
ImGui::SetNextWindowPos(ImVec2(vp->Size.x - 400, 90), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(390, 600), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Quest Editor")) {
if (!app.hasTerrainLoaded()) {
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "Load or create terrain first");
ImGui::End(); return;
}
auto& qe = app.getQuestEditor();
auto& tmpl = qe.getTemplate();
@ -2245,8 +2249,16 @@ void EditorUI::renderPropertiesPanel(EditorApp& app) {
if (ImGui::Begin("Info")) {
auto* tr = app.getTerrainRenderer();
if (tr && tr->getChunkCount() > 0) {
ImGui::Text("Map: %s [%d, %d]", app.getLoadedMap().c_str(),
app.getLoadedTileX(), app.getLoadedTileY());
static char renameBuf[128] = {};
std::strncpy(renameBuf, app.getLoadedMap().c_str(), sizeof(renameBuf) - 1);
ImGui::SetNextItemWidth(140);
if (ImGui::InputText("##mapname", renameBuf, sizeof(renameBuf),
ImGuiInputTextFlags_EnterReturnsTrue)) {
app.setMapName(renameBuf);
app.showToast("Zone renamed: " + std::string(renameBuf));
}
ImGui::SameLine();
ImGui::Text("[%d, %d]", app.getLoadedTileX(), app.getLoadedTileY());
ImGui::Text("Chunks: %d Tris: %d", tr->getChunkCount(), tr->getTriangleCount());
ImGui::Text("Objects: %zu NPCs: %zu",
app.getObjectPlacer().objectCount(),