Tools/MMapGenerator: Fix some warnings reported by GCC 4.9 and MSVC 14 with W4
* /var/lib/jenkins/jobs/tc_335_release_gcc49/workspace/src/tools/mmaps_generator/MapBuilder.cpp: In member function ‘void MMAP::MapBuilder::WorkerThread()’:
/var/lib/jenkins/jobs/tc_335_release_gcc49/workspace/src/tools/mmaps_generator/MapBuilder.cpp:174:28: error: ‘mapId’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
buildMap(mapId);
* variable redefinition warning
* remove 2 "using namespace std"
*NO reextraction of mmaps needed*
This commit is contained in:
1 parent
5df0bcdd4e
commit
49a16c9fd0
12 files changed
+71
-95
No files matched your search
@@ -22,7 +22,6 @@
|
||||
#include "PathCommon.h"
|
||||
#include "TerrainBuilder.h"
|
||||
#include "Recast.h"
|
||||
#include "DetourNavMesh.h"
|
||||
|
||||
namespace MMAP
|
||||
{
|
||||
|
||||
@@ -15,17 +15,15 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <limits.h>
|
||||
|
||||
#include "PathCommon.h"
|
||||
#include "MapBuilder.h"
|
||||
|
||||
#include "MapTree.h"
|
||||
#include "ModelInstance.h"
|
||||
|
||||
#include "DetourNavMeshBuilder.h"
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourCommon.h"
|
||||
#include "IntermediateValues.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
|
||||
#define MMAP_VERSION 5
|
||||
@@ -164,7 +162,7 @@ namespace MMAP
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
uint32 mapId;
|
||||
uint32 mapId = 0;
|
||||
|
||||
_queue.WaitAndPop(mapId);
|
||||
|
||||
@@ -215,12 +213,12 @@ namespace MMAP
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void MapBuilder::getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY)
|
||||
void MapBuilder::getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY) const
|
||||
{
|
||||
maxX = INT_MAX;
|
||||
maxY = INT_MAX;
|
||||
minX = INT_MIN;
|
||||
minY = INT_MIN;
|
||||
maxX = std::numeric_limits<uint32>::max();
|
||||
maxY = std::numeric_limits<uint32>::max();
|
||||
minX = 0;
|
||||
minY = 0;
|
||||
|
||||
float bmin[3] = { 0, 0, 0 };
|
||||
float bmax[3] = { 0, 0, 0 };
|
||||
|
||||
@@ -19,20 +19,18 @@
|
||||
#ifndef _MAP_BUILDER_H
|
||||
#define _MAP_BUILDER_H
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include "TerrainBuilder.h"
|
||||
#include "IntermediateValues.h"
|
||||
|
||||
#include "Recast.h"
|
||||
#include "DetourNavMesh.h"
|
||||
#include "ProducerConsumerQueue.h"
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
using namespace VMAP;
|
||||
|
||||
namespace MMAP
|
||||
@@ -120,7 +118,7 @@ namespace MMAP
|
||||
void getTileBounds(uint32 tileX, uint32 tileY,
|
||||
float* verts, int vertCount,
|
||||
float* bmin, float* bmax);
|
||||
void getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY);
|
||||
void getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY) const;
|
||||
|
||||
bool shouldSkipMap(uint32 mapID);
|
||||
bool isTransportMap(uint32 mapID);
|
||||
|
||||
@@ -19,11 +19,10 @@
|
||||
#ifndef _MMAP_COMMON_H
|
||||
#define _MMAP_COMMON_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <stddef.h>
|
||||
#include <dirent.h>
|
||||
|
||||
@@ -764,12 +764,12 @@ namespace MMAP
|
||||
}
|
||||
|
||||
uint32 liqOffset = meshData.liquidVerts.size() / 3;
|
||||
for (uint32 i = 0; i < liqVerts.size(); ++i)
|
||||
meshData.liquidVerts.append(liqVerts[i].y, liqVerts[i].z, liqVerts[i].x);
|
||||
for (uint32 j = 0; j < liqVerts.size(); ++j)
|
||||
meshData.liquidVerts.append(liqVerts[j].y, liqVerts[j].z, liqVerts[j].x);
|
||||
|
||||
for (uint32 i = 0; i < liqTris.size() / 3; ++i)
|
||||
for (uint32 j = 0; j < liqTris.size() / 3; ++j)
|
||||
{
|
||||
meshData.liquidTris.append(liqTris[i*3+1] + liqOffset, liqTris[i*3+2] + liqOffset, liqTris[i*3] + liqOffset);
|
||||
meshData.liquidTris.append(liqTris[j*3+1] + liqOffset, liqTris[j*3+2] + liqOffset, liqTris[j*3] + liqOffset);
|
||||
meshData.liquidType.append(type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,11 +81,13 @@ namespace MMAP
|
||||
TerrainBuilder(bool skipLiquid);
|
||||
~TerrainBuilder();
|
||||
|
||||
TerrainBuilder(const TerrainBuilder &tb) = delete;
|
||||
|
||||
void loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData);
|
||||
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData);
|
||||
void loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData, const char* offMeshFilePath);
|
||||
|
||||
bool usesLiquids() { return !m_skipLiquid; }
|
||||
bool usesLiquids() const { return !m_skipLiquid; }
|
||||
|
||||
// vert and triangle methods
|
||||
static void transform(std::vector<G3D::Vector3> &original, std::vector<G3D::Vector3> &transformed,
|
||||
@@ -104,9 +106,6 @@ namespace MMAP
|
||||
/// Controls whether liquids are loaded
|
||||
bool m_skipLiquid;
|
||||
|
||||
/// Load the map terrain from file
|
||||
bool loadHeightMap(uint32 mapID, uint32 tileX, uint32 tileY, G3D::Array<float> &vertices, G3D::Array<int> &triangles, Spot portion);
|
||||
|
||||
/// Get the vector coordinate for a specific position
|
||||
void getHeightCoord(int index, Grid grid, float xOffset, float yOffset, float* coord, float* v);
|
||||
|
||||
@@ -121,10 +120,6 @@ namespace MMAP
|
||||
|
||||
/// Get the liquid type for a specific position
|
||||
uint8 getLiquidType(int square, const uint8 liquid_type[16][16]);
|
||||
|
||||
// hide parameterless and copy constructor
|
||||
TerrainBuilder();
|
||||
TerrainBuilder(const TerrainBuilder &tb);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -86,11 +86,11 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
||||
|
||||
uint32 size;
|
||||
|
||||
string xMap;
|
||||
string yMap;
|
||||
std::string xMap;
|
||||
std::string yMap;
|
||||
|
||||
Adtfilename.erase(Adtfilename.find(".adt"),4);
|
||||
string TempMapNumber;
|
||||
std::string TempMapNumber;
|
||||
TempMapNumber = Adtfilename.substr(Adtfilename.length()-6,6);
|
||||
xMap = TempMapNumber.substr(TempMapNumber.find("_")+1,(TempMapNumber.find_last_of("_")-1) - (TempMapNumber.find("_")));
|
||||
yMap = TempMapNumber.substr(TempMapNumber.find_last_of("_")+1,(TempMapNumber.length()) - (TempMapNumber.find_last_of("_")));
|
||||
@@ -134,7 +134,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
||||
ADT.read(buf, size);
|
||||
char *p=buf;
|
||||
int t=0;
|
||||
ModelInstansName = new string[size];
|
||||
ModelInstansName = new std::string[size];
|
||||
while (p<buf+size)
|
||||
{
|
||||
fixnamen(p,strlen(p));
|
||||
@@ -143,7 +143,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
||||
|
||||
ModelInstansName[t++] = s;
|
||||
|
||||
string path(p);
|
||||
std::string path(p);
|
||||
ExtractSingleModel(path);
|
||||
|
||||
p = p+strlen(p)+1;
|
||||
|
||||
@@ -21,13 +21,11 @@
|
||||
|
||||
#include "loadlib/loadlib.h"
|
||||
#include "libmpq/mpq.h"
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <deque>
|
||||
|
||||
using namespace std;
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
|
||||
class MPQArchive
|
||||
{
|
||||
@@ -38,7 +36,7 @@ public:
|
||||
MPQArchive(const char* filename);
|
||||
~MPQArchive() { close(); }
|
||||
|
||||
void GetFileListTo(vector<string>& filelist) {
|
||||
void GetFileListTo(std::vector<std::string>& filelist) {
|
||||
uint32_t filenum;
|
||||
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
||||
libmpq__off_t size, transferred;
|
||||
@@ -57,7 +55,7 @@ public:
|
||||
while ((token != NULL) && (counter < size)) {
|
||||
//cout << token << endl;
|
||||
token[strlen(token) - 1] = 0;
|
||||
string s = token;
|
||||
std::string s = token;
|
||||
filelist.push_back(s);
|
||||
counter += strlen(token) + 2;
|
||||
token = strtok(NULL, seps);
|
||||
@@ -78,9 +76,8 @@ class MPQFile
|
||||
char *buffer;
|
||||
libmpq__off_t pointer,size;
|
||||
|
||||
// disable copying
|
||||
MPQFile(const MPQFile& /*f*/) {}
|
||||
void operator=(const MPQFile& /*f*/) {}
|
||||
MPQFile(const MPQFile& /*f*/) = delete;
|
||||
void operator=(const MPQFile& /*f*/) = delete;
|
||||
|
||||
public:
|
||||
MPQFile(const char* filename); // filenames are not case sensitive
|
||||
|
||||
@@ -17,14 +17,15 @@
|
||||
*/
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <errno.h>
|
||||
|
||||
#include "adtfile.h"
|
||||
#include "wdtfile.h"
|
||||
#include "dbcfile.h"
|
||||
#include "wmo.h"
|
||||
#include "mpq_libmpq04.h"
|
||||
#include "vmapexport.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#include <sys/stat.h>
|
||||
#include <direct.h>
|
||||
#define mkdir _mkdir
|
||||
@@ -32,23 +33,14 @@
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <errno.h>
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
//#pragma warning(disable : 4505)
|
||||
//#pragma comment(lib, "Winmm.lib")
|
||||
|
||||
#include <map>
|
||||
|
||||
//From Extractor
|
||||
#include "adtfile.h"
|
||||
#include "wdtfile.h"
|
||||
#include "dbcfile.h"
|
||||
#include "wmo.h"
|
||||
#include "mpq_libmpq04.h"
|
||||
|
||||
#include "vmapexport.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Defines
|
||||
|
||||
@@ -129,12 +121,12 @@ bool ExtractWmo()
|
||||
|
||||
for (ArchiveSet::const_iterator ar_itr = gOpenArchives.begin(); ar_itr != gOpenArchives.end() && success; ++ar_itr)
|
||||
{
|
||||
vector<string> filelist;
|
||||
std::vector<std::string> filelist;
|
||||
|
||||
(*ar_itr)->GetFileListTo(filelist);
|
||||
for (vector<string>::iterator fname = filelist.begin(); fname != filelist.end() && success; ++fname)
|
||||
for (std::vector<std::string>::iterator fname = filelist.begin(); fname != filelist.end() && success; ++fname)
|
||||
{
|
||||
if (fname->find(".wmo") != string::npos)
|
||||
if (fname->find(".wmo") != std::string::npos)
|
||||
success = ExtractSingleWmo(*fname);
|
||||
}
|
||||
}
|
||||
@@ -203,7 +195,7 @@ bool ExtractSingleWmo(std::string& fname)
|
||||
sprintf(groupFileName, "%s_%03u.wmo", temp, i);
|
||||
//printf("Trying to open groupfile %s\n",groupFileName);
|
||||
|
||||
string s = groupFileName;
|
||||
std::string s = groupFileName;
|
||||
WMOGroup fgroup(s);
|
||||
if(!fgroup.open())
|
||||
{
|
||||
@@ -305,7 +297,7 @@ bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames)
|
||||
printf("\nGame path: %s\n", input_path);
|
||||
|
||||
char path[512];
|
||||
string in_path(input_path);
|
||||
std::string in_path(input_path);
|
||||
std::vector<std::string> locales, searchLocales;
|
||||
|
||||
searchLocales.push_back("enGB");
|
||||
@@ -345,10 +337,10 @@ bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames)
|
||||
}
|
||||
|
||||
// open expansion and common files
|
||||
pArchiveNames.push_back(input_path + string("common.MPQ"));
|
||||
pArchiveNames.push_back(input_path + string("common-2.MPQ"));
|
||||
pArchiveNames.push_back(input_path + string("expansion.MPQ"));
|
||||
pArchiveNames.push_back(input_path + string("lichking.MPQ"));
|
||||
pArchiveNames.push_back(input_path + std::string("common.MPQ"));
|
||||
pArchiveNames.push_back(input_path + std::string("common-2.MPQ"));
|
||||
pArchiveNames.push_back(input_path + std::string("expansion.MPQ"));
|
||||
pArchiveNames.push_back(input_path + std::string("lichking.MPQ"));
|
||||
|
||||
// now, scan for the patch levels in the core dir
|
||||
printf("Scanning patch levels from data directory.\n");
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "vmapexport.h"
|
||||
#include "wdtfile.h"
|
||||
#include "adtfile.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
char * wdtGetPlainName(char * FileName)
|
||||
@@ -30,7 +31,7 @@ char * wdtGetPlainName(char * FileName)
|
||||
return FileName;
|
||||
}
|
||||
|
||||
WDTFile::WDTFile(char* file_name, char* file_name1) : WDT(file_name), gWmoInstansName(NULL), gnWMO(0)
|
||||
WDTFile::WDTFile(char* file_name, char* file_name1) : gWmoInstansName(NULL), gnWMO(0), WDT(file_name)
|
||||
{
|
||||
filename.append(file_name1,strlen(file_name1));
|
||||
}
|
||||
@@ -77,7 +78,7 @@ bool WDTFile::init(char* /*map_id*/, unsigned int mapID)
|
||||
WDT.read(buf, size);
|
||||
char *p=buf;
|
||||
int q = 0;
|
||||
gWmoInstansName = new string[size];
|
||||
gWmoInstansName = new std::string[size];
|
||||
while (p < buf + size)
|
||||
{
|
||||
char* s=wdtGetPlainName(p);
|
||||
|
||||
@@ -20,26 +20,25 @@
|
||||
#define WDTFILE_H
|
||||
|
||||
#include "mpq_libmpq04.h"
|
||||
#include "wmo.h"
|
||||
#include <string>
|
||||
#include "stdlib.h"
|
||||
|
||||
class ADTFile;
|
||||
|
||||
class WDTFile
|
||||
{
|
||||
private:
|
||||
MPQFile WDT;
|
||||
string filename;
|
||||
public:
|
||||
WDTFile(char* file_name, char* file_name1);
|
||||
~WDTFile(void);
|
||||
bool init(char* map_id, unsigned int mapID);
|
||||
|
||||
string* gWmoInstansName;
|
||||
bool init(char* map_id, unsigned int mapID);
|
||||
ADTFile* GetMap(int x, int z);
|
||||
|
||||
std::string* gWmoInstansName;
|
||||
int gnWMO;
|
||||
|
||||
ADTFile* GetMap(int x, int z);
|
||||
private:
|
||||
MPQFile WDT;
|
||||
std::string filename;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -19,16 +19,14 @@
|
||||
#include "vmapexport.h"
|
||||
#include "wmo.h"
|
||||
#include "vec3d.h"
|
||||
#include "mpq_libmpq04.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#undef min
|
||||
#undef max
|
||||
#include "mpq_libmpq04.h"
|
||||
|
||||
using namespace std;
|
||||
extern uint16 *LiqType;
|
||||
|
||||
WMORoot::WMORoot(std::string &filename)
|
||||
|
||||
Reference in new issue
Block a user