From e4e276813dc45c1c70c61b0fad67cba419d77ef4 Mon Sep 17 00:00:00 2001 From: T1ti Date: Fri, 8 Mar 2024 21:31:39 +0100 Subject: [PATCH] wmo area name small fixes --- src/noggit/DBC.cpp | 12 ++++++------ src/noggit/DBC.h | 4 ++-- src/noggit/MapView.cpp | 6 +++--- src/noggit/Selection.cpp | 2 +- src/noggit/ui/ObjectEditor.cpp | 2 +- src/noggit/ui/ZoneIDBrowser.cpp | 4 ++-- src/noggit/ui/texturing_tool.cpp | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/noggit/DBC.cpp b/src/noggit/DBC.cpp index 2f1e3c91..528ed5ce 100755 --- a/src/noggit/DBC.cpp +++ b/src/noggit/DBC.cpp @@ -48,8 +48,8 @@ void OpenDBs(std::shared_ptr clientData) } - -std::string AreaDB::getAreaName(int pAreaID) +// includes the parent zone name as a prefix +std::string AreaDB::getAreaFullName(int pAreaID) { if (!pAreaID || pAreaID == -1) { @@ -199,7 +199,7 @@ std::string WMOAreaTableDB::getWMOAreaName(int WMOId, int namesetId) for (Iterator i = gWMOAreaTableDB.begin(); i != gWMOAreaTableDB.end(); ++i) { - if (i->getUInt(WMOAreaTableDB::WmoId) == WMOId && i->getUInt(WMOAreaTableDB::NameSetId) == namesetId && i->getUInt(WMOAreaTableDB::WMOGroupID) == -1) + if (i->getUInt(WMOAreaTableDB::WmoId) == WMOId && i->getUInt(WMOAreaTableDB::NameSetId) == namesetId && i->getInt(WMOAreaTableDB::WMOGroupID) == -1) { // wmoareatableid = i->getUInt(WMOAreaTableDB::ID); std::string areaName = i->getLocalizedString(WMOAreaTableDB::Name); @@ -215,7 +215,7 @@ std::string WMOAreaTableDB::getWMOAreaName(int WMOId, int namesetId) return rec.getLocalizedString(AreaDB::Name); } else - return "Unknown location"; // nullptr? need to get it from terrain + return "-Local Terrain Area-"; // nullptr? need to get it from terrain } } } @@ -233,7 +233,7 @@ std::vector WMOAreaTableDB::getWMOAreaNames(int WMOId) for (Iterator i = gWMOAreaTableDB.begin(); i != gWMOAreaTableDB.end(); ++i) { - if (i->getUInt(WMOAreaTableDB::WmoId) == WMOId && i->getUInt(WMOAreaTableDB::WMOGroupID) == -1) + if (i->getUInt(WMOAreaTableDB::WmoId) == WMOId && i->getInt(WMOAreaTableDB::WMOGroupID) == -1) { // wmoareatableid = i->getUInt(WMOAreaTableDB::ID); std::string areaName = i->getLocalizedString(WMOAreaTableDB::Name); @@ -249,7 +249,7 @@ std::vector WMOAreaTableDB::getWMOAreaNames(int WMOId) areanamesvect.push_back(rec.getLocalizedString(AreaDB::Name)); } else - areanamesvect.push_back(""); // nullptr? need to get it from terrain + areanamesvect.push_back("-Local Terrain Area-"); // nullptr? need to get it from terrain } } // could optimise and break when iterator WmoId is higher than the Wmodid, but this wouldn't support unordered DBCs. diff --git a/src/noggit/DBC.h b/src/noggit/DBC.h index 9f1aa977..1cef7845 100755 --- a/src/noggit/DBC.h +++ b/src/noggit/DBC.h @@ -32,7 +32,7 @@ public: static const size_t AmbientMultiplier = 34; // float static const size_t LightId = 35; // int - static std::string getAreaName(int pAreaID); + static std::string getAreaFullName(int pAreaID); static std::uint32_t get_area_parent(int area_id); static std::uint32_t get_new_areabit(); }; @@ -309,7 +309,7 @@ public: static const size_t ID = 0; // uint static const size_t WmoId = 1; // uint static const size_t NameSetId = 2; // uint [AreaID] - static const size_t WMOGroupID= 3; // uint + static const size_t WMOGroupID= 3; // ! int static const size_t SoundProviderPreferences = 4; // uint static const size_t UnderwaterSoundProviderPreferences = 5; // uint static const size_t SoundAmbience = 6; // uint diff --git a/src/noggit/MapView.cpp b/src/noggit/MapView.cpp index acbbe973..36e4f3ba 100755 --- a/src/noggit/MapView.cpp +++ b/src/noggit/MapView.cpp @@ -1192,7 +1192,7 @@ void MapView::setupFileMenu() bookmark.camera_pitch = _camera.pitch()._; bookmark.camera_yaw = _camera.yaw()._; bookmark.map_id = _world->getMapID(); - bookmark.name = gAreaDB.getAreaName(_world->getAreaID(_camera.position)); + bookmark.name = gAreaDB.getAreaFullName(_world->getAreaID(_camera.position)); _project->createBookmark(bookmark); @@ -1207,7 +1207,7 @@ void MapView::setupFileMenu() std::stringstream port_command; port_command << ".go XYZ " << (ZEROPOINT - _camera.position.z) << " " << (ZEROPOINT - _camera.position.x) << " " << _camera.position.y << " " << _world->getMapID(); std::ofstream f("ports.txt", std::ios_base::app); - f << "Map: " << gAreaDB.getAreaName(_world->getAreaID (_camera.position)) << " on ADT " << std::floor(_camera.position.x / TILESIZE) << " " << std::floor(_camera.position.z / TILESIZE) << std::endl; + f << "Map: " << gAreaDB.getAreaFullName(_world->getAreaID (_camera.position)) << " on ADT " << std::floor(_camera.position.x / TILESIZE) << " " << std::floor(_camera.position.z / TILESIZE) << std::endl; f << "Trinity/AC:" << std::endl << port_command.str() << std::endl; // f << "ArcEmu:" << std::endl << ".worldport " << _world->getMapID() << " " << (ZEROPOINT - _camera.position.z) << " " << (ZEROPOINT - _camera.position.x) << " " << _camera.position.y << " " << std::endl << std::endl; f.close(); @@ -4183,7 +4183,7 @@ void MapView::tick (float dt) // emit selectionUpdated(); _status_area->setText - (QString::fromStdString (gAreaDB.getAreaName (_world->getAreaID (_camera.position)))); + (QString::fromStdString (gAreaDB.getAreaFullName (_world->getAreaID (_camera.position)))); { int time ((static_cast(_world->time) % 2880) / 2); diff --git a/src/noggit/Selection.cpp b/src/noggit/Selection.cpp index deb98c84..b28a1be4 100755 --- a/src/noggit/Selection.cpp +++ b/src/noggit/Selection.cpp @@ -22,7 +22,7 @@ void selected_chunk_type::updateDetails(Noggit::Ui::detail_infos* detail_widget) select_info << "Chunk (" << chunk->px << ", " << chunk->py << ") flat index: (" << chunk->py * 16 + chunk->px << ") of tile (" << chunk->mt->index.x << " , " << chunk->mt->index.z << ")" - << "
area ID: " << chunk->getAreaID() << " (\"" << gAreaDB.getAreaName(chunk->getAreaID()) << "\")" + << "
area ID: " << chunk->getAreaID() << " (\"" << gAreaDB.getAreaFullName(chunk->getAreaID()) << "\")" << "
flags: " << (flags.flags.has_mcsh ? "
shadows " : "") << (flags.flags.impass ? "
impassable " : "") diff --git a/src/noggit/ui/ObjectEditor.cpp b/src/noggit/ui/ObjectEditor.cpp index 819d0dfc..f35b3af3 100755 --- a/src/noggit/ui/ObjectEditor.cpp +++ b/src/noggit/ui/ObjectEditor.cpp @@ -943,7 +943,7 @@ namespace Noggit if (area_name.empty()) { auto chunk = world->getChunkAt(wi->pos); - namesetnames.append(gAreaDB.getAreaName(chunk->getAreaID()).c_str()); + namesetnames.append(gAreaDB.getAreaFullName(chunk->getAreaID()).c_str()); } else namesetnames.append(area_name.c_str()); diff --git a/src/noggit/ui/ZoneIDBrowser.cpp b/src/noggit/ui/ZoneIDBrowser.cpp index dd0d03e4..46381a35 100755 --- a/src/noggit/ui/ZoneIDBrowser.cpp +++ b/src/noggit/ui/ZoneIDBrowser.cpp @@ -576,7 +576,7 @@ namespace Noggit // save the change for the session (don't write dbc yet) _parent_area_id = tree_selected_id; std::stringstream ss; - ss << _parent_area_id << "-" << gAreaDB.getAreaName(_parent_area_id); + ss << _parent_area_id << "-" << gAreaDB.getAreaFullName(_parent_area_id); _parent_area_label->setText(ss.str().c_str()); // _parent_area_label->setText(std::to_string( tree_selected_id).c_str()); @@ -616,7 +616,7 @@ namespace Noggit if (_parent_area_id) { std::stringstream ss; - ss << _parent_area_id << "-" << gAreaDB.getAreaName(_parent_area_id); + ss << _parent_area_id << "-" << gAreaDB.getAreaFullName(_parent_area_id); _parent_area_label->setText(ss.str().c_str()); } else diff --git a/src/noggit/ui/texturing_tool.cpp b/src/noggit/ui/texturing_tool.cpp index f85f86be..01a5152e 100755 --- a/src/noggit/ui/texturing_tool.cpp +++ b/src/noggit/ui/texturing_tool.cpp @@ -1111,7 +1111,7 @@ namespace Noggit _loaded_effects.push_back(ground_effect); // give it a name // Area is probably useless if we merge since duplictes are per area. - _loaded_effects.back().Name += " - " + gAreaDB.getAreaName(chunk->getAreaID()); + _loaded_effects.back().Name += " - " + gAreaDB.getAreaFullName(chunk->getAreaID()); } // _texture_effect_ids[effect_id]++;