mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
refactor(Tools): restyle tools with astyle (#3705)
This commit is contained in:
@@ -98,7 +98,7 @@ static const char* const langs[] = {"enGB", "enUS", "deDE", "esES", "frFR", "koK
|
||||
|
||||
void CreateDir( const std::string& Path )
|
||||
{
|
||||
if(chdir(Path.c_str()) == 0)
|
||||
if (chdir(Path.c_str()) == 0)
|
||||
{
|
||||
int ret = chdir("../");
|
||||
if (ret < 0)
|
||||
@@ -124,7 +124,7 @@ void CreateDir( const std::string& Path )
|
||||
bool FileExists( const char* FileName )
|
||||
{
|
||||
int fp = _open(FileName, OPEN_FLAGS);
|
||||
if(fp != -1)
|
||||
if (fp != -1)
|
||||
{
|
||||
_close(fp);
|
||||
return true;
|
||||
@@ -148,41 +148,41 @@ void Usage(char* prg)
|
||||
|
||||
void HandleArgs(int argc, char* arg[])
|
||||
{
|
||||
for(int c = 1; c < argc; ++c)
|
||||
for (int c = 1; c < argc; ++c)
|
||||
{
|
||||
// i - input path
|
||||
// o - output path
|
||||
// e - extract only MAP(1)/DBC(2) - standard both(3)
|
||||
// f - use float to int conversion
|
||||
// h - limit minimum height
|
||||
if(arg[c][0] != '-')
|
||||
if (arg[c][0] != '-')
|
||||
Usage(arg[0]);
|
||||
|
||||
switch(arg[c][1])
|
||||
switch (arg[c][1])
|
||||
{
|
||||
case 'i':
|
||||
if(c + 1 < argc) // all ok
|
||||
if (c + 1 < argc) // all ok
|
||||
strcpy(input_path, arg[(c++) + 1]);
|
||||
else
|
||||
Usage(arg[0]);
|
||||
break;
|
||||
case 'o':
|
||||
if(c + 1 < argc) // all ok
|
||||
if (c + 1 < argc) // all ok
|
||||
strcpy(output_path, arg[(c++) + 1]);
|
||||
else
|
||||
Usage(arg[0]);
|
||||
break;
|
||||
case 'f':
|
||||
if(c + 1 < argc) // all ok
|
||||
if (c + 1 < argc) // all ok
|
||||
CONF_allow_float_to_int = atoi(arg[(c++) + 1]) != 0;
|
||||
else
|
||||
Usage(arg[0]);
|
||||
break;
|
||||
case 'e':
|
||||
if(c + 1 < argc) // all ok
|
||||
if (c + 1 < argc) // all ok
|
||||
{
|
||||
CONF_extract = atoi(arg[(c++) + 1]);
|
||||
if(!(CONF_extract > 0 && CONF_extract < 4))
|
||||
if (!(CONF_extract > 0 && CONF_extract < 4))
|
||||
Usage(arg[0]);
|
||||
}
|
||||
else
|
||||
@@ -199,7 +199,7 @@ uint32 ReadBuild(int locale)
|
||||
//printf("Read %s file... ", filename.c_str());
|
||||
|
||||
MPQFile m(filename.c_str());
|
||||
if(m.isEof())
|
||||
if (m.isEof())
|
||||
{
|
||||
printf("Fatal error: Not found %s file!\n", filename.c_str());
|
||||
exit(1);
|
||||
@@ -234,7 +234,7 @@ uint32 ReadMapDBC()
|
||||
printf("Read Map.dbc file... ");
|
||||
DBCFile dbc("DBFilesClient\\Map.dbc");
|
||||
|
||||
if(!dbc.open())
|
||||
if (!dbc.open())
|
||||
{
|
||||
printf("Fatal error: Invalid Map.dbc file format!\n");
|
||||
exit(1);
|
||||
@@ -242,7 +242,7 @@ uint32 ReadMapDBC()
|
||||
|
||||
size_t map_count = dbc.getRecordCount();
|
||||
map_ids = new map_id[map_count];
|
||||
for(uint32 x = 0; x < map_count; ++x)
|
||||
for (uint32 x = 0; x < map_count; ++x)
|
||||
{
|
||||
map_ids[x].id = dbc.getRecord(x).getUInt(0);
|
||||
strcpy(map_ids[x].name, dbc.getRecord(x).getString(1));
|
||||
@@ -255,7 +255,7 @@ void ReadLiquidTypeTableDBC()
|
||||
{
|
||||
printf("Read LiquidType.dbc file...");
|
||||
DBCFile dbc("DBFilesClient\\LiquidType.dbc");
|
||||
if(!dbc.open())
|
||||
if (!dbc.open())
|
||||
{
|
||||
printf("Fatal error: Invalid LiquidType.dbc file format!\n");
|
||||
exit(1);
|
||||
@@ -266,7 +266,7 @@ void ReadLiquidTypeTableDBC()
|
||||
LiqType = new uint16[liqTypeMaxId + 1];
|
||||
memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16));
|
||||
|
||||
for(uint32 x = 0; x < liqTypeCount; ++x)
|
||||
for (uint32 x = 0; x < liqTypeCount; ++x)
|
||||
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
||||
|
||||
printf("Done! (%u LiqTypes loaded)\n", (uint32)liqTypeCount);
|
||||
@@ -522,7 +522,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
}
|
||||
for (int y = 0; y <= ADT_GRID_SIZE; y++)
|
||||
{
|
||||
for(int x = 0; x <= ADT_GRID_SIZE; x++)
|
||||
for (int x = 0; x <= ADT_GRID_SIZE; x++)
|
||||
{
|
||||
float h = V9[y][x];
|
||||
if (maxHeight < h) maxHeight = h;
|
||||
@@ -690,7 +690,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
{
|
||||
for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
|
||||
{
|
||||
for(int j = 0; j < ADT_CELLS_PER_GRID; j++)
|
||||
for (int j = 0; j < ADT_CELLS_PER_GRID; j++)
|
||||
{
|
||||
adt_liquid_header* h = h2o->getLiquidData(i, j);
|
||||
if (!h)
|
||||
@@ -768,7 +768,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
bool fullType = false;
|
||||
for (int y = 0; y < ADT_CELLS_PER_GRID; y++)
|
||||
{
|
||||
for(int x = 0; x < ADT_CELLS_PER_GRID; x++)
|
||||
for (int x = 0; x < ADT_CELLS_PER_GRID; x++)
|
||||
{
|
||||
if (liquid_flags[y][x] != type)
|
||||
{
|
||||
@@ -796,7 +796,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
minHeight = 20000;
|
||||
for (int y = 0; y < ADT_GRID_SIZE; y++)
|
||||
{
|
||||
for(int x = 0; x < ADT_GRID_SIZE; x++)
|
||||
for (int x = 0; x < ADT_GRID_SIZE; x++)
|
||||
{
|
||||
if (liquid_show[y][x])
|
||||
{
|
||||
@@ -953,7 +953,7 @@ void ExtractMapsFromMpq(uint32 build)
|
||||
CreateDir(path);
|
||||
|
||||
printf("Convert map files\n");
|
||||
for(uint32 z = 0; z < map_count; ++z)
|
||||
for (uint32 z = 0; z < map_count; ++z)
|
||||
{
|
||||
printf("Extract %s (%d/%u) \n", map_ids[z].name, z + 1, map_count);
|
||||
// Loadup map grid data
|
||||
@@ -965,9 +965,9 @@ void ExtractMapsFromMpq(uint32 build)
|
||||
continue;
|
||||
}
|
||||
|
||||
for(uint32 y = 0; y < WDT_MAP_SIZE; ++y)
|
||||
for (uint32 y = 0; y < WDT_MAP_SIZE; ++y)
|
||||
{
|
||||
for(uint32 x = 0; x < WDT_MAP_SIZE; ++x)
|
||||
for (uint32 x = 0; x < WDT_MAP_SIZE; ++x)
|
||||
{
|
||||
if (!wdt.main->adt_list[y][x].exist)
|
||||
continue;
|
||||
@@ -986,13 +986,13 @@ void ExtractMapsFromMpq(uint32 build)
|
||||
bool ExtractFile( char const* mpq_name, std::string const& filename )
|
||||
{
|
||||
FILE* output = fopen(filename.c_str(), "wb");
|
||||
if(!output)
|
||||
if (!output)
|
||||
{
|
||||
printf("Can't create the output file '%s'\n", filename.c_str());
|
||||
return false;
|
||||
}
|
||||
MPQFile m(mpq_name);
|
||||
if(!m.isEof())
|
||||
if (!m.isEof())
|
||||
fwrite(m.getPointer(), 1, m.getSize(), output);
|
||||
|
||||
fclose(output);
|
||||
@@ -1006,7 +1006,7 @@ void ExtractDBCFiles(int locale, bool basicLocale)
|
||||
std::set<std::string> dbcfiles;
|
||||
|
||||
// get DBC file list
|
||||
for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
|
||||
for (ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
|
||||
{
|
||||
vector<string> files;
|
||||
(*i)->GetFileListTo(files);
|
||||
@@ -1018,7 +1018,7 @@ void ExtractDBCFiles(int locale, bool basicLocale)
|
||||
std::string path = output_path;
|
||||
path += "/dbc/";
|
||||
CreateDir(path);
|
||||
if(!basicLocale)
|
||||
if (!basicLocale)
|
||||
{
|
||||
path += langs[locale];
|
||||
path += "/";
|
||||
@@ -1040,7 +1040,7 @@ void ExtractDBCFiles(int locale, bool basicLocale)
|
||||
string filename = path;
|
||||
filename += (iter->c_str() + strlen("DBFilesClient\\"));
|
||||
|
||||
if(FileExists(filename.c_str()))
|
||||
if (FileExists(filename.c_str()))
|
||||
continue;
|
||||
|
||||
if (ExtractFile(iter->c_str(), filename))
|
||||
@@ -1056,14 +1056,14 @@ void LoadLocaleMPQFiles(int const locale)
|
||||
sprintf(filename, "%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]);
|
||||
new MPQArchive(filename);
|
||||
|
||||
for(int i = 1; i < 5; ++i)
|
||||
for (int i = 1; i < 5; ++i)
|
||||
{
|
||||
char ext[3] = "";
|
||||
if(i > 1)
|
||||
if (i > 1)
|
||||
sprintf(ext, "-%i", i);
|
||||
|
||||
sprintf(filename, "%s/Data/%s/patch-%s%s.MPQ", input_path, langs[locale], langs[locale], ext);
|
||||
if(FileExists(filename))
|
||||
if (FileExists(filename))
|
||||
new MPQArchive(filename);
|
||||
}
|
||||
}
|
||||
@@ -1072,17 +1072,17 @@ void LoadCommonMPQFiles()
|
||||
{
|
||||
char filename[512];
|
||||
int count = sizeof(CONF_mpq_list) / sizeof(char*);
|
||||
for(int i = 0; i < count; ++i)
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
sprintf(filename, "%s/Data/%s", input_path, CONF_mpq_list[i]);
|
||||
if(FileExists(filename))
|
||||
if (FileExists(filename))
|
||||
new MPQArchive(filename);
|
||||
}
|
||||
}
|
||||
|
||||
inline void CloseMPQFiles()
|
||||
{
|
||||
for(ArchiveSet::iterator j = gOpenArchives.begin(); j != gOpenArchives.end(); ++j) (*j)->close();
|
||||
for (ArchiveSet::iterator j = gOpenArchives.begin(); j != gOpenArchives.end(); ++j) (*j)->close();
|
||||
gOpenArchives.clear();
|
||||
}
|
||||
|
||||
@@ -1107,7 +1107,7 @@ int main(int argc, char* arg[])
|
||||
//Open MPQs
|
||||
LoadLocaleMPQFiles(i);
|
||||
|
||||
if((CONF_extract & EXTRACT_DBC) == 0)
|
||||
if ((CONF_extract & EXTRACT_DBC) == 0)
|
||||
{
|
||||
FirstLocale = i;
|
||||
build = ReadBuild(FirstLocale);
|
||||
@@ -1116,7 +1116,7 @@ int main(int argc, char* arg[])
|
||||
}
|
||||
|
||||
//Extract DBC files
|
||||
if(FirstLocale < 0)
|
||||
if (FirstLocale < 0)
|
||||
{
|
||||
FirstLocale = i;
|
||||
build = ReadBuild(FirstLocale);
|
||||
@@ -1131,7 +1131,7 @@ int main(int argc, char* arg[])
|
||||
}
|
||||
}
|
||||
|
||||
if(FirstLocale < 0)
|
||||
if (FirstLocale < 0)
|
||||
{
|
||||
printf("No locales detected\n");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user