mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
fix(Tools/vmaps): Fix extractor crash when some .mpq files does not exist (#11976)
* . * Clion event trace * .
This commit is contained in:
committed by
GitHub
parent
34b714639c
commit
a7c4c04e5a
@@ -18,6 +18,7 @@
|
||||
#include "mpq_libmpq04.h"
|
||||
#include <cstdio>
|
||||
#include <deque>
|
||||
#include <algorithm>
|
||||
|
||||
ArchiveSet gOpenArchives;
|
||||
|
||||
@@ -53,6 +54,11 @@ MPQArchive::MPQArchive(const char* filename)
|
||||
gOpenArchives.push_front(this);
|
||||
}
|
||||
|
||||
bool MPQArchive::isOpened() const
|
||||
{
|
||||
return std::find(gOpenArchives.begin(), gOpenArchives.end(), this) != gOpenArchives.end();
|
||||
}
|
||||
|
||||
void MPQArchive::close()
|
||||
{
|
||||
//gOpenArchives.erase(erase(&mpq_a);
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
mpq_archive_s* mpq_a;
|
||||
|
||||
MPQArchive(const char* filename);
|
||||
void close();
|
||||
~MPQArchive() { if (isOpened()) close(); }
|
||||
|
||||
void GetFileListTo(vector<string>& filelist)
|
||||
{
|
||||
@@ -65,6 +65,10 @@ public:
|
||||
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
private:
|
||||
void close();
|
||||
bool isOpened() const;
|
||||
};
|
||||
typedef std::deque<MPQArchive*> ArchiveSet;
|
||||
|
||||
@@ -95,13 +99,8 @@ public:
|
||||
|
||||
inline void flipcc(char* fcc)
|
||||
{
|
||||
char t;
|
||||
t = fcc[0];
|
||||
fcc[0] = fcc[3];
|
||||
fcc[3] = t;
|
||||
t = fcc[1];
|
||||
fcc[1] = fcc[2];
|
||||
fcc[2] = t;
|
||||
std::swap(fcc[0], fcc[3]);
|
||||
std::swap(fcc[1], fcc[2]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user