only load md5minimaptrnaslate data once in clientData instead of on every map load
This commit is contained in:
2
src/external/blizzard-archive-library
vendored
2
src/external/blizzard-archive-library
vendored
Submodule src/external/blizzard-archive-library updated: 07d3d1d684...2a150d766a
2
src/external/blizzard-database-library
vendored
2
src/external/blizzard-database-library
vendored
Submodule src/external/blizzard-database-library updated: 8e27738046...d0b399cb52
@@ -114,6 +114,7 @@ MapIndex::MapIndex (const std::string &pBasename, int map_id, World* world,
|
||||
/// this is the theory. Sadly, we are also compiling on 64 bit machines with size_t being 8 byte, not 4. Therefore, we can't do the same thing, Blizzard does in its 32bit executable.
|
||||
//theFile.read( &(mTiles[0][0]), sizeof( 8 * 64 * 64 ) );
|
||||
|
||||
// We could skip for WMO only maps
|
||||
for (int j = 0; j < 64; ++j)
|
||||
{
|
||||
for (int i = 0; i < 64; ++i)
|
||||
@@ -121,13 +122,17 @@ MapIndex::MapIndex (const std::string &pBasename, int map_id, World* world,
|
||||
theFile.read(&mTiles[j][i].flags, 4);
|
||||
theFile.seekRelative(4);
|
||||
|
||||
mTiles[j][i].tile = nullptr;
|
||||
|
||||
if (!(mTiles[j][i].flags & 1))
|
||||
continue;
|
||||
|
||||
std::stringstream adt_filename;
|
||||
adt_filename << "World\\Maps\\" << basename << "\\" << basename << "_" << i << "_" << j << ".adt";
|
||||
|
||||
mTiles[j][i].tile = nullptr;
|
||||
mTiles[j][i].onDisc = Noggit::Application::NoggitApplication::instance()->clientData()->existsOnDisk(adt_filename.str());
|
||||
|
||||
if (mTiles[j][i].onDisc && !(mTiles[j][i].flags & 1))
|
||||
if (mTiles[j][i].onDisc)
|
||||
{
|
||||
mTiles[j][i].flags |= 1;
|
||||
changed = true;
|
||||
@@ -1080,6 +1085,12 @@ void MapIndex::loadMaxUID()
|
||||
|
||||
void MapIndex::loadMinimapMD5translate()
|
||||
{
|
||||
auto& minimap_md5translate = Noggit::Application::NoggitApplication::instance()->clientData()->_minimap_md5translate;
|
||||
|
||||
// already loaded.
|
||||
if (minimap_md5translate.empty())
|
||||
return;
|
||||
|
||||
if (!Noggit::Application::NoggitApplication::instance()->clientData()->exists("textures/minimap/md5translate.trs"))
|
||||
{
|
||||
LogError << "md5translate.trs was not found. "
|
||||
@@ -1125,7 +1136,7 @@ void MapIndex::loadMinimapMD5translate()
|
||||
|
||||
if (cur_dir.length())
|
||||
{
|
||||
_minimap_md5translate[cur_dir.toStdString()][line_split[0].toStdString()] = line_split[1].toStdString();
|
||||
minimap_md5translate[cur_dir.toStdString()][line_split[0].toStdString()] = line_split[1].toStdString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1147,7 +1158,9 @@ void MapIndex::saveMinimapMD5translate()
|
||||
{
|
||||
QTextStream out(&file);
|
||||
|
||||
for (auto it = _minimap_md5translate.begin(); it != _minimap_md5translate.end(); ++it)
|
||||
auto const& minimap_md5translate = Noggit::Application::NoggitApplication::instance()->clientData()->_minimap_md5translate;
|
||||
|
||||
for (auto it = minimap_md5translate.begin(); it != minimap_md5translate.end(); ++it)
|
||||
{
|
||||
out << "dir: " << it->first.c_str() << "\n"; // save dir
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ private:
|
||||
|
||||
public:
|
||||
int const _map_id;
|
||||
std::unordered_map<std::string, std::unordered_map<std::string, std::string>> _minimap_md5translate;
|
||||
// std::unordered_map<std::string, std::unordered_map<std::string, std::string>> _minimap_md5translate;
|
||||
std::string globalWMOName;
|
||||
ENTRY_MODF wmoEntry;
|
||||
public:
|
||||
|
||||
@@ -970,7 +970,7 @@ void WorldRender::draw (glm::mat4x4 const& model_view
|
||||
continue;
|
||||
|
||||
glm::mat4x4 identity_mtx = glm::mat4x4{ 1 };
|
||||
auto const extents = selection_group.getExtents();
|
||||
auto const& extents = selection_group.getExtents();
|
||||
Noggit::Rendering::Primitives::WireBox::getInstance(_world->_context).draw(model_view
|
||||
, projection
|
||||
, identity_mtx
|
||||
@@ -2067,7 +2067,8 @@ bool WorldRender::saveMinimap(TileIndex const& tile_idx, MinimapRenderSettings*
|
||||
auto sstream = std::stringstream();
|
||||
sstream << map_name << "\\map" << tile_idx.x << "_" << std::setfill('0') << std::setw(2) << tile_idx.z << ".blp";
|
||||
std::string tilename_left = sstream.str();
|
||||
_world->mapIndex._minimap_md5translate[map_name][tilename_left] = tex_name;
|
||||
auto& minimap_md5translate = Noggit::Application::NoggitApplication::instance()->clientData()->_minimap_md5translate;
|
||||
minimap_md5translate[map_name][tilename_left] = tex_name;
|
||||
}
|
||||
catch(MapDB::NotFound)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user