Tools&Core: Whitespace cleanup
No one likes whitespace, right?
This commit is contained in:
@@ -123,7 +123,7 @@ bool Map::ExistVMap(uint32 mapid, int gx, int gy)
|
||||
void Map::LoadMMap(int gx, int gy)
|
||||
{
|
||||
bool mmapLoadResult = MMAP::MMapFactory::createOrGetMMapManager()->loadMap((sWorld->GetDataPath() + "mmaps").c_str(), GetId(), gx, gy);
|
||||
|
||||
|
||||
if (mmapLoadResult)
|
||||
sLog->outInfo(LOG_FILTER_MAPS, "MMAP loaded name:%s, id:%d, x:%d, y:%d (mmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
|
||||
else
|
||||
|
||||
@@ -428,7 +428,7 @@ void MotionMaster::MoveCharge(PathGenerator path, float speed, uint32 id)
|
||||
Vector3 dest = path.GetActualEndPosition();
|
||||
|
||||
MoveCharge(dest.x, dest.y, dest.z);
|
||||
|
||||
|
||||
Movement::MoveSplineInit init(_owner);
|
||||
init.MovebyPath(path.GetPath());
|
||||
init.SetVelocity(speed);
|
||||
|
||||
@@ -124,7 +124,7 @@ bool TargetedMovementGeneratorMedium<T,D>::Update(T* owner, const uint32& time_d
|
||||
D::_clearUnitStateMove(owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// prevent movement while casting spells with cast time or channel time
|
||||
if (owner->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
|
||||
@@ -469,7 +469,7 @@ void PathGenerator::BuildPointPath(const float *startPoint, const float *endPoin
|
||||
_pathPoints[i] = Vector3(pathPoints[i*VERTEX_SIZE+2], pathPoints[i*VERTEX_SIZE], pathPoints[i*VERTEX_SIZE+1]);
|
||||
|
||||
NormalizePath();
|
||||
|
||||
|
||||
// first point is always our current location - we need the next one
|
||||
SetActualEndPosition(_pathPoints[pointCount-1]);
|
||||
|
||||
@@ -515,7 +515,7 @@ void PathGenerator::BuildShortcut()
|
||||
_pathPoints[1] = GetActualEndPosition();
|
||||
|
||||
NormalizePath();
|
||||
|
||||
|
||||
_type = PATHFIND_SHORTCUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
|
||||
// navmesh poly -> navmesh tile location
|
||||
dtQueryFilter filter = dtQueryFilter();
|
||||
dtPolyRef polyRef = INVALID_POLYREF;
|
||||
dtPolyRef polyRef = INVALID_POLYREF;
|
||||
navmeshquery->findNearestPoly(location, extents, &filter, &polyRef, NULL);
|
||||
|
||||
if (polyRef == INVALID_POLYREF)
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
CellCoord pair(Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY()) );
|
||||
Cell cell(pair);
|
||||
cell.SetNoCreate();
|
||||
|
||||
|
||||
std::list<Creature*> creatureList;
|
||||
|
||||
Trinity::AnyUnitInObjectRangeCheck go_check(object, radius);
|
||||
|
||||
@@ -852,7 +852,7 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
|
||||
hasHoles = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (hasHoles)
|
||||
map.holesSize = sizeof(holes);
|
||||
else
|
||||
|
||||
@@ -18,7 +18,7 @@ ADT::~ADT()
|
||||
{
|
||||
delete ObjectData;
|
||||
delete Data;
|
||||
|
||||
|
||||
for (std::vector<MapChunk*>::iterator itr = MapChunks.begin(); itr != MapChunks.end(); ++itr)
|
||||
delete *itr;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class ADT
|
||||
public:
|
||||
ADT(std::string file);
|
||||
~ADT();
|
||||
|
||||
|
||||
void Read();
|
||||
|
||||
ChunkedData* ObjectData;
|
||||
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
GenericCache() {}
|
||||
|
||||
static const int32 FlushLimit = 1000;
|
||||
|
||||
|
||||
void Insert(K key, T* val)
|
||||
{
|
||||
ACE_GUARD(ACE_Thread_Mutex, g, mutex);
|
||||
@@ -35,10 +35,10 @@ public:
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
for (typename std::map<K, T*>::iterator itr = _items.begin(); itr != _items.end(); ++itr)
|
||||
{
|
||||
for (typename std::map<K, T*>::iterator itr = _items.begin(); itr != _items.end(); ++itr)
|
||||
delete itr->second;
|
||||
_items.clear();
|
||||
_items.clear();
|
||||
}
|
||||
private:
|
||||
std::map<K, T*> _items;
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
void Clear()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
ChunkedData::ChunkedData( FILE* stream, uint32 maxLength, uint32 chunksHint /*= 300*/ ) :
|
||||
ChunkedData::ChunkedData( FILE* stream, uint32 maxLength, uint32 chunksHint /*= 300*/ ) :
|
||||
Stream(stream)
|
||||
{
|
||||
if (!Stream)
|
||||
@@ -66,7 +66,7 @@ ChunkedData::~ChunkedData()
|
||||
{
|
||||
for (std::vector<Chunk*>::iterator itr = Chunks.begin(); itr != Chunks.end(); ++itr)
|
||||
delete *itr;
|
||||
|
||||
|
||||
Chunks.clear();
|
||||
if (Stream)
|
||||
fclose(Stream);
|
||||
|
||||
@@ -63,7 +63,7 @@ void Geometry::AddData( std::vector<Vector3>& verts, std::vector<Triangle<uint32
|
||||
uint32 vertOffset = Vertices.size();
|
||||
for (std::vector<Vector3>::iterator itr = verts.begin(); itr != verts.end(); ++itr)
|
||||
Vertices.push_back(Transform ? Utils::ToRecast(*itr) : *itr);
|
||||
|
||||
|
||||
for (std::vector<Triangle<uint32> >::iterator itr = tris.begin(); itr != tris.end(); ++itr)
|
||||
Triangles.push_back(Triangle<uint32>(itr->Type, itr->V0 + vertOffset, itr->V1 + vertOffset, itr->V2 + vertOffset));
|
||||
}
|
||||
@@ -116,7 +116,7 @@ void Geometry::AddAdt( ADT* adt )
|
||||
|
||||
if (!adt->_DoodadHandler->Triangles.empty())
|
||||
AddData(adt->_DoodadHandler->Vertices, adt->_DoodadHandler->Triangles);
|
||||
|
||||
|
||||
if (!adt->_WorldModelHandler->Triangles.empty())
|
||||
AddData(adt->_WorldModelHandler->Vertices, adt->_WorldModelHandler->Triangles);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class Geometry
|
||||
{
|
||||
public:
|
||||
Geometry();
|
||||
|
||||
|
||||
void CalculateBoundingBox(float*& min, float*& max);
|
||||
void CalculateMinMaxHeight(float& min, float& max);
|
||||
void AddData(std::vector<Vector3>& verts, std::vector<Triangle<uint32> >& tris);
|
||||
|
||||
@@ -20,7 +20,7 @@ void LiquidHandler::HandleNewLiquid()
|
||||
MCNKData.reserve(256);
|
||||
for (int i = 0; i < 256; i++)
|
||||
header[i] = H2OHeader::Read(stream);
|
||||
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
H2OHeader h = header[i];
|
||||
|
||||
@@ -7,9 +7,9 @@ MPQArchive::MPQArchive(const char* filename)
|
||||
{
|
||||
int result = libmpq__archive_open(&mpq_a, filename, -1);
|
||||
printf("Opening %s\n", filename);
|
||||
if (result)
|
||||
if (result)
|
||||
{
|
||||
switch (result)
|
||||
switch (result)
|
||||
{
|
||||
case LIBMPQ_ERROR_OPEN :
|
||||
printf("Error opening archive '%s': Does file really exist?\n", filename);
|
||||
@@ -46,7 +46,7 @@ eof(false), buffer(0), pointer(0), size(0)
|
||||
mpq_archive* mpq_a = (*i)->mpq_a;
|
||||
|
||||
uint32_t filenum;
|
||||
if(libmpq__file_number(mpq_a, filename, &filenum))
|
||||
if(libmpq__file_number(mpq_a, filename, &filenum))
|
||||
continue;
|
||||
libmpq__off_t transferred;
|
||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||
@@ -72,7 +72,7 @@ eof(false), buffer(0), pointer(0), size(0)
|
||||
|
||||
size_t MPQFile::Read(void* dest, size_t bytes)
|
||||
{
|
||||
if (eof)
|
||||
if (eof)
|
||||
return 0;
|
||||
|
||||
size_t rpos = pointer + bytes;
|
||||
@@ -102,7 +102,7 @@ void MPQFile::seekRelative(int offset)
|
||||
|
||||
void MPQFile::close()
|
||||
{
|
||||
if (buffer)
|
||||
if (buffer)
|
||||
delete[] buffer;
|
||||
buffer = 0;
|
||||
eof = true;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "ace/Synch.h"
|
||||
|
||||
char* MPQManager::Files[] = {
|
||||
char* MPQManager::Files[] = {
|
||||
"common.MPQ",
|
||||
"common-2.MPQ",
|
||||
"expansion.MPQ",
|
||||
|
||||
@@ -10,7 +10,7 @@ class MPQManager
|
||||
public:
|
||||
MPQManager() {}
|
||||
~MPQManager() {}
|
||||
|
||||
|
||||
void Initialize();
|
||||
FILE* GetFile(std::string path);
|
||||
DBC* GetDBC(std::string name);
|
||||
|
||||
@@ -10,7 +10,7 @@ class MapChunk
|
||||
{
|
||||
public:
|
||||
MapChunk(ADT* _adt, Chunk* chunk);
|
||||
|
||||
|
||||
void GenerateTriangles();
|
||||
void GenerateVertices(FILE* stream);
|
||||
static bool HasHole(uint32 map, int x, int y);
|
||||
|
||||
@@ -56,7 +56,7 @@ bool HandleArgs(int argc, char** argv, uint32& threads, std::set<uint32>& mapLis
|
||||
return false;
|
||||
std::string maps = std::string(param);
|
||||
Tokens tokens(maps, ',');
|
||||
|
||||
|
||||
for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
|
||||
mapList.insert(atoi(*itr));
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class ObjectDataHandler
|
||||
{
|
||||
public:
|
||||
ObjectDataHandler(ADT* _adt) : Source(_adt) {}
|
||||
|
||||
|
||||
void ProcessMapChunk(MapChunk* chunk);
|
||||
virtual void ProcessInternal(ChunkedData* data) = 0;
|
||||
ADT* Source;
|
||||
|
||||
@@ -15,7 +15,7 @@ TileBuilder::TileBuilder(std::string world, int x, int y, uint32 mapId) : _Geome
|
||||
{
|
||||
// Cell Size = TileSize / TileVoxelSize
|
||||
// 1800 = TileVoxelSize
|
||||
Config.cs = Constants::TileSize / 1800;
|
||||
Config.cs = Constants::TileSize / 1800;
|
||||
// Cell Height
|
||||
Config.ch = 0.3f;
|
||||
// Min Region Area = 6^2
|
||||
@@ -72,7 +72,7 @@ uint8* TileBuilder::Build()
|
||||
// don't load main tile again
|
||||
if (tx == X && ty == Y)
|
||||
continue;
|
||||
|
||||
|
||||
ADT* _adt = new ADT(Utils::GetAdtPath(World, tx, ty));
|
||||
// If this condition is met, it means that this wdt does not contain the ADT
|
||||
if (!_adt->Data->Stream)
|
||||
@@ -104,7 +104,7 @@ uint8* TileBuilder::Build()
|
||||
rcCreateHeightfield(Context, *hf, width, width, bbMin, bbMax, Config.cs, Config.ch);
|
||||
rcClearUnwalkableTriangles(Context, Config.walkableSlopeAngle, vertices, numVerts, triangles, numTris, areas);
|
||||
rcRasterizeTriangles(Context, vertices, numVerts, triangles, areas, numTris, *hf, Config.walkableClimb);
|
||||
|
||||
|
||||
printf("[%02i,%02i] Triangles rasterized!\n", X, Y);
|
||||
|
||||
// Once all geometry is rasterized, we do initial pass of filtering to
|
||||
@@ -113,7 +113,7 @@ uint8* TileBuilder::Build()
|
||||
rcFilterLowHangingWalkableObstacles(Context, Config.walkableClimb, *hf);
|
||||
rcFilterLedgeSpans(Context, Config.walkableHeight, Config.walkableClimb, *hf);
|
||||
rcFilterWalkableLowHeightSpans(Context, Config.walkableHeight, *hf);
|
||||
|
||||
|
||||
printf("[%02i,%02i] Filtering done!\n", X, Y);
|
||||
|
||||
// Compact the heightfield so that it is faster to handle from now on.
|
||||
@@ -132,13 +132,13 @@ uint8* TileBuilder::Build()
|
||||
rcBuildDistanceField(Context, *chf);
|
||||
// Partition the walkable surface into simple regions without holes.
|
||||
rcBuildRegions(Context, *chf, Config.borderSize, Config.minRegionArea, Config.mergeRegionArea);
|
||||
|
||||
|
||||
printf("[%02i,%02i] Regions built!\n", X, Y);
|
||||
|
||||
// Create contours.
|
||||
rcContourSet* cset = rcAllocContourSet();
|
||||
rcBuildContours(Context, *chf, Config.maxSimplificationError, Config.maxEdgeLen, *cset);
|
||||
|
||||
|
||||
// Build polygon navmesh from the contours.
|
||||
rcPolyMesh* pmesh = rcAllocPolyMesh();
|
||||
rcBuildPolyMesh(Context, *cset, Config.maxVertsPerPoly, *pmesh);
|
||||
@@ -217,7 +217,7 @@ uint8* TileBuilder::Build()
|
||||
uint8* navData;
|
||||
printf("[%02i,%02i] Creating the navmesh!\n", X, Y);
|
||||
bool result = dtCreateNavMeshData(¶ms, &navData, &navDataSize);
|
||||
|
||||
|
||||
// Free some memory
|
||||
rcFreePolyMesh(pmesh);
|
||||
rcFreePolyMeshDetail(dmesh);
|
||||
|
||||
@@ -133,7 +133,7 @@ Vector3 Utils::VectorTransform( Vector3 vec, G3D::Matrix4 matrix )
|
||||
|
||||
std::string Utils::GetPathBase( std::string path )
|
||||
{
|
||||
int lastIndex = path.find_last_of(".");
|
||||
int lastIndex = path.find_last_of(".");
|
||||
if (lastIndex != std::string::npos)
|
||||
return path.substr(0, lastIndex);
|
||||
return path;
|
||||
|
||||
@@ -551,8 +551,8 @@ public:
|
||||
static G3D::Matrix4 GetTransformation(IDefinition def);
|
||||
/// They say its better to declare template functions in the header files.
|
||||
template <typename T>
|
||||
static std::string ToString(T val)
|
||||
{
|
||||
static std::string ToString(T val)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << val;
|
||||
return ss.str();
|
||||
|
||||
@@ -17,7 +17,7 @@ void WDT::ReadGlobalModel()
|
||||
Chunk* defChunk = Data->GetChunkByName("MODF");
|
||||
if (!fileChunk || !defChunk)
|
||||
return;
|
||||
|
||||
|
||||
IsGlobalModel = true;
|
||||
ModelDefinition = WorldModelDefinition::Read(defChunk->GetStream());
|
||||
ModelFile = Utils::ReadString(fileChunk->GetStream());
|
||||
|
||||
@@ -103,7 +103,7 @@ void WorldModelHandler::InsertModelGeometry( std::vector<Vector3>& verts, std::v
|
||||
break;
|
||||
instances.push_back(root->DoodadInstances[i]);
|
||||
}
|
||||
|
||||
|
||||
for (std::vector<DoodadInstance>::iterator instance = instances.begin(); instance != instances.end(); ++instance)
|
||||
{
|
||||
Model* model = Cache->ModelCache.Get(instance->File);
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace MMAP
|
||||
void MapBuilder::buildAllMaps(int threads)
|
||||
{
|
||||
std::vector<BuilderThread*> _threads;
|
||||
|
||||
|
||||
for (int i = 0; i < threads; ++i)
|
||||
_threads.push_back(new BuilderThread(this));
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace MMAP
|
||||
minX = 32 - bmax[0] / GRID_SIZE;
|
||||
minY = 32 - bmax[2] / GRID_SIZE;
|
||||
}
|
||||
|
||||
|
||||
void MapBuilder::buildMeshFromFile(char* name)
|
||||
{
|
||||
FILE* file = fopen(name, "rb");
|
||||
@@ -253,7 +253,7 @@ namespace MMAP
|
||||
fread(&mapId, sizeof(int), 1, file);
|
||||
fread(&tileX, sizeof(int), 1, file);
|
||||
fread(&tileY, sizeof(int), 1, file);
|
||||
|
||||
|
||||
dtNavMesh* navMesh = NULL;
|
||||
buildNavMesh(mapId, navMesh);
|
||||
if (!navMesh)
|
||||
@@ -270,7 +270,7 @@ namespace MMAP
|
||||
|
||||
float* verts = new float[verticesCount];
|
||||
int* inds = new int[indicesCount];
|
||||
|
||||
|
||||
fread(verts, sizeof(float), verticesCount, file);
|
||||
fread(inds, sizeof(int), indicesCount, file);
|
||||
|
||||
@@ -648,7 +648,7 @@ namespace MMAP
|
||||
tile.chf = NULL;
|
||||
rcFreeContourSet(tile.cset);
|
||||
tile.cset = NULL;
|
||||
|
||||
|
||||
if (tile.pmesh)
|
||||
{
|
||||
pmmerge[nmerge] = tile.pmesh;
|
||||
|
||||
@@ -779,7 +779,7 @@ namespace MMAP
|
||||
continue;
|
||||
std::pair<int, int> val;
|
||||
val.first = t[i];
|
||||
|
||||
|
||||
index = val.first;
|
||||
val.second = count;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user