Core: Append single character to stream as character, not as a string

This commit is contained in:
Spp-
2011-07-29 14:18:28 +02:00
parent 06b46ba203
commit e47b96af3e
70 changed files with 432 additions and 424 deletions
+5 -5
View File
@@ -95,9 +95,9 @@ namespace VMAP
{
std::stringstream tilefilename;
tilefilename.fill('0');
tilefilename << std::setw(3) << mapID << "_";
//tilefilename << std::setw(2) << tileX << "_" << std::setw(2) << tileY << ".vmtile";
tilefilename << std::setw(2) << tileY << "_" << std::setw(2) << tileX << ".vmtile";
tilefilename << std::setw(3) << mapID << '_';
//tilefilename << std::setw(2) << tileX << '_' << std::setw(2) << tileY << ".vmtile";
tilefilename << std::setw(2) << tileY << '_' << std::setw(2) << tileX << ".vmtile";
return tilefilename.str();
}
@@ -129,7 +129,7 @@ namespace VMAP
{
if (iBasePath.length() > 0 && (iBasePath[iBasePath.length()-1] != '/' || iBasePath[iBasePath.length()-1] != '\\'))
{
iBasePath.append("/");
iBasePath.push_back('/');
}
}
@@ -242,7 +242,7 @@ namespace VMAP
{
std::string basePath = vmapPath;
if (basePath.length() > 0 && (basePath[basePath.length()-1] != '/' || basePath[basePath.length()-1] != '\\'))
basePath.append("/");
basePath.push_back('/');
std::string fullname = basePath + VMapManager2::getMapFileName(mapID);
bool success = true;
FILE *rf = fopen(fullname.c_str(), "rb");
+13 -6
View File
@@ -112,7 +112,7 @@ namespace VMAP
// write map tree file
std::stringstream mapfilename;
mapfilename << iDestDir << "/" << std::setfill('0') << std::setw(3) << map_iter->first << ".vmtree";
mapfilename << iDestDir << '/' << std::setfill('0') << std::setw(3) << map_iter->first << ".vmtree";
FILE *mapfile = fopen(mapfilename.str().c_str(), "wb");
if (!mapfile)
{
@@ -153,10 +153,10 @@ namespace VMAP
uint32 nSpawns = tileEntries.count(tile->first);
std::stringstream tilefilename;
tilefilename.fill('0');
tilefilename << iDestDir << "/" << std::setw(3) << map_iter->first << "_";
tilefilename << iDestDir << '/' << std::setw(3) << map_iter->first << '_';
uint32 x, y;
StaticMapTree::unpackTileID(tile->first, x, y);
tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile";
tilefilename << std::setw(2) << x << '_' << std::setw(2) << y << ".vmtile";
FILE *tilefile = fopen(tilefilename.str().c_str(), "wb");
// file header
if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) success = false;
@@ -242,7 +242,10 @@ namespace VMAP
bool TileAssembler::calculateTransformedBound(ModelSpawn &spawn)
{
std::string modelFilename = iSrcDir + "/" + spawn.name;
std::string modelFilename(iSrcDir);
modelFilename.push_back('/');
modelFilename.append(spawn.name);
ModelPosition modelPosition;
modelPosition.iDir = spawn.iRot;
modelPosition.iScale = spawn.iScale;
@@ -358,7 +361,7 @@ namespace VMAP
bool success = true;
std::string filename = iSrcDir;
if (filename.length() >0)
filename.append("/");
filename.push_back('/');
filename.append(pModelFilename);
FILE *rf = fopen(filename.c_str(), "rb");
@@ -496,7 +499,11 @@ namespace VMAP
if (!groupsArray.empty())
{
model.setGroupModels(groupsArray);
success = model.writeFile(iDestDir + "/" + pModelFilename + ".vmo");
std::string filename(iSrcDir);
filename.push_back('/');
filename.append(pModelFilename).append(".vmo");
success = model.writeFile(filename);
}
//std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl;
@@ -49,7 +49,7 @@ namespace VMAP
// std::cout << "Ray crosses bound of '" << name << "'\n";
/* std::cout << "ray from:" << pRay.origin().x << ", " << pRay.origin().y << ", " << pRay.origin().z
<< " dir:" << pRay.direction().x << ", " << pRay.direction().y << ", " << pRay.direction().z
<< " t/tmax:" << time << "/" << pMaxDist;
<< " t/tmax:" << time << '/' << pMaxDist;
std::cout << "\nBound lo:" << iBound.low().x << ", " << iBound.low().y << ", " << iBound.low().z << " hi: "
<< iBound.high().x << ", " << iBound.high().y << ", " << iBound.high().z << std::endl; */
// child bounds are defined in object space: