aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/shared/vmap/CoordModelMapping.cpp24
-rw-r--r--src/shared/vmap/CoordModelMapping.h8
-rw-r--r--src/shared/vmap/DebugCmdLogger.cpp18
3 files changed, 34 insertions, 16 deletions
diff --git a/src/shared/vmap/CoordModelMapping.cpp b/src/shared/vmap/CoordModelMapping.cpp
index c362101ffb4..728ddd3f323 100644
--- a/src/shared/vmap/CoordModelMapping.cpp
+++ b/src/shared/vmap/CoordModelMapping.cpp
@@ -22,6 +22,12 @@
#include <string.h>
+//#ifdef _DEBUG
+//#define DEB(x) x
+//#else
+#define DEB(x)
+//#endif
+
using namespace G3D;
namespace VMAP
@@ -86,15 +92,15 @@ namespace VMAP
//============================================================
bool CoordModelMapping::readCoordinateMapping(const std::string& pDirectoryFileName)
{
- FILE *f = fopen(pDirectoryFileName.c_str(), "rb");
+DEB( FILE *f = fopen(pDirectoryFileName.c_str(), "rb");)
bool result = false;
char buffer[500+1];
- if(f)
+DEB( if(f))
{
result = true;
CMappingEntry* cMappingEntry;
- while(fgets(buffer, 500, f))
+DEB( while(fgets(buffer, 500, f)))
{
//char namebuffer[500];
char positionbuffer[500];
@@ -115,8 +121,8 @@ namespace VMAP
nameEnd += findPosChar(&buffer[nameEnd], ' ', 1);
buffer[nameEnd] = 0; // terminate the name
- sscanf(buffer, "%d %d", &xpos, &ypos);
- sscanf(&buffer[nameEnd+1], "%s %f %d", positionbuffer, &scale, &noVec);
+DEB( sscanf(buffer, "%d %d", &xpos, &ypos);)
+DEB( sscanf(&buffer[nameEnd+1], "%s %f %d", positionbuffer, &scale, &noVec);)
unsigned int mapId = getMapIdFromFilename(std::string(&buffer[nameStart]));
if(!iMapIds.contains(mapId))
{
@@ -136,12 +142,12 @@ namespace VMAP
addCMappingEntry(cMappingEntry);
}
char namebuffer2[500];
- sprintf(namebuffer2, "%d %s#%s_%f", noVec, &buffer[nameStart], positionbuffer, scale);
+DEB( sprintf(namebuffer2, "%d %s#%s_%f", noVec, &buffer[nameStart], positionbuffer, scale);)
cMappingEntry->addFilename(namebuffer2);
//break;
}
}
- fclose(f);
+DEB( fclose(f);)
}
return result;
}
@@ -165,10 +171,10 @@ namespace VMAP
int noVerc;
int startName = findPosChar(rawNames[pos].c_str(), ' ', 1) + 1;
int endName = (int) rawNames[pos].length();
- sscanf(rawNames[pos].c_str(), "%d", &noVerc);
+DEB( sscanf(rawNames[pos].c_str(), "%d", &noVerc);)
memcpy(namebuffer, &rawNames[pos].c_str()[startName], endName-startName);
namebuffer[endName-startName] = 0;
- sscanf(rawNames[pos].c_str(), "%d", &noVerc);
+DEB( sscanf(rawNames[pos].c_str(), "%d", &noVerc);)
std::string modelPosFileName = std::string(namebuffer);
if(noVerc > MIN_VERTICES_FOR_OWN_CONTAINER_FILE)
{
diff --git a/src/shared/vmap/CoordModelMapping.h b/src/shared/vmap/CoordModelMapping.h
index 7c89f0e8a0f..fc06d646107 100644
--- a/src/shared/vmap/CoordModelMapping.h
+++ b/src/shared/vmap/CoordModelMapping.h
@@ -24,6 +24,12 @@
#include <G3D/Table.h>
#include <G3D/Array.h>
+//#ifdef _DEBUG
+//#define DEB(x) x
+//#else
+#define DEB(x)
+//#endif
+
/**
This Class is a helper Class to convert the raw vector data into BSP-Trees.
We read the directory file of the raw data output and build logical groups.
@@ -77,7 +83,7 @@ namespace VMAP
static const std::string getKeyString(unsigned int pMapId, int pXPos, int pYPos)
{
char b[100];
- sprintf(b,"%03u_%d_%d", pMapId, pXPos, pYPos);
+DEB( sprintf(b,"%03u_%d_%d", pMapId, pXPos, pYPos);)
return(std::string(b));
}
diff --git a/src/shared/vmap/DebugCmdLogger.cpp b/src/shared/vmap/DebugCmdLogger.cpp
index de656f4cfc5..8a518a83b44 100644
--- a/src/shared/vmap/DebugCmdLogger.cpp
+++ b/src/shared/vmap/DebugCmdLogger.cpp
@@ -20,6 +20,12 @@
#include "DebugCmdLogger.h"
+//#ifdef _DEBUG
+//#define DEB(x) x
+//#else
+#define DEB(x)
+//#endif
+
using namespace G3D;
namespace VMAP
@@ -97,25 +103,25 @@ namespace VMAP
bool CommandFileRW::getNewCommands(Array<Command>& pCmdArray)
{
bool result = false;
- FILE* f = fopen(iFileName.c_str(), "rb");
- if(f)
+DEB( FILE* f = fopen(iFileName.c_str(), "rb");)
+DEB( if(f))
{
Command cmd;
- if(fseek(f, iLastPos, SEEK_SET) == 0) { result = true; }
+DEB( if(fseek(f, iLastPos, SEEK_SET) == 0) { result = true; })
while(result)
{
- if(fread(&cmd, sizeof(Command), 1, f) != 1)
+DEB( if(fread(&cmd, sizeof(Command), 1, f) != 1))
{
result = false;
}
- iLastPos = ftell(f);
+DEB( iLastPos = ftell(f);)
if(cmd.getType() == STOP)
{
break;
}
pCmdArray.append(cmd);
}
- fclose(f);
+DEB( fclose(f);)
}
if(result)
{