mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-19 22:49:39 -04:00
Core: ported headers cleanup from master branch
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <deque>
|
||||
#include <set>
|
||||
@@ -25,6 +23,7 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "dbcfile.h"
|
||||
#include "Banner.h"
|
||||
#include "mpq_libmpq04.h"
|
||||
#include "StringFormat.h"
|
||||
|
||||
@@ -84,7 +83,7 @@ const char *CONF_mpq_list[]={
|
||||
"patch-5.MPQ",
|
||||
};
|
||||
|
||||
static const char* const langs[] = {"enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" };
|
||||
static char const* const langs[] = {"enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" };
|
||||
#define LANG_COUNT 12
|
||||
|
||||
void CreateDir(boost::filesystem::path const& path)
|
||||
@@ -122,7 +121,7 @@ void HandleArgs(int argc, char * arg[])
|
||||
if(arg[c][0] != '-')
|
||||
Usage(arg[0]);
|
||||
|
||||
switch(arg[c][1])
|
||||
switch (arg[c][1])
|
||||
{
|
||||
case 'i':
|
||||
if (c + 1 < argc && strlen(arg[c + 1]) < MAX_PATH_LENGTH) // all ok
|
||||
@@ -143,16 +142,16 @@ void HandleArgs(int argc, char * arg[])
|
||||
Usage(arg[0]);
|
||||
break;
|
||||
case 'f':
|
||||
if(c + 1 < argc) // all ok
|
||||
CONF_allow_float_to_int=atoi(arg[(c++) + 1])!=0;
|
||||
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 < 8))
|
||||
CONF_extract = atoi(arg[(c++) + 1]);
|
||||
if (!(CONF_extract > 0 && CONF_extract < 8))
|
||||
Usage(arg[0]);
|
||||
}
|
||||
else
|
||||
@@ -216,7 +215,7 @@ uint32 ReadMapDBC()
|
||||
{
|
||||
map_ids[x].id = dbc.getRecord(x).getUInt(0);
|
||||
|
||||
const char* map_name = dbc.getRecord(x).getString(1);
|
||||
char const* map_name = dbc.getRecord(x).getString(1);
|
||||
size_t max_map_name_length = sizeof(map_ids[x].name);
|
||||
if (strlen(map_name) >= max_map_name_length)
|
||||
{
|
||||
@@ -567,12 +566,12 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
float diff = maxHeight - minHeight;
|
||||
if (diff < CONF_float_to_int8_limit) // As uint8 (max accuracy = CONF_float_to_int8_limit/256)
|
||||
{
|
||||
heightHeader.flags|=MAP_HEIGHT_AS_INT8;
|
||||
heightHeader.flags |= MAP_HEIGHT_AS_INT8;
|
||||
step = selectUInt8StepStore(diff);
|
||||
}
|
||||
else if (diff<CONF_float_to_int16_limit) // As uint16 (max accuracy = CONF_float_to_int16_limit/65536)
|
||||
else if (diff < CONF_float_to_int16_limit) // As uint16 (max accuracy = CONF_float_to_int16_limit/65536)
|
||||
{
|
||||
heightHeader.flags|=MAP_HEIGHT_AS_INT16;
|
||||
heightHeader.flags |= MAP_HEIGHT_AS_INT16;
|
||||
step = selectUInt16StepStore(diff);
|
||||
}
|
||||
}
|
||||
@@ -852,30 +851,30 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
return false;
|
||||
}
|
||||
|
||||
outFile.write(reinterpret_cast<const char*>(&map), sizeof(map));
|
||||
outFile.write(reinterpret_cast<char const*>(&map), sizeof(map));
|
||||
// Store area data
|
||||
outFile.write(reinterpret_cast<const char*>(&areaHeader), sizeof(areaHeader));
|
||||
outFile.write(reinterpret_cast<char const*>(&areaHeader), sizeof(areaHeader));
|
||||
if (!(areaHeader.flags & MAP_AREA_NO_AREA))
|
||||
outFile.write(reinterpret_cast<const char*>(area_ids), sizeof(area_ids));
|
||||
outFile.write(reinterpret_cast<char const*>(area_ids), sizeof(area_ids));
|
||||
|
||||
// Store height data
|
||||
outFile.write(reinterpret_cast<const char*>(&heightHeader), sizeof(heightHeader));
|
||||
outFile.write(reinterpret_cast<char const*>(&heightHeader), sizeof(heightHeader));
|
||||
if (!(heightHeader.flags & MAP_HEIGHT_NO_HEIGHT))
|
||||
{
|
||||
if (heightHeader.flags & MAP_HEIGHT_AS_INT16)
|
||||
{
|
||||
outFile.write(reinterpret_cast<const char*>(uint16_V9), sizeof(uint16_V9));
|
||||
outFile.write(reinterpret_cast<const char*>(uint16_V8), sizeof(uint16_V8));
|
||||
outFile.write(reinterpret_cast<char const*>(uint16_V9), sizeof(uint16_V9));
|
||||
outFile.write(reinterpret_cast<char const*>(uint16_V8), sizeof(uint16_V8));
|
||||
}
|
||||
else if (heightHeader.flags & MAP_HEIGHT_AS_INT8)
|
||||
{
|
||||
outFile.write(reinterpret_cast<const char*>(uint8_V9), sizeof(uint8_V9));
|
||||
outFile.write(reinterpret_cast<const char*>(uint8_V8), sizeof(uint8_V8));
|
||||
outFile.write(reinterpret_cast<char const*>(uint8_V9), sizeof(uint8_V9));
|
||||
outFile.write(reinterpret_cast<char const*>(uint8_V8), sizeof(uint8_V8));
|
||||
}
|
||||
else
|
||||
{
|
||||
outFile.write(reinterpret_cast<const char*>(V9), sizeof(V9));
|
||||
outFile.write(reinterpret_cast<const char*>(V8), sizeof(V8));
|
||||
outFile.write(reinterpret_cast<char const*>(V9), sizeof(V9));
|
||||
outFile.write(reinterpret_cast<char const*>(V8), sizeof(V8));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -888,24 +887,24 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
||||
// Store liquid data if need
|
||||
if (map.liquidMapOffset)
|
||||
{
|
||||
outFile.write(reinterpret_cast<const char*>(&liquidHeader), sizeof(liquidHeader));
|
||||
outFile.write(reinterpret_cast<char const*>(&liquidHeader), sizeof(liquidHeader));
|
||||
|
||||
if (!(liquidHeader.flags&MAP_LIQUID_NO_TYPE))
|
||||
{
|
||||
outFile.write(reinterpret_cast<const char*>(liquid_entry), sizeof(liquid_entry));
|
||||
outFile.write(reinterpret_cast<const char*>(liquid_flags), sizeof(liquid_flags));
|
||||
outFile.write(reinterpret_cast<char const*>(liquid_entry), sizeof(liquid_entry));
|
||||
outFile.write(reinterpret_cast<char const*>(liquid_flags), sizeof(liquid_flags));
|
||||
}
|
||||
|
||||
if (!(liquidHeader.flags&MAP_LIQUID_NO_HEIGHT))
|
||||
{
|
||||
for (int y = 0; y < liquidHeader.height; y++)
|
||||
outFile.write(reinterpret_cast<const char*>(&liquid_height[y + liquidHeader.offsetY][liquidHeader.offsetX]), sizeof(float) * liquidHeader.width);
|
||||
outFile.write(reinterpret_cast<char const*>(&liquid_height[y + liquidHeader.offsetY][liquidHeader.offsetX]), sizeof(float) * liquidHeader.width);
|
||||
}
|
||||
}
|
||||
|
||||
// store hole data
|
||||
if (hasHoles)
|
||||
outFile.write(reinterpret_cast<const char*>(holes), map.holesSize);
|
||||
outFile.write(reinterpret_cast<char const*>(holes), map.holesSize);
|
||||
|
||||
outFile.close();
|
||||
return true;
|
||||
@@ -1114,8 +1113,7 @@ inline void CloseMPQFiles()
|
||||
|
||||
int main(int argc, char * arg[])
|
||||
{
|
||||
printf("Map & DBC Extractor\n");
|
||||
printf("===================\n\n");
|
||||
Trinity::Banner::Show("Map & DBC Extractor", [](char const* text) { printf("%s\n", text); }, nullptr);
|
||||
|
||||
HandleArgs(argc, arg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user