Change some map/vmap-related runtime output to sLog format.
--HG-- branch : trunk
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "ModelInstance.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapDefinitions.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@@ -56,7 +57,7 @@ namespace VMAP
|
||||
void operator()(const Vector3& point, uint32 entry)
|
||||
{
|
||||
#ifdef VMAP_DEBUG
|
||||
std::cout << "trying to intersect '" << prims[entry].name << "'\n";
|
||||
sLog.outDebug("trying to intersect '%s'", prims[entry].name.c_str());
|
||||
#endif
|
||||
prims[entry].intersectPoint(point, aInfo);
|
||||
}
|
||||
@@ -72,7 +73,7 @@ namespace VMAP
|
||||
void operator()(const Vector3& point, uint32 entry)
|
||||
{
|
||||
#ifdef VMAP_DEBUG
|
||||
std::cout << "trying to intersect '" << prims[entry].name << "'\n";
|
||||
sLog.outDebug("trying to intersect '%s'", prims[entry].name.c_str());
|
||||
#endif
|
||||
if (prims[entry].GetLocationInfo(point, locInfo))
|
||||
result = true;
|
||||
@@ -269,7 +270,7 @@ namespace VMAP
|
||||
|
||||
bool StaticMapTree::InitMap(const std::string &fname, VMapManager2 *vm)
|
||||
{
|
||||
std::cout << "Initializing StaticMapTree '" << fname << "'\n";
|
||||
sLog.outDebug("Initializing StaticMapTree '%s'", fname.c_str());
|
||||
bool success = true;
|
||||
std::string fullname = iBasePath + fname;
|
||||
FILE *rf = fopen(fullname.c_str(), "rb");
|
||||
@@ -297,12 +298,12 @@ namespace VMAP
|
||||
// only non-tiled maps have them, and if so exactly one (so far at least...)
|
||||
ModelSpawn spawn;
|
||||
#ifdef VMAP_DEBUG
|
||||
std::cout << "Map isTiled:" << bool(iIsTiled) << std::endl;
|
||||
sLog.outDebug("Map isTiled: %u", static_cast<uint32>(iIsTiled));
|
||||
#endif
|
||||
if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn))
|
||||
{
|
||||
WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name);
|
||||
std::cout << "StaticMapTree::InitMap(): loading " << spawn.name << std::endl;
|
||||
sLog.outDebug("StaticMapTree::InitMap(): loading %s", spawn.name.c_str());
|
||||
if (model)
|
||||
{
|
||||
// assume that global model always is the first and only tree value (could be improved...)
|
||||
@@ -312,7 +313,7 @@ namespace VMAP
|
||||
else
|
||||
{
|
||||
success = false;
|
||||
std::cout << "error: could not acquire WorldModel pointer!\n";
|
||||
sLog.outError("Could not acquire WorldModel pointer!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +349,7 @@ namespace VMAP
|
||||
}
|
||||
if (!iTreeValues)
|
||||
{
|
||||
std::cout << "Tree has not been initialized!\n";
|
||||
sLog.outError("Tree has not been initialized! [%u,%u]", tileX, tileY);
|
||||
return false;
|
||||
}
|
||||
bool result = true;
|
||||
@@ -369,7 +370,8 @@ namespace VMAP
|
||||
{
|
||||
// acquire model instance
|
||||
WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name);
|
||||
if (!model) std::cout << "error: could not acquire WorldModel pointer!\n";
|
||||
if (!model)
|
||||
sLog.outError("error: could not acquire WorldModel pointer! [%u,%u]", tileX, tileY);
|
||||
|
||||
// update tree
|
||||
uint32 referencedVal;
|
||||
@@ -380,7 +382,7 @@ namespace VMAP
|
||||
#ifdef VMAP_DEBUG
|
||||
if (referencedVal > iNTreeValues)
|
||||
{
|
||||
std::cout << "invalid tree element! (" << referencedVal << "/" << iNTreeValues << ")\n";
|
||||
sLog.outDebug("invalid tree element! (%u/%u)", referencedVal, iNTreeValues);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@@ -391,8 +393,10 @@ namespace VMAP
|
||||
{
|
||||
++iLoadedSpawns[referencedVal];
|
||||
#ifdef VMAP_DEBUG
|
||||
if (iTreeValues[referencedVal].ID != spawn.ID) std::cout << "error: trying to load wrong spawn in node!\n";
|
||||
else if (iTreeValues[referencedVal].name != spawn.name) std::cout << "error: name collision on GUID="<< spawn.ID << "\n";
|
||||
if (iTreeValues[referencedVal].ID != spawn.ID)
|
||||
sLog.outDebug("error: trying to load wrong spawn in node!");
|
||||
else if (iTreeValues[referencedVal].name != spawn.name)
|
||||
sLog.outDebug("error: name collision on GUID=%u", spawn.ID);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -413,7 +417,7 @@ namespace VMAP
|
||||
loadedTileMap::iterator tile = iLoadedTiles.find(tileID);
|
||||
if (tile == iLoadedTiles.end())
|
||||
{
|
||||
std::cout << "WARNING: trying to unload non-loaded tile. Map:" << iMapID << " X:" << tileX << " Y:" << tileY << std::endl;
|
||||
sLog.outError("WARNING: trying to unload non-loaded tile. Map:%u X:%u Y:%u", iMapID, tileX, tileY);
|
||||
return;
|
||||
}
|
||||
if (tile->second) // file associated with tile
|
||||
@@ -442,7 +446,7 @@ namespace VMAP
|
||||
fread(&referencedNode, sizeof(uint32), 1, tf);
|
||||
if (!iLoadedSpawns.count(referencedNode))
|
||||
{
|
||||
std::cout << "error! trying to unload non-referenced model '" << spawn.name << "' (ID:" << spawn.ID << ")\n";
|
||||
sLog.outError("Trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
|
||||
}
|
||||
else if (--iLoadedSpawns[referencedNode] == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user