mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-02 10:33:46 +00:00
refactor(Tools): restyle tools with astyle (#3465)
This commit is contained in:
@@ -80,7 +80,8 @@ float CONF_flat_height_delta_limit = 0.005f; // If max - min less this value - s
|
|||||||
float CONF_flat_liquid_delta_limit = 0.001f; // If max - min less this value - liquid surface is flat
|
float CONF_flat_liquid_delta_limit = 0.001f; // If max - min less this value - liquid surface is flat
|
||||||
|
|
||||||
// List MPQ for extract from
|
// List MPQ for extract from
|
||||||
const char *CONF_mpq_list[]={
|
const char* CONF_mpq_list[] =
|
||||||
|
{
|
||||||
"common.MPQ",
|
"common.MPQ",
|
||||||
"common-2.MPQ",
|
"common-2.MPQ",
|
||||||
"lichking.MPQ",
|
"lichking.MPQ",
|
||||||
@@ -715,10 +716,18 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
|||||||
liquid_entry[i][j] = h->liquidType;
|
liquid_entry[i][j] = h->liquidType;
|
||||||
switch (LiqType[h->liquidType])
|
switch (LiqType[h->liquidType])
|
||||||
{
|
{
|
||||||
case LIQUID_TYPE_WATER: liquid_flags[i][j] |= MAP_LIQUID_TYPE_WATER; break;
|
case LIQUID_TYPE_WATER:
|
||||||
case LIQUID_TYPE_OCEAN: liquid_flags[i][j] |= MAP_LIQUID_TYPE_OCEAN; break;
|
liquid_flags[i][j] |= MAP_LIQUID_TYPE_WATER;
|
||||||
case LIQUID_TYPE_MAGMA: liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA; break;
|
break;
|
||||||
case LIQUID_TYPE_SLIME: liquid_flags[i][j] |= MAP_LIQUID_TYPE_SLIME; break;
|
case LIQUID_TYPE_OCEAN:
|
||||||
|
liquid_flags[i][j] |= MAP_LIQUID_TYPE_OCEAN;
|
||||||
|
break;
|
||||||
|
case LIQUID_TYPE_MAGMA:
|
||||||
|
liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA;
|
||||||
|
break;
|
||||||
|
case LIQUID_TYPE_SLIME:
|
||||||
|
liquid_flags[i][j] |= MAP_LIQUID_TYPE_SLIME;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf("\nCan't find Liquid type %u for map %s\nchunk %d,%d\n", h->liquidType, inputPath.c_str(), i, j);
|
printf("\nCan't find Liquid type %u for map %s\nchunk %d,%d\n", h->liquidType, inputPath.c_str(), i, j);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ enum LiquidType
|
|||||||
//
|
//
|
||||||
class adt_MCVT
|
class adt_MCVT
|
||||||
{
|
{
|
||||||
union{
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
@@ -49,7 +50,8 @@ public:
|
|||||||
//
|
//
|
||||||
class adt_MCLQ
|
class adt_MCLQ
|
||||||
{
|
{
|
||||||
union{
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
@@ -57,7 +59,8 @@ public:
|
|||||||
uint32 size;
|
uint32 size;
|
||||||
float height1;
|
float height1;
|
||||||
float height2;
|
float height2;
|
||||||
struct liquid_data{
|
struct liquid_data
|
||||||
|
{
|
||||||
uint32 light;
|
uint32 light;
|
||||||
float height;
|
float height;
|
||||||
} liquid[ADT_CELL_SIZE + 1][ADT_CELL_SIZE + 1];
|
} liquid[ADT_CELL_SIZE + 1][ADT_CELL_SIZE + 1];
|
||||||
@@ -78,7 +81,8 @@ public:
|
|||||||
//
|
//
|
||||||
class adt_MCNK
|
class adt_MCNK
|
||||||
{
|
{
|
||||||
union{
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
@@ -137,13 +141,15 @@ public:
|
|||||||
//
|
//
|
||||||
class adt_MCIN
|
class adt_MCIN
|
||||||
{
|
{
|
||||||
union{
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
uint32 size;
|
uint32 size;
|
||||||
struct adt_CELLS{
|
struct adt_CELLS
|
||||||
|
{
|
||||||
uint32 offsMCNK;
|
uint32 offsMCNK;
|
||||||
uint32 size;
|
uint32 size;
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
@@ -163,7 +169,8 @@ public:
|
|||||||
#define ADT_LIQUID_HEADER_FULL_LIGHT 0x01
|
#define ADT_LIQUID_HEADER_FULL_LIGHT 0x01
|
||||||
#define ADT_LIQUID_HEADER_NO_HIGHT 0x02
|
#define ADT_LIQUID_HEADER_NO_HIGHT 0x02
|
||||||
|
|
||||||
struct adt_liquid_header{
|
struct adt_liquid_header
|
||||||
|
{
|
||||||
uint16 liquidType; // Index from LiquidType.dbc
|
uint16 liquidType; // Index from LiquidType.dbc
|
||||||
uint16 formatFlags;
|
uint16 formatFlags;
|
||||||
float heightLevel1;
|
float heightLevel1;
|
||||||
@@ -182,13 +189,15 @@ struct adt_liquid_header{
|
|||||||
class adt_MH2O
|
class adt_MH2O
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
union{
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
uint32 size;
|
uint32 size;
|
||||||
|
|
||||||
struct adt_LIQUID{
|
struct adt_LIQUID
|
||||||
|
{
|
||||||
uint32 offsData1;
|
uint32 offsData1;
|
||||||
uint32 used;
|
uint32 used;
|
||||||
uint32 offsData2;
|
uint32 offsData2;
|
||||||
@@ -274,7 +283,8 @@ public:
|
|||||||
//
|
//
|
||||||
class adt_MHDR
|
class adt_MHDR
|
||||||
{
|
{
|
||||||
union{
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
@@ -317,7 +327,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ADT_file : public FileLoader{
|
class ADT_file : public FileLoader
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
bool prepareLoadedData();
|
bool prepareLoadedData();
|
||||||
ADT_file();
|
ADT_file();
|
||||||
|
|||||||
@@ -79,13 +79,15 @@ public:
|
|||||||
Iterator(DBCFile& file, unsigned char* offset):
|
Iterator(DBCFile& file, unsigned char* offset):
|
||||||
record(file, offset) {}
|
record(file, offset) {}
|
||||||
/// Advance (prefix only)
|
/// Advance (prefix only)
|
||||||
Iterator & operator++() {
|
Iterator& operator++()
|
||||||
|
{
|
||||||
record.offset += record.file.recordSize;
|
record.offset += record.file.recordSize;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
/// Return address of current instance
|
/// Return address of current instance
|
||||||
Record const& operator*() const { return record; }
|
Record const& operator*() const { return record; }
|
||||||
const Record* operator->() const {
|
const Record* operator->() const
|
||||||
|
{
|
||||||
return &record;
|
return &record;
|
||||||
}
|
}
|
||||||
/// Comparison
|
/// Comparison
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ union u_map_fcc
|
|||||||
//
|
//
|
||||||
struct file_MVER
|
struct file_MVER
|
||||||
{
|
{
|
||||||
union{
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
@@ -56,7 +57,8 @@ struct file_MVER
|
|||||||
uint32 ver;
|
uint32 ver;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileLoader{
|
class FileLoader
|
||||||
|
{
|
||||||
uint8* data;
|
uint8* data;
|
||||||
uint32 data_size;
|
uint32 data_size;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ MPQArchive::MPQArchive(const char* filename)
|
|||||||
{
|
{
|
||||||
int result = libmpq__archive_open(&mpq_a, filename, -1);
|
int result = libmpq__archive_open(&mpq_a, filename, -1);
|
||||||
printf("Opening %s\n", filename);
|
printf("Opening %s\n", filename);
|
||||||
if(result) {
|
if(result)
|
||||||
switch(result) {
|
{
|
||||||
|
switch(result)
|
||||||
|
{
|
||||||
case LIBMPQ_ERROR_OPEN :
|
case LIBMPQ_ERROR_OPEN :
|
||||||
printf("Error opening archive '%s': Does file really exist?\n", filename);
|
printf("Error opening archive '%s': Does file really exist?\n", filename);
|
||||||
break;
|
break;
|
||||||
@@ -62,7 +64,8 @@ MPQFile::MPQFile(const char* filename):
|
|||||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||||
|
|
||||||
// HACK: in patch.mpq some files don't want to open and give 1 for filesize
|
// HACK: in patch.mpq some files don't want to open and give 1 for filesize
|
||||||
if (size<=1) {
|
if (size <= 1)
|
||||||
|
{
|
||||||
// printf("warning: file %s has size %d; cannot read.\n", filename, size);
|
// printf("warning: file %s has size %d; cannot read.\n", filename, size);
|
||||||
eof = true;
|
eof = true;
|
||||||
buffer = 0;
|
buffer = 0;
|
||||||
@@ -85,7 +88,8 @@ size_t MPQFile::read(void* dest, size_t bytes)
|
|||||||
if (eof) return 0;
|
if (eof) return 0;
|
||||||
|
|
||||||
size_t rpos = pointer + bytes;
|
size_t rpos = pointer + bytes;
|
||||||
if (rpos > size_t(size)) {
|
if (rpos > size_t(size))
|
||||||
|
{
|
||||||
bytes = size - pointer;
|
bytes = size - pointer;
|
||||||
eof = true;
|
eof = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ public:
|
|||||||
~MPQArchive() { close(); }
|
~MPQArchive() { close(); }
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
void GetFileListTo(vector<string>& filelist) {
|
void GetFileListTo(vector<string>& filelist)
|
||||||
|
{
|
||||||
uint32_t filenum;
|
uint32_t filenum;
|
||||||
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
||||||
libmpq__off_t size, transferred;
|
libmpq__off_t size, transferred;
|
||||||
@@ -43,7 +44,8 @@ public:
|
|||||||
|
|
||||||
token = strtok( buffer, seps );
|
token = strtok( buffer, seps );
|
||||||
uint32 counter = 0;
|
uint32 counter = 0;
|
||||||
while ((token != nullptr) && (counter < size)) {
|
while ((token != nullptr) && (counter < size))
|
||||||
|
{
|
||||||
//cout << token << endl;
|
//cout << token << endl;
|
||||||
token[strlen(token) - 1] = 0;
|
token[strlen(token) - 1] = 0;
|
||||||
string s = token;
|
string s = token;
|
||||||
|
|||||||
@@ -13,8 +13,10 @@
|
|||||||
//**************************************************************************************
|
//**************************************************************************************
|
||||||
#define WDT_MAP_SIZE 64
|
#define WDT_MAP_SIZE 64
|
||||||
|
|
||||||
class wdt_MWMO{
|
class wdt_MWMO
|
||||||
union{
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
@@ -23,8 +25,10 @@ public:
|
|||||||
bool prepareLoadedData();
|
bool prepareLoadedData();
|
||||||
};
|
};
|
||||||
|
|
||||||
class wdt_MPHD{
|
class wdt_MPHD
|
||||||
union{
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
@@ -42,15 +46,18 @@ public:
|
|||||||
bool prepareLoadedData();
|
bool prepareLoadedData();
|
||||||
};
|
};
|
||||||
|
|
||||||
class wdt_MAIN{
|
class wdt_MAIN
|
||||||
union{
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
uint32 size;
|
uint32 size;
|
||||||
|
|
||||||
struct adtData{
|
struct adtData
|
||||||
|
{
|
||||||
uint32 exist;
|
uint32 exist;
|
||||||
uint32 data1;
|
uint32 data1;
|
||||||
} adt_list[64][64];
|
} adt_list[64][64];
|
||||||
@@ -58,7 +65,8 @@ public:
|
|||||||
bool prepareLoadedData();
|
bool prepareLoadedData();
|
||||||
};
|
};
|
||||||
|
|
||||||
class WDT_file : public FileLoader{
|
class WDT_file : public FileLoader
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
bool prepareLoadedData();
|
bool prepareLoadedData();
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ eof(false), buffer(0), pointer(0), size(0)
|
|||||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||||
|
|
||||||
// HACK: in patch.mpq some files don't want to open and give 1 for filesize
|
// HACK: in patch.mpq some files don't want to open and give 1 for filesize
|
||||||
if (size<=1) {
|
if (size <= 1)
|
||||||
|
{
|
||||||
// printf("warning: file %s has size %d; cannot Read.\n", filename, size);
|
// printf("warning: file %s has size %d; cannot Read.\n", filename, size);
|
||||||
eof = true;
|
eof = true;
|
||||||
buffer = 0;
|
buffer = 0;
|
||||||
@@ -83,7 +84,8 @@ size_t MPQFile::Read(void* dest, size_t bytes)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size_t rpos = pointer + bytes;
|
size_t rpos = pointer + bytes;
|
||||||
if (rpos > size_t(size)) {
|
if (rpos > size_t(size))
|
||||||
|
{
|
||||||
bytes = size - pointer;
|
bytes = size - pointer;
|
||||||
eof = true;
|
eof = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
#include "DBC.h"
|
#include "DBC.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
char const* MPQManager::Files[] = {
|
char const* MPQManager::Files[] =
|
||||||
|
{
|
||||||
"common.MPQ",
|
"common.MPQ",
|
||||||
"common-2.MPQ",
|
"common-2.MPQ",
|
||||||
"expansion.MPQ",
|
"expansion.MPQ",
|
||||||
|
|||||||
@@ -881,8 +881,7 @@ namespace MMAP
|
|||||||
|
|
||||||
// now that tile is written to disk, we can unload it
|
// now that tile is written to disk, we can unload it
|
||||||
navMesh->removeTile(tileRef, nullptr, nullptr);
|
navMesh->removeTile(tileRef, nullptr, nullptr);
|
||||||
}
|
} while (0);
|
||||||
while (0);
|
|
||||||
|
|
||||||
if (m_debugOutput)
|
if (m_debugOutput)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,8 +93,7 @@ namespace MMAP
|
|||||||
{
|
{
|
||||||
if ((findFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
if ((findFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||||
fileList.push_back(std::string(findFileInfo.cFileName));
|
fileList.push_back(std::string(findFileInfo.cFileName));
|
||||||
}
|
} while (FindNextFile(hFind, &findFileInfo));
|
||||||
while (FindNextFile(hFind, &findFileInfo));
|
|
||||||
|
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
|
|
||||||
|
|||||||
@@ -559,23 +559,41 @@ namespace MMAP
|
|||||||
indices[1] = square + V9_SIZE + 1 + rowOffset;
|
indices[1] = square + V9_SIZE + 1 + rowOffset;
|
||||||
indices[2] = square + V9_SIZE + rowOffset;
|
indices[2] = square + V9_SIZE + rowOffset;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
switch (triangle)
|
switch (triangle)
|
||||||
{ // 0-----1 .... 128
|
{
|
||||||
case TOP: // |\ |
|
case TOP:
|
||||||
indices[0] = square+rowOffset; // | \ T |
|
indices[0] = square + rowOffset;
|
||||||
indices[1] = square+1+rowOffset; // | \ |
|
indices[1] = square + 1 + rowOffset;
|
||||||
indices[2] = square+V9_SIZE+1+rowOffset; // | B \ |
|
indices[2] = square + V9_SIZE + 1 + rowOffset;
|
||||||
break; // | \|
|
break;
|
||||||
case BOTTOM: // 129---130 ... 386
|
case BOTTOM:
|
||||||
indices[0] = square+rowOffset; // |\ |
|
indices[0] = square + rowOffset;
|
||||||
indices[1] = square+V9_SIZE+1+rowOffset; // | \ |
|
indices[1] = square + V9_SIZE + 1 + rowOffset;
|
||||||
indices[2] = square+V9_SIZE+rowOffset; // | \ |
|
indices[2] = square + V9_SIZE + rowOffset;
|
||||||
break; // | \ |
|
break;
|
||||||
default: break; // | \|
|
default:
|
||||||
} // 258---259 ... 515
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
0-----1 .... 128
|
||||||
|
|\ |
|
||||||
|
| \ T |
|
||||||
|
| \ |
|
||||||
|
| B \ |
|
||||||
|
| \|
|
||||||
|
129---130 ... 386
|
||||||
|
|\ |
|
||||||
|
| \ |
|
||||||
|
| \ |
|
||||||
|
| \ |
|
||||||
|
| \|
|
||||||
|
258---259 ... 515
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -773,8 +791,7 @@ namespace MMAP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} while (false);
|
||||||
while (false);
|
|
||||||
|
|
||||||
vmapManager->unloadMap(mapID, tileX, tileY);
|
vmapManager->unloadMap(mapID, tileX, tileY);
|
||||||
delete vmapManager;
|
delete vmapManager;
|
||||||
|
|||||||
@@ -98,13 +98,15 @@ public:
|
|||||||
Iterator(DBCFile& file, unsigned char* offset):
|
Iterator(DBCFile& file, unsigned char* offset):
|
||||||
record(file, offset) {}
|
record(file, offset) {}
|
||||||
/// Advance (prefix only)
|
/// Advance (prefix only)
|
||||||
Iterator & operator++() {
|
Iterator& operator++()
|
||||||
|
{
|
||||||
record.offset += record.file.recordSize;
|
record.offset += record.file.recordSize;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
/// Return address of current instance
|
/// Return address of current instance
|
||||||
Record const& operator*() const { return record; }
|
Record const& operator*() const { return record; }
|
||||||
const Record* operator->() const {
|
const Record* operator->() const
|
||||||
|
{
|
||||||
return &record;
|
return &record;
|
||||||
}
|
}
|
||||||
/// Comparison
|
/// Comparison
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ typedef uint8_t uint8;
|
|||||||
//
|
//
|
||||||
struct file_MVER
|
struct file_MVER
|
||||||
{
|
{
|
||||||
union{
|
union
|
||||||
|
{
|
||||||
uint32 fcc;
|
uint32 fcc;
|
||||||
char fcc_txt[4];
|
char fcc_txt[4];
|
||||||
};
|
};
|
||||||
@@ -50,7 +51,8 @@ struct file_MVER
|
|||||||
uint32 ver;
|
uint32 ver;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileLoader{
|
class FileLoader
|
||||||
|
{
|
||||||
uint8* data;
|
uint8* data;
|
||||||
uint32 data_size;
|
uint32 data_size;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ MPQArchive::MPQArchive(const char* filename)
|
|||||||
{
|
{
|
||||||
int result = libmpq__archive_open(&mpq_a, filename, -1);
|
int result = libmpq__archive_open(&mpq_a, filename, -1);
|
||||||
printf("Opening %s\n", filename);
|
printf("Opening %s\n", filename);
|
||||||
if(result) {
|
if(result)
|
||||||
switch(result) {
|
{
|
||||||
|
switch(result)
|
||||||
|
{
|
||||||
case LIBMPQ_ERROR_OPEN :
|
case LIBMPQ_ERROR_OPEN :
|
||||||
printf("Error opening archive '%s': Does file really exist?\n", filename);
|
printf("Error opening archive '%s': Does file really exist?\n", filename);
|
||||||
break;
|
break;
|
||||||
@@ -62,7 +64,8 @@ MPQFile::MPQFile(const char* filename):
|
|||||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||||
|
|
||||||
// HACK: in patch.mpq some files don't want to open and give 1 for filesize
|
// HACK: in patch.mpq some files don't want to open and give 1 for filesize
|
||||||
if (size<=1) {
|
if (size <= 1)
|
||||||
|
{
|
||||||
// printf("info: file %s has size %d; considered dummy file.\n", filename, size);
|
// printf("info: file %s has size %d; considered dummy file.\n", filename, size);
|
||||||
eof = true;
|
eof = true;
|
||||||
buffer = 0;
|
buffer = 0;
|
||||||
@@ -85,7 +88,8 @@ size_t MPQFile::read(void* dest, size_t bytes)
|
|||||||
if (eof) return 0;
|
if (eof) return 0;
|
||||||
|
|
||||||
size_t rpos = pointer + bytes;
|
size_t rpos = pointer + bytes;
|
||||||
if (rpos > size_t(size)) {
|
if (rpos > size_t(size))
|
||||||
|
{
|
||||||
bytes = size - pointer;
|
bytes = size - pointer;
|
||||||
eof = true;
|
eof = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public:
|
|||||||
MPQArchive(const char* filename);
|
MPQArchive(const char* filename);
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
void GetFileListTo(vector<string>& filelist) {
|
void GetFileListTo(vector<string>& filelist)
|
||||||
|
{
|
||||||
uint32_t filenum;
|
uint32_t filenum;
|
||||||
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
||||||
libmpq__off_t size, transferred;
|
libmpq__off_t size, transferred;
|
||||||
@@ -42,7 +43,8 @@ public:
|
|||||||
|
|
||||||
token = strtok( buffer, seps );
|
token = strtok( buffer, seps );
|
||||||
uint32 counter = 0;
|
uint32 counter = 0;
|
||||||
while ((token != nullptr) && (counter < size)) {
|
while ((token != nullptr) && (counter < size))
|
||||||
|
{
|
||||||
//cout << token << endl;
|
//cout << token << endl;
|
||||||
token[strlen(token) - 1] = 0;
|
token[strlen(token) - 1] = 0;
|
||||||
string s = token;
|
string s = token;
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ public:
|
|||||||
|
|
||||||
Vec3D(const Vec3D& v) : x(v.x), y(v.y), z(v.z) {}
|
Vec3D(const Vec3D& v) : x(v.x), y(v.y), z(v.z) {}
|
||||||
|
|
||||||
Vec3D& operator= (const Vec3D &v) {
|
Vec3D& operator= (const Vec3D& v)
|
||||||
|
{
|
||||||
x = v.x;
|
x = v.x;
|
||||||
y = v.y;
|
y = v.y;
|
||||||
z = v.z;
|
z = v.z;
|
||||||
@@ -135,7 +136,8 @@ public:
|
|||||||
|
|
||||||
Vec2D(const Vec2D& v) : x(v.x), y(v.y) {}
|
Vec2D(const Vec2D& v) : x(v.x), y(v.y) {}
|
||||||
|
|
||||||
Vec2D& operator= (const Vec2D &v) {
|
Vec2D& operator= (const Vec2D& v)
|
||||||
|
{
|
||||||
x = v.x;
|
x = v.x;
|
||||||
y = v.y;
|
y = v.y;
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
Reference in New Issue
Block a user