Apply style fix

This commit is contained in:
Antz 2020-01-10 23:13:44 +00:00
parent 5531a0087d
commit 35405dd549
155 changed files with 10968 additions and 3660 deletions

View file

@ -62,15 +62,25 @@ namespace MMAP
} while (false)
if (heightfield)
{ DEBUG_WRITE("hf", heightfield); }
{
DEBUG_WRITE("hf", heightfield);
}
if (compactHeightfield)
{ DEBUG_WRITE("chf", compactHeightfield); }
{
DEBUG_WRITE("chf", compactHeightfield);
}
if (contours)
{ DEBUG_WRITE("cs", contours); }
{
DEBUG_WRITE("cs", contours);
}
if (polyMesh)
{ DEBUG_WRITE("pmesh", polyMesh); }
{
DEBUG_WRITE("pmesh", polyMesh);
}
if (polyMeshDetail)
{ DEBUG_WRITE("dmesh", polyMeshDetail); }
{
DEBUG_WRITE("dmesh", polyMeshDetail);
}
#undef DEBUG_WRITE
}
@ -78,7 +88,9 @@ namespace MMAP
void IntermediateValues::debugWrite(FILE* file, const rcHeightfield* mesh)
{
if (!file || !mesh)
{ return; }
{
return;
}
fwrite(&(mesh->cs), sizeof(float), 1, file);
fwrite(&(mesh->ch), sizeof(float), 1, file);
@ -116,7 +128,9 @@ namespace MMAP
void IntermediateValues::debugWrite(FILE* file, const rcCompactHeightfield* chf)
{
if (!file | !chf)
{ return; }
{
return;
}
fwrite(&(chf->width), sizeof(chf->width), 1, file);
fwrite(&(chf->height), sizeof(chf->height), 1, file);
@ -143,19 +157,29 @@ namespace MMAP
fwrite(&tmp, sizeof(tmp), 1, file);
if (chf->cells)
{ fwrite(chf->cells, sizeof(rcCompactCell), chf->width * chf->height, file); }
{
fwrite(chf->cells, sizeof(rcCompactCell), chf->width * chf->height, file);
}
if (chf->spans)
{ fwrite(chf->spans, sizeof(rcCompactSpan), chf->spanCount, file); }
{
fwrite(chf->spans, sizeof(rcCompactSpan), chf->spanCount, file);
}
if (chf->dist)
{ fwrite(chf->dist, sizeof(unsigned short), chf->spanCount, file); }
{
fwrite(chf->dist, sizeof(unsigned short), chf->spanCount, file);
}
if (chf->areas)
{ fwrite(chf->areas, sizeof(unsigned char), chf->spanCount, file); }
{
fwrite(chf->areas, sizeof(unsigned char), chf->spanCount, file);
}
}
void IntermediateValues::debugWrite(FILE* file, const rcContourSet* cs)
{
if (!file || !cs)
{ return; }
{
return;
}
fwrite(&(cs->cs), sizeof(float), 1, file);
fwrite(&(cs->ch), sizeof(float), 1, file);
@ -176,7 +200,9 @@ namespace MMAP
void IntermediateValues::debugWrite(FILE* file, const rcPolyMesh* mesh)
{
if (!file || !mesh)
{ return; }
{
return;
}
fwrite(&(mesh->cs), sizeof(float), 1, file);
fwrite(&(mesh->ch), sizeof(float), 1, file);
@ -195,7 +221,9 @@ namespace MMAP
void IntermediateValues::debugWrite(FILE* file, const rcPolyMeshDetail* mesh)
{
if (!file || !mesh)
{ return; }
{
return;
}
fwrite(&(mesh->nverts), sizeof(int), 1, file);
fwrite(mesh->verts, sizeof(float), mesh->nverts * 3, file);

View file

@ -55,7 +55,9 @@ namespace MMAP
inline bool matchWildcardFilter(const char* filter, const char* str)
{
if (!filter || !str)
{ return false; }
{
return false;
}
// end on null character
while (*filter && *str)
@ -63,12 +65,16 @@ namespace MMAP
if (*filter == '*')
{
if (*++filter == '\0') // wildcard at end of filter means all remaing chars match
{ return true; }
{
return true;
}
while (true)
{
if (*filter == *str)
{ break; }
{
break;
}
if (*str == '\0')
{ return false; } // reached end of string without matching next filter character
str++;
@ -115,12 +121,16 @@ namespace MMAP
hFind = FindFirstFile(directory.c_str(), &findFileInfo);
if (hFind == INVALID_HANDLE_VALUE)
{ return LISTFILE_DIRECTORY_NOT_FOUND; }
{
return LISTFILE_DIRECTORY_NOT_FOUND;
}
do
{
if (includeSubDirs || (findFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
{ fileList.push_back(string(findFileInfo.cFileName)); }
{
fileList.push_back(string(findFileInfo.cFileName));
}
}
while (FindNextFile(hFind, &findFileInfo));
@ -137,14 +147,18 @@ namespace MMAP
if ((dp = readdir(dirp)) != NULL)
{
if (matchWildcardFilter(filter.c_str(), dp->d_name))
{ fileList.push_back(string(dp->d_name)); }
{
fileList.push_back(string(dp->d_name));
}
}
else
{ break; }
}
if (dirp)
{ closedir(dirp); }
{
closedir(dirp);
}
else
{ return LISTFILE_DIRECTORY_NOT_FOUND; }
#endif

View file

@ -127,7 +127,9 @@ namespace MMAP
tileID = StaticMapTree::packTileID(tileX, tileY);
if (tiles->insert(tileID).second)
{ count++; }
{
count++;
}
}
}
printf(" found %u.\n\n", count);
@ -138,7 +140,9 @@ namespace MMAP
{
TileList::iterator itr = m_tiles.find(mapID);
if (itr != m_tiles.end())
{ return (*itr).second; }
{
return (*itr).second;
}
set<uint32>* tiles = new set<uint32>();
m_tiles.insert(pair<uint32, set<uint32>*>(mapID, tiles));
@ -152,7 +156,9 @@ namespace MMAP
{
uint32 mapID = (*it).first;
if (!shouldSkipMap(mapID))
{ buildMap(mapID); }
{
buildMap(mapID);
}
}
}
@ -192,7 +198,9 @@ namespace MMAP
}
if (!tiles->size())
{ return; }
{
return;
}
// build navMesh
dtNavMesh* navMesh = NULL;
@ -213,7 +221,9 @@ namespace MMAP
StaticMapTree::unpackTileID((*it), tileX, tileY);
if (shouldSkipTile(mapID, tileX, tileY))
{ continue; }
{
continue;
}
buildTile(mapID, tileX, tileY, navMesh);
}
@ -237,7 +247,9 @@ namespace MMAP
// if there is no data, give up now
if (!meshData.solidVerts.size() && !meshData.liquidVerts.size())
{ return; }
{
return;
}
// remove unused vertices
TerrainBuilder::cleanVertices(meshData.solidVerts, meshData.solidTris);
@ -249,7 +261,9 @@ namespace MMAP
allVerts.append(meshData.solidVerts);
if (!allVerts.size())
{ return; }
{
return;
}
// get bounds of current tile
float bmin[3], bmax[3];
@ -278,11 +292,15 @@ namespace MMAP
// make sure we process maps which don't have tiles
// initialize the static tree, which loads WDT models
if (!m_terrainBuilder->loadVMap(mapID, 64, 64, meshData))
{ return; }
{
return;
}
// get the coord bounds of the model data
if (meshData.solidVerts.size() + meshData.liquidVerts.size() == 0)
{ return; }
{
return;
}
// get the coord bounds of the model data
if (meshData.solidVerts.size() && meshData.liquidVerts.size())
@ -329,12 +347,16 @@ namespace MMAP
StaticMapTree::unpackTileID((*it), tileX, tileY);
if (tileX > tileXMax)
{ tileXMax = tileX; }
{
tileXMax = tileX;
}
else if (tileX < tileXMin)
{ tileXMin = tileX; }
if (tileY > tileYMax)
{ tileYMax = tileY; }
{
tileYMax = tileY;
}
else if (tileY < tileYMin)
{ tileYMin = tileY; }
}
@ -616,7 +638,9 @@ namespace MMAP
// TODO: special flags for DYNAMIC polygons, ie surfaces that can be turned on and off
for (int i = 0; i < iv.polyMesh->npolys; ++i)
if (iv.polyMesh->areas[i] & RC_WALKABLE_AREA)
{ iv.polyMesh->flags[i] = iv.polyMesh->areas[i]; }
{
iv.polyMesh->flags[i] = iv.polyMesh->areas[i];
}
// setup mesh parameters
dtNavMeshCreateParams params;
@ -759,7 +783,9 @@ namespace MMAP
{
// this is for elevation
if (verts && vertCount)
{ rcCalcBounds(verts, vertCount, bmin, bmax); }
{
rcCalcBounds(verts, vertCount, bmin, bmax);
}
else
{
bmin[1] = FLT_MIN;
@ -805,7 +831,9 @@ namespace MMAP
return true;
default:
if (isTransportMap(mapID))
{ return true; }
{
return true;
}
break;
}
@ -897,17 +925,23 @@ namespace MMAP
sprintf(fileName, "mmaps/%03u%02i%02i.mmtile", mapID, tileY, tileX);
FILE* file = fopen(fileName, "rb");
if (!file)
{ return false; }
{
return false;
}
MmapTileHeader header;
size_t file_read = fread(&header, sizeof(MmapTileHeader), 1, file);
fclose(file);
if (header.mmapMagic != MMAP_MAGIC || header.dtVersion != DT_NAVMESH_VERSION || file_read <= 0)
{ return false; }
{
return false;
}
if (header.mmapVersion != MMAP_VERSION)
{ return false; }
{
return false;
}
return true;
}

View file

@ -90,7 +90,9 @@ namespace MMAP
FILE* mapFile = fopen(mapFileName, "rb");
if (!mapFile)
{ return false; }
{
return false;
}
GridMapFileHeader fheader;
fread(&fheader, sizeof(GridMapFileHeader), 1, mapFile);
@ -297,7 +299,9 @@ namespace MMAP
int* ttris = ttriangles.getCArray();
if (ltriangles.size() + ttriangles.size() == 0)
{ return false; }
{
return false;
}
// make a copy of liquid vertices
// used to pad right-bottom frame due to lost vertex data at extraction
@ -320,7 +324,9 @@ namespace MMAP
// if there is no liquid, don't use liquid
if (!liquid_type || !meshData.liquidVerts.size() || !ltriangles.size())
{ useLiquid = false; }
{
useLiquid = false;
}
else
{
liquidType = getLiquidType(i, liquid_type);
@ -350,7 +356,9 @@ namespace MMAP
// if there is no terrain, don't use terrain
if (!ttriangles.size())
{ useTerrain = false; }
{
useTerrain = false;
}
// while extracting ADT data we are losing right-bottom vertices
// this code adds fair approximation of lost data
@ -376,18 +384,24 @@ namespace MMAP
{
float h = lverts[ltris[idx] * 3 + 1];
if (h == INVALID_MAP_LIQ_HEIGHT || h > INVALID_MAP_LIQ_HEIGHT_MAX)
{ lverts[ltris[idx] * 3 + 1] = quadHeight; }
{
lverts[ltris[idx] * 3 + 1] = quadHeight;
}
}
}
// no valid vertexes - don't use this poly at all
if (validCount == 0)
{ useLiquid = false; }
{
useLiquid = false;
}
}
// if there is a hole here, don't use the terrain
if (useTerrain)
{ useTerrain = !isHole(i, holes); }
{
useTerrain = !isHole(i, holes);
}
// we use only one terrain kind per quad - pick higher one
if (useTerrain && useLiquid)
@ -398,10 +412,14 @@ namespace MMAP
{
float h = lverts[ltris[x] * 3 + 1];
if (minLLevel > h)
{ minLLevel = h; }
{
minLLevel = h;
}
if (maxLLevel < h)
{ maxLLevel = h; }
{
maxLLevel = h;
}
}
float maxTLevel = INVALID_MAP_LIQ_HEIGHT;
@ -410,19 +428,27 @@ namespace MMAP
{
float h = tverts[ttris[x] * 3 + 1];
if (maxTLevel < h)
{ maxTLevel = h; }
{
maxTLevel = h;
}
if (minTLevel > h)
{ minTLevel = h; }
{
minTLevel = h;
}
}
// terrain under the liquid?
if (minLLevel > maxTLevel)
{ useTerrain = false; }
{
useTerrain = false;
}
//liquid under the terrain?
if (minTLevel > maxLLevel)
{ useLiquid = false; }
{
useLiquid = false;
}
}
// store the result
@ -444,7 +470,9 @@ namespace MMAP
}
if (lverts_copy)
{ delete [] lverts_copy; }
{
delete [] lverts_copy;
}
return meshData.solidTris.size() || meshData.liquidTris.size();
}
@ -566,20 +594,26 @@ namespace MMAP
do
{
if (result == VMAP_LOAD_RESULT_ERROR)
{ break; }
{
break;
}
InstanceTreeMap instanceTrees;
((VMapManager2*)vmapManager)->getInstanceMapTree(instanceTrees);
if (!instanceTrees[mapID])
{ break; }
{
break;
}
ModelInstance* models = NULL;
uint32 count = 0;
instanceTrees[mapID]->getModelInstances(models, count);
if (!models)
{ break; }
{
break;
}
for (uint32 i = 0; i < count; ++i)
{
@ -588,7 +622,9 @@ namespace MMAP
// model instances exist in tree even though there are instances of that model in this tile
WorldModel* worldModel = instance.getWorldModel();
if (!worldModel)
{ continue; }
{
continue;
}
// now we have a model to add to the meshdata
retval = true;
@ -779,7 +815,9 @@ namespace MMAP
for (int i = 0; i < tris.size(); ++i)
{
if (vertMap.find(t[i]) != vertMap.end())
{ continue; }
{
continue;
}
vertMap.insert(std::pair<int, int>(t[i], 0));
}
@ -803,7 +841,9 @@ namespace MMAP
{
map<int, int>::iterator it;
if ((it = vertMap.find(t[i])) == vertMap.end())
{ continue; }
{
continue;
}
t[i] = (*it).second;
}
@ -816,7 +856,9 @@ namespace MMAP
{
// no meshfile input given?
if (offMeshFilePath == NULL)
{ return; }
{
return;
}
FILE* fp = fopen(offMeshFilePath, "rb");
if (!fp)

View file

@ -106,11 +106,15 @@ bool handleArgs(int argc, char** argv,
{
param = argv[++i];
if (!param)
{ return false; }
{
return false;
}
float maxangle = atof(param);
if (maxangle <= 90.f && maxangle >= 45.f)
{ maxAngle = maxangle; }
{
maxAngle = maxangle;
}
else
{ printf("invalid option for '--maxAngle', using default\n"); }
}
@ -118,7 +122,9 @@ bool handleArgs(int argc, char** argv,
{
param = argv[++i];
if (!param)
{ return false; }
{
return false;
}
char* stileX = strtok(param, ",");
char* stileY = strtok(NULL, ",");
@ -126,9 +132,13 @@ bool handleArgs(int argc, char** argv,
int tiley = atoi(stileY);
if ((tilex > 0 && tilex < 64) || (tilex == 0 && strcmp(stileX, "0") == 0))
{ tileX = tilex; }
{
tileX = tilex;
}
if ((tiley > 0 && tiley < 64) || (tiley == 0 && strcmp(stileY, "0") == 0))
{ tileY = tiley; }
{
tileY = tiley;
}
if (tileX < 0 || tileY < 0)
{
@ -140,10 +150,14 @@ bool handleArgs(int argc, char** argv,
{
param = argv[++i];
if (!param)
{ return false; }
{
return false;
}
if (strcmp(param, "true") == 0)
{ skipLiquid = true; }
{
skipLiquid = true;
}
else if (strcmp(param, "false") == 0)
{ skipLiquid = false; }
else
@ -153,10 +167,14 @@ bool handleArgs(int argc, char** argv,
{
param = argv[++i];
if (!param)
{ return false; }
{
return false;
}
if (strcmp(param, "true") == 0)
{ skipContinents = true; }
{
skipContinents = true;
}
else if (strcmp(param, "false") == 0)
{ skipContinents = false; }
else
@ -166,10 +184,14 @@ bool handleArgs(int argc, char** argv,
{
param = argv[++i];
if (!param)
{ return false; }
{
return false;
}
if (strcmp(param, "true") == 0)
{ skipJunkMaps = true; }
{
skipJunkMaps = true;
}
else if (strcmp(param, "false") == 0)
{ skipJunkMaps = false; }
else
@ -179,10 +201,14 @@ bool handleArgs(int argc, char** argv,
{
param = argv[++i];
if (!param)
{ return false; }
{
return false;
}
if (strcmp(param, "true") == 0)
{ skipBattlegrounds = true; }
{
skipBattlegrounds = true;
}
else if (strcmp(param, "false") == 0)
{ skipBattlegrounds = false; }
else
@ -192,10 +218,14 @@ bool handleArgs(int argc, char** argv,
{
param = argv[++i];
if (!param)
{ return false; }
{
return false;
}
if (strcmp(param, "true") == 0)
{ debugOutput = true; }
{
debugOutput = true;
}
else if (strcmp(param, "false") == 0)
{ debugOutput = false; }
else
@ -209,10 +239,14 @@ bool handleArgs(int argc, char** argv,
{
param = argv[++i];
if (!param)
{ return false; }
{
return false;
}
if (strcmp(param, "true") == 0)
{ bigBaseUnit = true; }
{
bigBaseUnit = true;
}
else if (strcmp(param, "false") == 0)
{ bigBaseUnit = false; }
else
@ -222,7 +256,9 @@ bool handleArgs(int argc, char** argv,
{
param = argv[++i];
if (!param)
{ return false; }
{
return false;
}
offMeshInputPath = param;
}
@ -235,7 +271,9 @@ bool handleArgs(int argc, char** argv,
{
int map = atoi(argv[i]);
if (map > 0 || (map == 0 && (strcmp(argv[i], "0") == 0)))
{ mapnum = map; }
{
mapnum = map;
}
else
{
printf("invalid map id\n");
@ -279,23 +317,31 @@ int main(int argc, char** argv)
if (mapnum == -1 && debugOutput)
{
if (silent)
{ return -2; }
{
return -2;
}
printf(" You have specifed debug output, but didn't specify a map to generate.\n");
printf(" This will generate debug output for ALL maps.\n");
printf(" Are you sure you want to continue? (y/n) ");
if (getchar() != 'y')
{ return 0; }
{
return 0;
}
}
if (!checkDirectories(debugOutput))
{ return silent ? -3 : finish(" Press any key to close...", -3); }
{
return silent ? -3 : finish(" Press any key to close...", -3);
}
MapBuilder builder(maxAngle, skipLiquid, skipContinents, skipJunkMaps,
skipBattlegrounds, debugOutput, bigBaseUnit, offMeshInputPath);
if (tileX > -1 && tileY > -1 && mapnum >= 0)
{ builder.buildSingleTile(mapnum, tileX, tileY); }
{
builder.buildSingleTile(mapnum, tileX, tileY);
}
else if (mapnum >= 0)
builder.buildMap(uint32(mapnum));
else

View file

@ -599,7 +599,9 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
{
adt_MCNK* cell = adt.cells[i][j];
if (!cell)
{ continue; }
{
continue;
}
// Height values for triangles stored in order:
// 1 2 3 4 5 6 7 8 9
// 10 11 12 13 14 15 16 17
@ -638,7 +640,9 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
// Get custom height
adt_MCVT* v = cell->getMCVT();
if (!v)
{ continue; }
{
continue;
}
// get V9 height map
for (int y = 0; y <= ADT_CELL_SIZE; y++)
{
@ -691,15 +695,23 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
for (int y = 0; y < ADT_GRID_SIZE; y++)
for (int x = 0; x < ADT_GRID_SIZE; x++)
if (V8[y][x] < CONF_use_minHeight)
{ V8[y][x] = CONF_use_minHeight; }
{
V8[y][x] = CONF_use_minHeight;
}
for (int y = 0; y <= ADT_GRID_SIZE; y++)
for (int x = 0; x <= ADT_GRID_SIZE; x++)
if (V9[y][x] < CONF_use_minHeight)
{ V9[y][x] = CONF_use_minHeight; }
{
V9[y][x] = CONF_use_minHeight;
}
if (minHeight < CONF_use_minHeight)
{ minHeight = CONF_use_minHeight; }
{
minHeight = CONF_use_minHeight;
}
if (maxHeight < CONF_use_minHeight)
{ maxHeight = CONF_use_minHeight; }
{
maxHeight = CONF_use_minHeight;
}
}
map.heightMapOffset = map.areaMapOffset + map.areaMapSize;
@ -712,11 +724,15 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
heightHeader.gridMaxHeight = maxHeight;
if (maxHeight == minHeight)
{ heightHeader.flags |= MAP_HEIGHT_NO_HEIGHT; }
{
heightHeader.flags |= MAP_HEIGHT_NO_HEIGHT;
}
// Not need store if flat surface
if (CONF_allow_float_to_int && (maxHeight - minHeight) < CONF_flat_height_delta_limit)
{ heightHeader.flags |= MAP_HEIGHT_NO_HEIGHT; }
{
heightHeader.flags |= MAP_HEIGHT_NO_HEIGHT;
}
// Try store as packed in uint16 or uint8 values
if (!(heightHeader.flags & MAP_HEIGHT_NO_HEIGHT))
@ -770,12 +786,16 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
{
adt_MCNK* cell = adt.cells[i][j];
if (!cell)
{ continue; }
{
continue;
}
adt_MCLQ* liquid = cell->getMCLQ();
int count = 0;
if (!liquid || cell->sizeMCLQ <= 8)
{ continue; }
{
continue;
}
for (int y = 0; y < ADT_CELL_SIZE; y++)
{
@ -787,7 +807,9 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
{
liquid_show[cy][cx] = true;
if (liquid->flags[y][x] & (1 << 7))
{ liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER; }
{
liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER;
}
++count;
}
}
@ -811,7 +833,9 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
}
if (!count && liquid_flags[i][j])
{ fprintf(stderr, "Wrong liquid type detected in MCLQ chunk"); }
{
fprintf(stderr, "Wrong liquid type detected in MCLQ chunk");
}
for (int y = 0; y <= ADT_CELL_SIZE; y++)
{
@ -835,7 +859,9 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
{
adt_liquid_header* h = h2o->getLiquidData(i, j);
if (!h)
{ continue; }
{
continue;
}
int count = 0;
uint64 show = h2o->getLiquidShowMap(h);
@ -870,11 +896,15 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
{
uint8* lm = h2o->getLiquidLightMap(h);
if (!lm)
{ liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER; }
{
liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER;
}
}
if (!count && liquid_flags[i][j])
{ printf("Wrong liquid type detected in MH2O chunk"); }
{
printf("Wrong liquid type detected in MH2O chunk");
}
float* height = h2o->getLiquidHeightMap(h);
int pos = 0;
@ -885,7 +915,9 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
{
int cx = j * ADT_CELL_SIZE + x + h->xOffset;
if (height)
{ liquid_height[cy][cx] = height[pos]; }
{
liquid_height[cy][cx] = height[pos];
}
else
{ liquid_height[cy][cx] = h->heightLevel1; }
pos++;
@ -957,29 +989,41 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
liquidHeader.liquidLevel = minHeight;
if (maxHeight == minHeight)
{ liquidHeader.flags |= MAP_LIQUID_NO_HEIGHT; }
{
liquidHeader.flags |= MAP_LIQUID_NO_HEIGHT;
}
// Not need store if flat surface
if (CONF_allow_float_to_int && (maxHeight - minHeight) < CONF_flat_liquid_delta_limit)
{ liquidHeader.flags |= MAP_LIQUID_NO_HEIGHT; }
{
liquidHeader.flags |= MAP_LIQUID_NO_HEIGHT;
}
if (!fullType)
{ liquidHeader.flags |= MAP_LIQUID_NO_TYPE; }
{
liquidHeader.flags |= MAP_LIQUID_NO_TYPE;
}
if (liquidHeader.flags & MAP_LIQUID_NO_TYPE)
{ liquidHeader.liquidType = type; }
{
liquidHeader.liquidType = type;
}
else
{ map.liquidMapSize += sizeof(liquid_entry) + sizeof(liquid_flags); }
if (!(liquidHeader.flags & MAP_LIQUID_NO_HEIGHT))
{ map.liquidMapSize += sizeof(float) * liquidHeader.width * liquidHeader.height; }
{
map.liquidMapSize += sizeof(float) * liquidHeader.width * liquidHeader.height;
}
}
// map hole info
uint16 holes[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
if (map.liquidMapOffset)
{ map.holesOffset = map.liquidMapOffset + map.liquidMapSize; }
{
map.holesOffset = map.liquidMapOffset + map.liquidMapSize;
}
else
{ map.holesOffset = map.heightMapOffset + map.heightMapSize; }
@ -992,7 +1036,9 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
{
adt_MCNK* cell = adt.cells[i][j];
if (!cell)
{ continue; }
{
continue;
}
holes[i][j] = cell->holes;
}
}
@ -1008,7 +1054,9 @@ bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32
// Store area data
fwrite(&areaHeader, sizeof(areaHeader), 1, output);
if (!(areaHeader.flags & MAP_AREA_NO_AREA))
{ fwrite(area_flags, sizeof(area_flags), 1, output); }
{
fwrite(area_flags, sizeof(area_flags), 1, output);
}
// Store height data
fwrite(&heightHeader, sizeof(heightHeader), 1, output);
@ -1091,7 +1139,9 @@ void ExtractMapsFromMpq(uint32 build, const int locale)
for (uint32 x = 0; x < WDT_MAP_SIZE; ++x)
{
if (!wdt.main->adt_list[y][x].exist)
{ continue; }
{
continue;
}
sprintf(mpq_filename, "World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
sprintf(output_filename, "%s/maps/%03u%02u%02u.map", output_path, map_ids[z].id, y, x);
ConvertADT(mpq_filename, output_filename, y, x, build);
@ -1145,7 +1195,9 @@ void ExtractDBCFiles(int locale, bool basicLocale)
filename += (iter->c_str() + strlen("DBFilesClient\\"));
if (ExtractFile(iter->c_str(), filename))
{ ++count; }
{
++count;
}
}
printf("Extracted %u DBC/DB2 files\n\n", count);
}

View file

@ -133,7 +133,9 @@ size_t DBCFile::getMaxId()
for (size_t i = 0; i < getRecordCount(); ++i)
{
if (maxId < getRecord(i).getUInt(0))
{ maxId = getRecord(i).getUInt(0); }
{
maxId = getRecord(i).getUInt(0);
}
}
return maxId;
}

View file

@ -176,7 +176,9 @@ ModelInstance::ModelInstance(MPQFile& f, const char* ModelInstName, uint32 mapID
fclose(input);
if (nVertices == 0)
{ return; }
{
return;
}
uint16 adtId = 0;// not used for models
uint32 flags = MOD_M2;

View file

@ -668,7 +668,9 @@ int main(int argc, char** argv)
// Use command line arguments, when some
if (!processArgv(argc, argv))
{ return 1; }
{
return 1;
}
// some simple check if working dir is dirty
else

View file

@ -133,7 +133,9 @@ WDTFile::~WDTFile(void)
ADTFile* WDTFile::GetMap(int x, int z)
{
if (!(x >= 0 && z >= 0 && x < 64 && z < 64))
{ return NULL; }
{
return NULL;
}
char name[512];

View file

@ -395,7 +395,9 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool pPrecis
fwrite(VERT, 4, 3, output);
for (uint32 i = 0; i < nVertices; ++i)
if (IndexRenum[i] >= 0)
{ check -= fwrite(MOVT + 3 * i, sizeof(float), 3, output); }
{
check -= fwrite(MOVT + 3 * i, sizeof(float), 3, output);
}
assert(check == 0);
@ -412,7 +414,9 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool pPrecis
// according to WoW.Dev Wiki:
uint32 liquidEntry;
if (rootWMO->liquidType & 4)
{ liquidEntry = liquidType; }
{
liquidEntry = liquidType;
}
else if (liquidType == 15)
{ liquidEntry = 0; }
else
@ -431,11 +435,15 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool pPrecis
{
++v2;
if (v2 >= v1)
{ break; }
{
break;
}
}
if (v2 < v1 && (LiquBytes[v2] & 0xF) != 15)
{ liquidEntry = (LiquBytes[v2] & 0xF) + 1; }
{
liquidEntry = (LiquBytes[v2] & 0xF) + 1;
}
}
}
@ -533,7 +541,9 @@ WMOInstance::WMOInstance(MPQFile& f, const char* WmoInstName, uint32 mapID, uint
fclose(input);
if (nVertices == 0)
{ return; }
{
return;
}
float x, z;
x = pos.x;