Changed: #825 Remove all warning when compiling Ryzom

This commit is contained in:
kervala 2010-08-09 16:20:03 +02:00
parent 67ebdb938a
commit c693c47cac
39 changed files with 220 additions and 138 deletions

View file

@ -52,6 +52,13 @@ public:
LongFormat : 1, // true if the message format is long (d'ho ? all message are long !?!, always true) LongFormat : 1, // true if the message format is long (d'ho ? all message are long !?!, always true)
MessageType : 2; // type of the message (from TMessageType), classical message are 'OneWay' MessageType : 2; // type of the message (from TMessageType), classical message are 'OneWay'
TFormat()
{
StringMode = 0;
LongFormat = 0;
MessageType = 0;
}
void serial(NLMISC::IStream &s) void serial(NLMISC::IStream &s)
{ {
if (s.isReading()) if (s.isReading())

View file

@ -486,6 +486,7 @@ void CLightingManager::computeModelLightContributions(NLMISC::CRGBA sunAmbient,
v= NLMISC::OptFastFloor(mergedAmbient.R); fastClamp8(v); amb.R= v; v= NLMISC::OptFastFloor(mergedAmbient.R); fastClamp8(v); amb.R= v;
v= NLMISC::OptFastFloor(mergedAmbient.G); fastClamp8(v); amb.G= v; v= NLMISC::OptFastFloor(mergedAmbient.G); fastClamp8(v); amb.G= v;
v= NLMISC::OptFastFloor(mergedAmbient.B); fastClamp8(v); amb.B= v; v= NLMISC::OptFastFloor(mergedAmbient.B); fastClamp8(v); amb.B= v;
amb.R = 255;
lightContrib.MergedPointLight= amb; lightContrib.MergedPointLight= amb;
// Indicate we use the merged pointLight => the model must recompute lighting each frame // Indicate we use the merged pointLight => the model must recompute lighting each frame

View file

@ -136,7 +136,7 @@ float CMRMBuilder::getDeltaFaceNormals(sint numvertex)
// return a positive value of Somme(|DeltaNormals|) / NNormals. // return a positive value of Somme(|DeltaNormals|) / NNormals.
CMRMVertex &vert= TmpVertices[numvertex]; CMRMVertex &vert= TmpVertices[numvertex];
float delta=0; float delta=0;
CVector refNormal; CVector refNormal(0.f, 0.f, 0.f);
sint nfaces=(sint)vert.SharedFaces.size(); sint nfaces=(sint)vert.SharedFaces.size();
for(sint i=0;i<nfaces;i++) for(sint i=0;i<nfaces;i++)
{ {
@ -448,7 +448,7 @@ CMesh::CSkinWeight CMRMBuilder::collapseSkinWeight(const CMesh::CSkinWeight &sw1
sort(sws.begin(), sws.end()); sort(sws.begin(), sws.end());
// clamp the result to the wanted max matrix. // clamp the result to the wanted max matrix.
uint nbMatsOut; uint nbMatsOut = 0;
switch(_SkinReduction) switch(_SkinReduction)
{ {
case CMRMParameters::SkinReductionMin: case CMRMParameters::SkinReductionMin:

View file

@ -657,7 +657,7 @@ void CPackedZone32::build(std::vector<const CTessFace*> &leaves,
{ {
CMatrix instanceMatrix; CMatrix instanceMatrix;
igs[k]->getInstanceMatrix(l, instanceMatrix); igs[k]->getInstanceMatrix(l, instanceMatrix);
if (NLMISC::strlwr(NLMISC::CFile::getExtension(igs[k]->getShapeName(l))) == "pacs_prim") continue; if (NLMISC::toLower(NLMISC::CFile::getExtension(igs[k]->getShapeName(l))) == "pacs_prim") continue;
std::string stdShapeName = standardizeShapeName(igs[k]->getShapeName(l)); std::string stdShapeName = standardizeShapeName(igs[k]->getShapeName(l));
TShapeCache::const_iterator it = shapeCache.find(stdShapeName); TShapeCache::const_iterator it = shapeCache.find(stdShapeName);
if (it != shapeCache.end()) if (it != shapeCache.end())

View file

@ -226,7 +226,7 @@ void CShapeInfo::build(const CMeshBase &meshBase, const CMeshMRMGeom &meshGeom)
// *************************************************************************** // ***************************************************************************
std::string standardizeShapeName(const std::string &name) std::string standardizeShapeName(const std::string &name)
{ {
std::string result = NLMISC::strlwr(name); std::string result = NLMISC::toLower(name);
if (CFile::getExtension(result).empty()) if (CFile::getExtension(result).empty())
{ {
result += ".shape"; result += ".shape";

View file

@ -558,25 +558,25 @@ void CBufFIFO::display ()
{ {
if (_Rewinder != NULL && _Rewinder >= pos && _Rewinder < pos + gran) if (_Rewinder != NULL && _Rewinder >= pos && _Rewinder < pos + gran)
{ {
strncat (str, "*", 1024); strncat (str, "*", 1);
} }
else else
{ {
strncat (str, "@", 1024); strncat (str, "@", 1);
} }
} }
else else
{ {
strncat (str, "T", 1024); strncat (str, "T", 1);
} }
} }
else if (_Head >= pos && _Head < pos + gran) else if (_Head >= pos && _Head < pos + gran)
{ {
strncat (str, "H", 1024); strncat (str, "H", 1);
} }
else if (_Rewinder != NULL && _Rewinder >= pos && _Rewinder < pos + gran) else if (_Rewinder != NULL && _Rewinder >= pos && _Rewinder < pos + gran)
{ {
strncat (str, "R", 1024); strncat (str, "R", 1);
} }
else else
{ {
@ -595,12 +595,12 @@ void CBufFIFO::display ()
for (; i < s; i+= gran) for (; i < s; i+= gran)
{ {
strncat (str, " ", 1024); strncat (str, " ", 1);
} }
#ifdef NL_DEBUG #ifdef NL_DEBUG
strncat (str, "\n", 1024); strncat (str, "\n", 1);
#else #else
strncat (str, "\r", 1024); strncat (str, "\r", 1);
#endif #endif
DebugLog->display (str); DebugLog->display (str);
} }

View file

@ -440,7 +440,7 @@ void cbInvalidEntityNamesFilename(const std::string &invalidEntityNamesFilename)
for(;;) for(;;)
{ {
char str[512]; char str[512];
if (fgets(str, 511, fp) == NULL) if (!fgets(str, 511, fp))
break; break;
if(feof(fp)) if(feof(fp))
break; break;

View file

@ -1523,13 +1523,13 @@ void CFileContainer::removeBigFiles(const std::vector<std::string> &bnpFilenames
TFiles::iterator fileIt, fileCurrIt; TFiles::iterator fileIt, fileCurrIt;
for (uint k = 0; k < bnpFilenames.size(); ++k) for (uint k = 0; k < bnpFilenames.size(); ++k)
{ {
std::string completeBNPName = strlwr(bnpFilenames[k]) + "@"; std::string completeBNPName = toLower(bnpFilenames[k]) + "@";
if (SSMpath.isAdded(completeBNPName)) if (SSMpath.isAdded(completeBNPName))
{ {
bnpStrIds.insert(SSMpath.add(completeBNPName)); bnpStrIds.insert(SSMpath.add(completeBNPName));
} }
CBigFile::getInstance().remove(bnpFilenames[k]); CBigFile::getInstance().remove(bnpFilenames[k]);
fileIt = _Files.find(strlwr(bnpFilenames[k])); fileIt = _Files.find(toLower(bnpFilenames[k]));
if (fileIt != _Files.end()) if (fileIt != _Files.end())
{ {
_Files.erase(fileIt); _Files.erase(fileIt);

View file

@ -26,6 +26,7 @@
# include <windows.h> # include <windows.h>
#elif defined NL_OS_UNIX #elif defined NL_OS_UNIX
# include <unistd.h> # include <unistd.h>
# include <cerrno>
# include <sys/types.h> # include <sys/types.h>
# include <sys/time.h> # include <sys/time.h>
#endif #endif
@ -125,7 +126,10 @@ void CListenTask::init( uint16 port, sint32 maxExpectedBlockSize )
CServerTask::CServerTask() : NbLoop (0), _ExitRequired(false) CServerTask::CServerTask() : NbLoop (0), _ExitRequired(false)
{ {
#ifdef NL_OS_UNIX #ifdef NL_OS_UNIX
pipe( _WakeUpPipeHandle ); if (pipe( _WakeUpPipeHandle ) == -1)
{
nlwarning("LNETL1: pipe() failed: code=%d '%s'", errno, strerror(errno));
}
#endif #endif
} }
@ -981,7 +985,10 @@ void CServerReceiveTask::run()
#if defined NL_OS_UNIX #if defined NL_OS_UNIX
// POLL7 // POLL7
nice( 2 ); // is this really useful as long as select() sleeps? if (nice( 2 ) == -1) // is this really useful as long as select() sleeps?
{
nlwarning("LNETL1: nice() failed: code=%d '%s'", errno, strerror(errno));
}
#endif // NL_OS_UNIX #endif // NL_OS_UNIX
// Copy of _Connections // Copy of _Connections

View file

@ -79,7 +79,11 @@ namespace NLNET
// get the next command from the command line // get the next command from the command line
char theCommand[1024] = ""; char theCommand[1024] = "";
fgets(theCommand, sizeofarray(theCommand), stdin); if (!fgets(theCommand, sizeofarray(theCommand), stdin))
{
nlwarning("fgets failed");
break;
}
// push the command to allow reader thread to deal with it // push the command to allow reader thread to deal with it
pushCommand(theCommand); pushCommand(theCommand);

View file

@ -208,6 +208,9 @@ public:
_Retriever = retriever; _Retriever = retriever;
_Chain = uint16(chain); _Chain = uint16(chain);
_OChainIndex = 0; _OChainIndex = 0;
_IndexInOChain = 0;
_MaxIndexInOChain = 0;
_OChainForward = 0;
setupIndex(); setupIndex();
} }

View file

@ -87,7 +87,7 @@ static ov_callbacks OV_CALLBACKS_NLMISC_STREAM = {
}; };
CMusicBufferVorbis::CMusicBufferVorbis(NLMISC::IStream *stream, bool loop) CMusicBufferVorbis::CMusicBufferVorbis(NLMISC::IStream *stream, bool loop)
: _Stream(stream), _Loop(loop), _StreamSize(0), _IsMusicEnded(false) : _Stream(stream), _Loop(loop), _IsMusicEnded(false)
{ {
_StreamOffset = stream->getPos(); _StreamOffset = stream->getPos();
stream->seek(0, NLMISC::IStream::end); stream->seek(0, NLMISC::IStream::end);

View file

@ -212,10 +212,8 @@ int main(int argc, char *argv[])
for(j=0;j<LodFilters.size();j++) for(j=0;j<LodFilters.size();j++)
{ {
// Make the test case-unsensitive // Make the test case-unsensitive
string lwrFileName= fileNameIn; string lwrFileName= toLower(fileNameIn);
string lwrFilter= LodFilters[j]; string lwrFilter= toLower(LodFilters[j]);
strlwr(lwrFileName);
strlwr(lwrFilter);
if( testWildCard(lwrFileName.c_str(), lwrFilter.c_str()) ) if( testWildCard(lwrFileName.c_str(), lwrFilter.c_str()) )
{ {
string clodFile= clod_dir_in+"/"+LodNames[j]+".clod"; string clodFile= clod_dir_in+"/"+LodNames[j]+".clod";

View file

@ -426,16 +426,18 @@ int main(int nNbArg, char **ppArgs)
while (!iFile.eof()) while (!iFile.eof())
{ {
iFile.getline (bufTmp, 256); iFile.getline (bufTmp, 256);
sscanf (bufTmp, "%s %f %f %f %f", tgaName, &uvMinU, &uvMinV, &uvMaxU, &uvMaxV); if (sscanf (bufTmp, "%s %f %f %f %f", tgaName, &uvMinU, &uvMinV, &uvMaxU, &uvMaxV) != 5)
{
nlwarning("Can't parse %s", bufTmp);
continue;
}
sTGAname = tgaName; sTGAname = toLower(string(tgaName));
sTGAname = strlwr(sTGAname);
string findTGAName; string findTGAName;
for (i = 0; i < mapSize; ++i) for (i = 0; i < mapSize; ++i)
{ {
// get the string whitout path // get the string whitout path
findTGAName = CFile::getFilename(AllMapNames[i]); findTGAName = toLower(CFile::getFilename(AllMapNames[i]));
findTGAName = strlwr(findTGAName);
if( findTGAName == sTGAname ) if( findTGAName == sTGAname )
break; break;
} }

View file

@ -109,22 +109,24 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
FILE *f = fopen (ScriptName,"rb"); FILE *f = fopen (ScriptName,"rb");
fseek (f, 0, SEEK_END); fseek (f, 0, SEEK_END);
int file_size = ftell (f); sint file_size = ftell (f);
fseek (f, 0, SEEK_SET); fseek (f, 0, SEEK_SET);
char *file_buf = (char*)malloc(file_size+1); char *file_buf = (char*)malloc(file_size+1);
fread (file_buf, 1, file_size, f); if (fread (file_buf, 1, file_size, f) != file_size)
nlwarning("Can't read %d elements", file_size);
file_buf[file_size] = 0; file_buf[file_size] = 0;
++file_size; ++file_size;
fclose (f); fclose (f);
char *buf_ptr = file_buf; char *buf_ptr = file_buf;
int nLastNbPlus = 0; sint nLastNbPlus = 0;
vector<CInstanceGroup*> pile; vector<CInstanceGroup*> pile;
pile.clear (); pile.clear ();
do do
{ {
char Line[256], *line_ptr; char Line[256], *line_ptr;
int nNbPlus = 0; sint nNbPlus = 0;
line_ptr = &Line[0]; line_ptr = &Line[0];
buf_ptr = readLine (line_ptr, buf_ptr); buf_ptr = readLine (line_ptr, buf_ptr);

View file

@ -298,8 +298,7 @@ void statRyzomBug(const char *dirSrc)
} }
else if(str.compare(0, nel3dIdTok.size(), nel3dIdTok)==0) else if(str.compare(0, nel3dIdTok.size(), nel3dIdTok)==0)
{ {
string tmp= str; string tmp= toLower(str);
strlwr(tmp);
if(tmp.find("opengl")!=string::npos) if(tmp.find("opengl")!=string::npos)
precNel3DMode= 0; precNel3DMode= 0;
else if(tmp.find("direct3d")!=string::npos) else if(tmp.find("direct3d")!=string::npos)

View file

@ -66,8 +66,8 @@ int main(int argc, char **argv)
printf("---------\n"); printf("---------\n");
// IGSurfaceLight info. // IGSurfaceLight info.
const CIGSurfaceLight::TRetrieverGridMap &rgm= ig.getIGSurfaceLight().getRetrieverGridMap(); const CIGSurfaceLight::TRetrieverGridMap &rgm= ig.getIGSurfaceLight().getRetrieverGridMap();
printf("IGSurfaceLighting: CellSize: %f. NumGridRetriever: %d\n", printf("IGSurfaceLighting: CellSize: %f. NumGridRetriever: %u\n",
ig.getIGSurfaceLight().getCellSize(), rgm.size() ); ig.getIGSurfaceLight().getCellSize(), (uint)rgm.size() );
uint rgmInst= 0; uint rgmInst= 0;
uint totalCells= 0; uint totalCells= 0;
CIGSurfaceLight::TRetrieverGridMap::const_iterator it= rgm.begin(); CIGSurfaceLight::TRetrieverGridMap::const_iterator it= rgm.begin();
@ -85,6 +85,6 @@ int main(int argc, char **argv)
} }
catch (std::exception &e) catch (std::exception &e)
{ {
printf(e.what()); printf("%s\n", e.what());
} }
} }

View file

@ -83,8 +83,7 @@ public:
for (i=(uint)strlen(msg); i<79; i++) for (i=(uint)strlen(msg); i<79; i++)
msg[i]=' '; msg[i]=' ';
msg[i]=0; msg[i]=0;
printf (msg); printf ("%s\r", msg);
printf ("\r");
} }
protected: protected:

View file

@ -413,7 +413,7 @@ int main(int nNbArg, char **ppArgs)
CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT); CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT);
if (pTF != NULL) if (pTF != NULL)
{ {
string sTexName = NLMISC::strlwr(pTF->getFileName()); string sTexName = NLMISC::toLower(pTF->getFileName());
if(pTF->getUploadFormat()==ITexture::Luminance) if(pTF->getUploadFormat()==ITexture::Luminance)
setLM8Bit.insert(sTexName); setLM8Bit.insert(sTexName);
} }
@ -462,7 +462,7 @@ int main(int nNbArg, char **ppArgs)
tmpLMs.clear(); tmpLMs.clear();
for (i = 0; i < (sint32)AllLightmapNames.size(); ++i) for (i = 0; i < (sint32)AllLightmapNames.size(); ++i)
{ {
bool lm8Bit= setLM8Bit.find( NLMISC::strlwr(AllLightmapNames[i]) ) !=setLM8Bit.end(); bool lm8Bit= setLM8Bit.find( NLMISC::toLower(AllLightmapNames[i]) ) !=setLM8Bit.end();
// if same mode // if same mode
if( lm8Bit == (lmc8bitMode==1) ) if( lm8Bit == (lmc8bitMode==1) )
{ {
@ -756,13 +756,13 @@ int main(int nNbArg, char **ppArgs)
CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT); CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT);
if (pTF != NULL) if (pTF != NULL)
{ {
string sTexName = NLMISC::strlwr(getBaseName(pTF->getFileName())); string sTexName = NLMISC::toLower(getBaseName(pTF->getFileName()));
string sTexNameMoved = NLMISC::strlwr(getBaseName(AllLightmapNames[i])); string sTexNameMoved = NLMISC::toLower(getBaseName(AllLightmapNames[i]));
if (sTexName == sTexNameMoved) if (sTexName == sTexNameMoved)
{ {
// We must remap the name and indicate to remap uvs // We must remap the name and indicate to remap uvs
bMustRemapUV = true; bMustRemapUV = true;
//string sNewTexName = NLMISC::strlwr(getBaseName(AllLightmapNames[j])); //string sNewTexName = NLMISC::toLower(getBaseName(AllLightmapNames[j]));
//sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga"; //sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga";
//pTF->setFileName (sNewTexName); //pTF->setFileName (sNewTexName);
} }
@ -823,11 +823,11 @@ int main(int nNbArg, char **ppArgs)
CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT); CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT);
if (pTF != NULL) if (pTF != NULL)
{ {
string sTexName = NLMISC::strlwr(getBaseName(pTF->getFileName())); string sTexName = NLMISC::toLower(getBaseName(pTF->getFileName()));
string sTexNameMoved = NLMISC::strlwr(getBaseName(AllLightmapNames[i])); string sTexNameMoved = NLMISC::toLower(getBaseName(AllLightmapNames[i]));
if (sTexName == sTexNameMoved) if (sTexName == sTexNameMoved)
{ {
string sNewTexName = NLMISC::strlwr(getBaseName(AllLightmapNames[j])); string sNewTexName = NLMISC::toLower(getBaseName(AllLightmapNames[j]));
sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga"; sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga";
pTF->setFileName (sNewTexName); pTF->setFileName (sNewTexName);
} }

View file

@ -3703,7 +3703,7 @@ void CObjectViewer::shootScene()
string extension = NLMISC::CFile::getExtension ((const char*)fileDlg.GetPathName ()); string extension = NLMISC::CFile::getExtension ((const char*)fileDlg.GetPathName ());
// The file name without extension // The file name without extension
bool jpeg = strlwr (extension) == "jpg"; bool jpeg = toLower (extension) == "jpg";
// Activate the driver // Activate the driver
CNELU::Driver->activate (); CNELU::Driver->activate ();

View file

@ -454,7 +454,7 @@ void CSnapshotToolDlg::OnGo()
CString wildCard; CString wildCard;
m_Filters.GetText(l, wildCard); m_Filters.GetText(l, wildCard);
wildCard.MakeLower(); wildCard.MakeLower();
if (testWildCard(strlwr(NLMISC::CFile::getFilename(files[k]).c_str()), (LPCTSTR) wildCard)) if (testWildCard(toLower(NLMISC::CFile::getFilename(files[k])).c_str(), (LPCTSTR) wildCard))
{ {
_FilteredFiles.push_back(files[k]); _FilteredFiles.push_back(files[k]);
break; break;

View file

@ -1220,7 +1220,7 @@ void VertexPaintData::SynchVerts(Mesh &m)
} }
else else
assert(0); nlassert(0);
} }
} }
} }
@ -1293,7 +1293,7 @@ void VertexPaintRestore::Restore(int isUndo)
{ {
if(isUndo) if(isUndo)
{ {
assert(pPaintData->colordata); nlassert(pPaintData->colordata);
redoColordata = pPaintData->colordata; redoColordata = pPaintData->colordata;
redonumcolors = pPaintData->numColors; redonumcolors = pPaintData->numColors;
@ -1310,7 +1310,7 @@ void VertexPaintRestore::Restore(int isUndo)
void VertexPaintRestore::Redo() void VertexPaintRestore::Redo()
{ {
assert(pPaintData->colordata); nlassert(pPaintData->colordata);
colordata = pPaintData->colordata; colordata = pPaintData->colordata;
numcolors = pPaintData->numColors; numcolors = pPaintData->numColors;

View file

@ -877,7 +877,8 @@ bool ShapesExporter::createThumbnail(const string &filename, const string &path)
if(fp) if(fp)
{ {
char str[100]; char str[100];
fgets(str, 100, fp); if (!fgets(str, 100, fp))
strcpy(str, "0");
fclose(fp); fclose(fp);
selectedFrame = atoi(str)/2; selectedFrame = atoi(str)/2;
} }

View file

@ -82,8 +82,7 @@ void progress (const char *message, float progress)
for (i=(uint)strlen(msg); i<79; i++) for (i=(uint)strlen(msg); i<79; i++)
msg[i]=' '; msg[i]=' ';
msg[i]=0; msg[i]=0;
printf (msg); printf ("%s\r", msg);
printf ("\r");
} }
class CZoneDependencies class CZoneDependencies
@ -523,7 +522,7 @@ int main (int argc, char* argv[])
// Write the dependencies file // Write the dependencies file
FILE *outputFile; FILE *outputFile;
if ((outputFile=fopen (strlwr (outputFileName).c_str(), "w"))) if ((outputFile=fopen (toLower (outputFileName).c_str(), "w")))
{ {
// Add a dependency entry // Add a dependency entry
fprintf (outputFile, "dependencies =\n{\n"); fprintf (outputFile, "dependencies =\n{\n");
@ -538,7 +537,7 @@ int main (int argc, char* argv[])
// Write it // Write it
string message="\t\""+zoneName+"\""; string message="\t\""+zoneName+"\"";
fprintf (outputFile, strlwr (message).c_str()); fprintf (outputFile, "%s", toLower (message).c_str());
// Next ite; // Next ite;
ite++; ite++;
@ -705,7 +704,7 @@ static void computeIGBBox(const NL3D::CInstanceGroup &ig, CLightingBBox &result,
static void computeZoneIGBBox(const char *zoneName, CLightingBBox &result, TShapeMap &shapeMap, const TString2LightingBBox &additionnalIG) static void computeZoneIGBBox(const char *zoneName, CLightingBBox &result, TShapeMap &shapeMap, const TString2LightingBBox &additionnalIG)
{ {
result = CLightingBBox(); // starts with a void box result = CLightingBBox(); // starts with a void box
std::string lcZoneName = NLMISC::strlwr(std::string(zoneName)); std::string lcZoneName = NLMISC::toLower(std::string(zoneName));
TString2LightingBBox::const_iterator zoneIt = additionnalIG.find(lcZoneName); TString2LightingBBox::const_iterator zoneIt = additionnalIG.find(lcZoneName);
if (zoneIt != additionnalIG.end()) if (zoneIt != additionnalIG.end())
{ {
@ -895,7 +894,7 @@ static void computeIGBBoxFromContinent(NLMISC::CConfigFile &parameter,
nlwarning("Couldn't get zone name of village %d in continent %s", continentName.c_str(), k); nlwarning("Couldn't get zone name of village %d in continent %s", continentName.c_str(), k);
continue; continue;
} }
zoneName = NLMISC::strlwr(CFile::getFilenameWithoutExtension(zoneName)); zoneName = NLMISC::toLower(CFile::getFilenameWithoutExtension(zoneName));
CLightingBBox result; CLightingBBox result;
// ok, it is in the dependant zones // ok, it is in the dependant zones
computeBBoxFromVillage(currVillage, continentName, k, shapeMap, result); computeBBoxFromVillage(currVillage, continentName, k, shapeMap, result);

View file

@ -75,11 +75,10 @@ class CMyIgZoneLighter : public CInstanceLighter
pgId= min(pgId, (uint)(BAR_LENGTH-1)); pgId= min(pgId, (uint)(BAR_LENGTH-1));
sprintf (msg, "\r%s: %s", message, progressbar[pgId]); sprintf (msg, "\r%s: %s", message, progressbar[pgId]);
uint i; uint i;
for (i=strlen(msg); i<79; i++) for (i=(uint)strlen(msg); i<79; i++)
msg[i]=' '; msg[i]=' ';
msg[i]=0; msg[i]=0;
printf (msg); printf ("%s\r", msg);
printf ("\r");
} }
}; };
@ -114,7 +113,7 @@ int main(int argc, char* argv[])
if (inputFile.open (argv[1])) if (inputFile.open (argv[1]))
{ {
// Zone name // Zone name
string zoneName=strlwr (string ("zone_"+getName (argv[1]))); string zoneName=toLower (string ("zone_"+getName (argv[1])));
// Load the zone // Load the zone
try try

View file

@ -85,8 +85,7 @@ class CMyZoneLighter : public CZoneLighter
for (i=strlen(msg); i<79; i++) for (i=strlen(msg); i<79; i++)
msg[i]=' '; msg[i]=' ';
msg[i]=0; msg[i]=0;
printf (msg); printf ("%s\r", msg);
printf ("\r");
} }
}; };
@ -138,7 +137,7 @@ static void loadIGFromVillage(const NLGEORGES::UFormElm *villageItem, const std:
// verify that the ig is not already added (case of tr_water.ig in additional_igs) // verify that the ig is not already added (case of tr_water.ig in additional_igs)
for(uint igAdd= 0;igAdd<(uint)additionalIgNames.size();igAdd++) for(uint igAdd= 0;igAdd<(uint)additionalIgNames.size();igAdd++)
{ {
if( strlwr(additionalIgNames.asString()) == strlwr(igName) ) if( toLower(additionalIgNames.asString()) == toLower(igName) )
{ {
nlwarning("Skipping Village Ig %s, cause already exist in additional ig", igName.c_str()); nlwarning("Skipping Village Ig %s, cause already exist in additional ig", igName.c_str());
continue; continue;
@ -313,7 +312,7 @@ int main(int argc, char* argv[])
if (inputFile.open (argv[1])) if (inputFile.open (argv[1]))
{ {
// Zone name // Zone name
string zoneName=strlwr (string ("zone_"+getName (argv[1]))); string zoneName=toLower (string ("zone_"+getName (argv[1])));
// Load the zone // Load the zone
try try
@ -701,7 +700,7 @@ int main(int argc, char* argv[])
continue; continue;
// PS ? // PS ?
if (strlwr (CFile::getExtension (name)) == "ps") if (toLower (CFile::getExtension (name)) == "ps")
continue; continue;
// Add a .shape at the end ? // Add a .shape at the end ?

View file

@ -346,7 +346,7 @@ void weldZones(const char *center)
} }
} }
fprintf(fdbg,"(before) zone %d bordervertices size : %d\n",i,adjZoneBorderVertices.size()); fprintf(fdbg,"(before) zone %u bordervertices size : %u\n",i,(uint)adjZoneBorderVertices.size());
// delete border vertices of the adjacent zone if their neighbour zoneId // delete border vertices of the adjacent zone if their neighbour zoneId
// is equal to current zone zoneId // is equal to current zone zoneId
@ -360,7 +360,7 @@ void weldZones(const char *center)
else else
itborder++; itborder++;
} }
fprintf(fdbg,"(after) zone %d bordervertices size : %d\n",i,adjZoneBorderVertices.size()); fprintf(fdbg,"(after) zone %u bordervertices size : %u\n",i,(uint)adjZoneBorderVertices.size());
// A set for storing base vertex index already added in the quad tree // A set for storing base vertex index already added in the quad tree
std::set<uint16> adjBaseVertexIndexSet; std::set<uint16> adjBaseVertexIndexSet;

View file

@ -447,13 +447,10 @@ void displayZones()
} }
catch(Exception &e) catch(Exception &e)
{ {
printf(e.what ()); printf("%s\n", e.what ());
} }
} }
// Load instance group. // Load instance group.
CNELU::clearBuffers(CRGBA(0,0,0)); CNELU::clearBuffers(CRGBA(0,0,0));
ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Loading objects..."); ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Loading objects...");
@ -472,7 +469,7 @@ void displayZones()
} }
catch(Exception &e) catch(Exception &e)
{ {
printf(e.what ()); printf("%s\n", e.what ());
} }
} }

View file

@ -401,6 +401,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_exporter", "3d\shape
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "georges2csv", "georges\georges2csv\georges2csv.vcproj", "{885542B1-BE3C-401A-A2A4-DA49E48DF0AB}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "georges2csv", "georges\georges2csv\georges2csv.vcproj", "{885542B1-BE3C-401A-A2A4-DA49E48DF0AB}"
ProjectSection(ProjectDependencies) = postProject
{44B21233-EFCC-4825-B5E5-3A3BD6CC5516} = {44B21233-EFCC-4825-B5E5-3A3BD6CC5516}
{9D284C6B-BE12-4549-87E5-2337D64F31BE} = {9D284C6B-BE12-4549-87E5-2337D64F31BE}
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View file

@ -44,13 +44,14 @@
#include "nel/georges/u_form_loader.h" #include "nel/georges/u_form_loader.h"
#include "nel/georges/load_form.h" #include "nel/georges/load_form.h"
// Georges, bypassing interface // Georges, bypassing interface
#include "georges/stdgeorges.h" #include "../../../src/georges/stdgeorges.h"
#include "georges/form.h" #include "../../../src/georges/form.h"
// Basic C++ // Basic C++
#include <iostream> #include <iostream>
//#include <conio.h> //#include <conio.h>
#include <stdio.h> #include <stdio.h>
#include <limits>
//#include <io.h> //#include <io.h>
// stl // stl
@ -695,14 +696,18 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
return; return;
} }
if (!fgets(lineBuffer, BUFFER_SIZE, s))
{
nlwarning("fgets() failed");
return;
}
loadSheetPath(); loadSheetPath();
UFormLoader *formLoader = UFormLoader::createLoader (); UFormLoader *formLoader = UFormLoader::createLoader ();
NLMISC::CSmartPtr<CForm> form; NLMISC::CSmartPtr<CForm> form;
NLMISC::CSmartPtr<UFormDfn> formDfn; NLMISC::CSmartPtr<UFormDfn> formDfn;
fgets(lineBuffer, BUFFER_SIZE, s);
explode(std::string(lineBuffer), std::string(SEPARATOR), fields); explode(std::string(lineBuffer), std::string(SEPARATOR), fields);
vector<bool> activeFields( fields.size(), true ); vector<bool> activeFields( fields.size(), true );
@ -728,7 +733,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
} }
else if ( nlstricmp( fields[i], "parent" ) == 0 ) else if ( nlstricmp( fields[i], "parent" ) == 0 )
{ {
strlwr( fields[i] ); // non-const version fields[i] = toLower( fields[i] );
} }
else else
{ {
@ -748,7 +753,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
} }
string addExtension = "." + sheetType; string addExtension = "." + sheetType;
uint dirmapLetterIndex = ~0; uint dirmapLetterIndex = std::numeric_limits<uint>::max();
bool dirmapLetterBackward = false; bool dirmapLetterBackward = false;
vector<string> dirmapDirs; vector<string> dirmapDirs;
string dirmapSheetCode; string dirmapSheetCode;
@ -812,7 +817,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
nlinfo( "Sheet code: %s", dirmapSheetCode.c_str() ); nlinfo( "Sheet code: %s", dirmapSheetCode.c_str() );
if ( ! dirmapLetterBackward ) if ( ! dirmapLetterBackward )
dirmapLetterIndex += dirmapSheetCode.size(); dirmapLetterIndex += (uint)dirmapSheetCode.size();
CConfigFile::CVar *wep = dirmapcfg.getVarPtr( "WriteEmptyProperties" ); CConfigFile::CVar *wep = dirmapcfg.getVarPtr( "WriteEmptyProperties" );
if ( wep ) if ( wep )
@ -849,7 +854,12 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
while (!feof(s)) while (!feof(s))
{ {
lineBuffer[0] = '\0'; lineBuffer[0] = '\0';
fgets(lineBuffer, BUFFER_SIZE, s); if (!fgets(lineBuffer, BUFFER_SIZE, s))
{
nlwarning("fgets() failed");
break;
}
explode(std::string(lineBuffer), std::string(SEPARATOR), args); explode(std::string(lineBuffer), std::string(SEPARATOR), args);
if (args.size() < 1) if (args.size() < 1)
@ -868,7 +878,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
{ {
filebase += "." + sheetType; filebase += "." + sheetType;
} }
strlwr (filebase); filebase = toLower(filebase);
string filename, dirbase; string filename, dirbase;
bool isNewSheet=true; bool isNewSheet=true;
@ -890,7 +900,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
else else
{ {
// Load template sheet // Load template sheet
filename = strlwr( static_cast<const string&>(filebase) ); filename = toLower(filebase);
form = (CForm*)formLoader->loadForm( (string("_empty.") + sheetType).c_str() ); form = (CForm*)formLoader->loadForm( (string("_empty.") + sheetType).c_str() );
if (form == NULL) if (form == NULL)
{ {
@ -898,14 +908,14 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
} }
// Deduce directory from sheet name // Deduce directory from sheet name
if ( dirmapLetterIndex != ~0 ) if ( dirmapLetterIndex != std::numeric_limits<uint>::max() )
{ {
if ( dirmapLetterIndex < filebase.size() ) if ( dirmapLetterIndex < filebase.size() )
{ {
uint letterIndex; uint letterIndex;
char c; char c;
if ( dirmapLetterBackward ) if ( dirmapLetterBackward )
letterIndex = filebase.size() - 1 - (CFile::getExtension( filebase ).size()+1) - dirmapLetterIndex; letterIndex = (uint)(filebase.size() - 1 - (CFile::getExtension( filebase ).size()+1)) - dirmapLetterIndex;
else else
letterIndex = dirmapLetterIndex; letterIndex = dirmapLetterIndex;
c = tolower( filebase[letterIndex] ); c = tolower( filebase[letterIndex] );

View file

@ -39,7 +39,7 @@ bool keepFile (const char *fileName)
uint i; uint i;
bool ifPresent = false; bool ifPresent = false;
bool ifTrue = false; bool ifTrue = false;
string file = strlwr(CFile::getFilename (fileName)); string file = toLower(CFile::getFilename (fileName));
for (i=0; i<WildCards.size(); i++) for (i=0; i<WildCards.size(); i++)
{ {
if (WildCards[i].Not) if (WildCards[i].Not)
@ -252,7 +252,7 @@ uint readOptions (int nNbArg, char **ppArgs)
if ((strcmp (ppArgs[i], "-if") == 0) && ((i+1)<(uint)nNbArg)) if ((strcmp (ppArgs[i], "-if") == 0) && ((i+1)<(uint)nNbArg))
{ {
CWildCard card; CWildCard card;
card.Expression = strlwr(string(ppArgs[i+1])); card.Expression = toLower(string(ppArgs[i+1]));
card.Not = false; card.Not = false;
WildCards.push_back (card); WildCards.push_back (card);
optionCount += 2; optionCount += 2;
@ -261,7 +261,7 @@ uint readOptions (int nNbArg, char **ppArgs)
if ((strcmp (ppArgs[i], "-ifnot") == 0) && ((i+1)<(uint)nNbArg)) if ((strcmp (ppArgs[i], "-ifnot") == 0) && ((i+1)<(uint)nNbArg))
{ {
CWildCard card; CWildCard card;
card.Expression = strlwr(string(ppArgs[i+1])); card.Expression = toLower(string(ppArgs[i+1]));
card.Not = true; card.Not = true;
WildCards.push_back (card); WildCards.push_back (card);
optionCount += 2; optionCount += 2;

View file

@ -1,3 +1,19 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// data_mirror.cpp : Defines the class behaviors for the application. // data_mirror.cpp : Defines the class behaviors for the application.
// //
@ -89,21 +105,21 @@ BOOL CData_mirrorApp::InitInstance()
cf.load (path); cf.load (path);
MainDirectory = cf.getVar ("MainDirectory").asString (); MainDirectory = cf.getVar ("MainDirectory").asString ();
MainDirectory = strlwr (CPath::standardizePath (MainDirectory)); MainDirectory = toLower (CPath::standardizePath (MainDirectory));
MirrorDirectory = cf.getVar ("MirrorDirectory").asString (); MirrorDirectory = cf.getVar ("MirrorDirectory").asString ();
MirrorDirectory = strlwr (CPath::standardizePath (MirrorDirectory)); MirrorDirectory = toLower (CPath::standardizePath (MirrorDirectory));
LogDirectory = cf.getVar ("LogDirectory").asString (); LogDirectory = cf.getVar ("LogDirectory").asString ();
LogDirectory = strlwr (CPath::standardizePath (LogDirectory)); LogDirectory = toLower (CPath::standardizePath (LogDirectory));
IgnoreDirectory = cf.getVar ("IgnoreDirectory").asString (); IgnoreDirectory = cf.getVar ("IgnoreDirectory").asString ();
IgnoreDirectory = strlwr (CPath::standardizePath (IgnoreDirectory)); IgnoreDirectory = toLower (CPath::standardizePath (IgnoreDirectory));
if (IgnoreDirectory.empty()) if (IgnoreDirectory.empty())
IgnoreDirectory = MainDirectory; IgnoreDirectory = MainDirectory;
string sBinaryCompare = cf.getVar ("BinaryCompare").asString (); string sBinaryCompare = cf.getVar ("BinaryCompare").asString ();
sBinaryCompare = strlwr (sBinaryCompare); sBinaryCompare = toLower (sBinaryCompare);
BinaryCompare = false; BinaryCompare = false;
if ((sBinaryCompare == "true") || (sBinaryCompare=="1")) if ((sBinaryCompare == "true") || (sBinaryCompare=="1"))
BinaryCompare = true; BinaryCompare = true;
@ -126,12 +142,12 @@ BOOL CData_mirrorApp::InitInstance()
if (NLMISC::CFile::isDirectory (CurrentDir)) if (NLMISC::CFile::isDirectory (CurrentDir))
{ {
directory = true; directory = true;
CurrentDir = strlwr (CPath::standardizePath (CurrentDir)); CurrentDir = toLower(CPath::standardizePath (CurrentDir));
} }
else if (NLMISC::CFile::fileExists (CurrentDir)) else if (NLMISC::CFile::fileExists (CurrentDir))
{ {
directory = false; directory = false;
CurrentDir = strlwr (CPath::standardizePath (NLMISC::CFile::getPath (CurrentDir))); CurrentDir = toLower(CPath::standardizePath (NLMISC::CFile::getPath (CurrentDir)));
} }
else else
{ {

View file

@ -1,5 +1,18 @@
// data_mirrorDlg.cpp : implementation file // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h" #include "stdafx.h"
#include "data_mirror.h" #include "data_mirror.h"
@ -600,8 +613,7 @@ void CData_mirrorDlg::buildSourceFiles ()
{ {
// Get the filename // Get the filename
string &str = fileSource[i]; string &str = fileSource[i];
str = strlwr (str); str = toLower(str.substr (MainDirectory.size (), str.size ()));
str = str.substr (MainDirectory.size (), str.size ());
// In the ignore list ? // In the ignore list ?
if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt")) if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt"))
@ -689,8 +701,7 @@ void CData_mirrorDlg::buildSourceFiles ()
{ {
// Get the filename // Get the filename
string &str = fileSource[i]; string &str = fileSource[i];
str = strlwr (str); str = toLower(str.substr (MirrorDirectory.size (), str.size ()));
str = str.substr (MirrorDirectory.size (), str.size ());
// In the ignore list ? // In the ignore list ?
if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt")) if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt"))

View file

@ -23,7 +23,11 @@ using namespace NLMISC;
#ifdef NL_DEBUG #ifdef NL_DEBUG
#define INFO nlinfo #define INFO nlinfo
#else // NL_DEBUG #else // NL_DEBUG
#define INFO ((void)0) # if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
# define INFO __noop
# else
# define INFO 0&&
# endif
#endif // NL_DEBUG #endif // NL_DEBUG
bool readTheFile (const char *filename, vector<char> &fileArray) bool readTheFile (const char *filename, vector<char> &fileArray)
@ -207,7 +211,7 @@ void extractStringsFromBinary (const vector<char> &fileArray, set<string> &filen
if (str != "") if (str != "")
{ {
// Lower case // Lower case
str = strlwr (str); str = toLower (str);
// Filter extensions // Filter extensions
if (filterExtension (str.c_str(), extensions)) if (filterExtension (str.c_str(), extensions))
@ -273,7 +277,7 @@ void extractStringsFromASCII (const vector<char> &fileArray, set<string> &filena
temp[c] = begin[c]; temp[c] = begin[c];
// Lower case // Lower case
temp = strlwr (temp); temp = toLower (temp);
// Filter extensions // Filter extensions
if (filterExtension (temp.c_str(), extensions)) if (filterExtension (temp.c_str(), extensions))
@ -317,15 +321,12 @@ bool loadConfigFiles (const char *ext, const char *input_files, const char *avai
char name[512]; char name[512];
while (fgets (name, 512, file)) while (fgets (name, 512, file))
{ {
// To string // To string and lower
temp = name; temp = toLower (string(name));
// Remove return // Remove return
removeChar (temp, '\n'); removeChar (temp, '\n');
// Lower
strlwr (temp);
// Valid extension ? // Valid extension ?
if (temp.size() && temp[0] == '.') if (temp.size() && temp[0] == '.')
// Add the extension // Add the extension
@ -369,12 +370,9 @@ bool loadConfigFiles (const char *ext, const char *input_files, const char *avai
char name[512]; char name[512];
while (fgets (name, 512, file)) while (fgets (name, 512, file))
{ {
temp = name;
temp2 = name;
// To lower // To lower
temp = strlwr (temp); temp = toLower (string(name));
temp2 = strlwr (temp2); temp2 = toLower (string(name));
// Remove space // Remove space
removeBeginEndSpaces (temp); removeBeginEndSpaces (temp);
@ -596,7 +594,7 @@ int main(int argc, char* argv[])
// It is used ? // It is used ?
if (usedFiles.find (available->first) == usedFiles.end()) if (usedFiles.find (available->first) == usedFiles.end())
{ {
string temp = strlwr (available->second.c_str()); string temp = toLower (available->second);
fprintf (stderr, "UNUSED: %s\n", temp.c_str()); fprintf (stderr, "UNUSED: %s\n", temp.c_str());
} }
@ -610,7 +608,7 @@ int main(int argc, char* argv[])
} }
else else
{ {
printf ("extract_filename.exe [extensions.txt] [inputFiles.txt] [availableFiles.txt]\n"); printf ("extract_filename [extensions.txt] [inputFiles.txt] [availableFiles.txt]\n");
} }
return 0; return 0;
} }

View file

@ -326,31 +326,36 @@ int main(int argc, char *argv[])
// read the first line // read the first line
char buffer[MaxLineSize]; char buffer[MaxLineSize];
fgets(buffer, MaxLineSize, fp); if (!fgets(buffer, MaxLineSize, fp) || strcmp(buffer, "<nel:packed_xml>\n") != 0)
linecount++;
if (strcmp(buffer, "<nel:packed_xml>\n") != 0)
{ {
printf ("Error : invalid pack file '%s'\n", filename.c_str()); printf ("Error : invalid pack file '%s'\n", filename.c_str());
exit(-1); return -1;
} }
linecount++;
char *result = NULL; char *result = NULL;
do do
{ {
// read a file line // read a file line
fgets(buffer, MaxLineSize, fp);
CSString parser(buffer);
linecount++; linecount++;
if (!fgets(buffer, MaxLineSize, fp))
{
fclose(fp);
printf ("Error : invalid pack file '%s' at line %u", filename.c_str(), linecount);
return -1;
}
CSString parser(buffer);
if (parser.find(" <nel:xml_file name=") != 0) if (parser.find(" <nel:xml_file name=") != 0)
{ {
if (parser.find("</nel:packed_xml>") == 0)
{
// end of pack file
fclose(fp); fclose(fp);
// end of pack file
if (parser.find("</nel:packed_xml>") == 0)
break; break;
}
printf ("Error : invalid pack file '%s' at line %u", filename.c_str(), linecount); printf ("Error : invalid pack file '%s' at line %u", filename.c_str(), linecount);
exit(-1); return -1;
} }
CSString subFileName = parser.leftCrop(sizeof(" <nel:xml_file name=")-1); CSString subFileName = parser.leftCrop(sizeof(" <nel:xml_file name=")-1);

View file

@ -217,7 +217,7 @@ void processAllPasses(string &zoneName)
} }
catch(Exception &e) catch(Exception &e)
{ {
printf(e.what ()); printf("%s\n", e.what ());
} }
} }
@ -935,7 +935,7 @@ void processGlobalRetriever()
} }
catch (Exception &e) catch (Exception &e)
{ {
printf(e.what ()); printf("%s\n", e.what ());
} }
} }
} }

View file

@ -558,9 +558,9 @@ void NLPACS::CComputableSurface::followBorder(CZoneTessellation *zoneTessel, CSu
current->IsBorder = true; current->IsBorder = true;
if ((oppositeSurfId != UnaffectedSurfaceId && (next == NULL || (next->SurfaceId != oppositeSurfId && next->SurfaceId != currentSurfId))) || if (((oppositeSurfId != UnaffectedSurfaceId) && (next == NULL || (next->SurfaceId != oppositeSurfId && next->SurfaceId != currentSurfId))) ||
(oppositeSurfId == UnaffectedSurfaceId && (next != NULL && next->SurfaceId != currentSurfId || next == NULL && current->getZoneIdOnEdge(nextEdge) != oppositeZid)) || ((oppositeSurfId == UnaffectedSurfaceId) && ((next != NULL && next->SurfaceId != currentSurfId) || (next == NULL && current->getZoneIdOnEdge(nextEdge) != oppositeZid))) ||
((current->EdgeFlag[nextEdge] || zoneTessel->VerticesFlags[current->Tri[pivot]]!=0) && !allowThis)) ((current->EdgeFlag[nextEdge] || (zoneTessel->VerticesFlags[current->Tri[pivot]]!=0)) && !allowThis))
{ {
// if reaches the end of the border, then quits. // if reaches the end of the border, then quits.
loop = (absoluteEquals(vstore.front(), vstore.back(), 1e-2f) && loopCount != 1); loop = (absoluteEquals(vstore.front(), vstore.back(), 1e-2f) && loopCount != 1);
@ -1296,7 +1296,7 @@ void NLPACS::CZoneTessellation::compile()
if ((bits0 & CPrimChecker::Water)!=0 || (bits1 & CPrimChecker::Water)!=0 || (bits2 & CPrimChecker::Water)!=0) if ((bits0 & CPrimChecker::Water)!=0 || (bits1 & CPrimChecker::Water)!=0 || (bits2 & CPrimChecker::Water)!=0)
{ {
uint ws; uint ws = 0;
uint16 ws0 = PrimChecker.index((uint)v0.x, (uint)v0.y); uint16 ws0 = PrimChecker.index((uint)v0.x, (uint)v0.y);
uint16 ws1 = PrimChecker.index((uint)v1.x, (uint)v1.y); uint16 ws1 = PrimChecker.index((uint)v1.x, (uint)v1.y);

View file

@ -394,7 +394,9 @@ public:
void floodFill(CSurfElement *first, sint32 surfId, const A &cmp, CZoneTessellation *zoneTessel) void floodFill(CSurfElement *first, sint32 surfId, const A &cmp, CZoneTessellation *zoneTessel)
{ {
if (Verbose) if (Verbose)
{
nldebug("flood fill surface %d", surfId); nldebug("flood fill surface %d", surfId);
}
std::vector<CSurfElement *> stack; std::vector<CSurfElement *> stack;
sint i; sint i;
@ -436,7 +438,9 @@ public:
} }
if (Verbose) if (Verbose)
{
nldebug("%d elements added", Elements.size()); nldebug("%d elements added", Elements.size());
}
Center = NLMISC::CVector::Null; Center = NLMISC::CVector::Null;
for (i=0; i<(sint)Elements.size(); ++i) for (i=0; i<(sint)Elements.size(); ++i)

View file

@ -19,8 +19,8 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/../../src/pacs/local_retriever.h" #include "../../../src/pacs/local_retriever.h"
#include "nel/../../src/pacs/quad_grid.h" #include "../../../src/pacs/quad_grid.h"
#include <map> #include <map>
@ -394,6 +394,7 @@ public:
} }
bool operator != (const iterator &it) { return !(*this == it); } bool operator != (const iterator &it) { return !(*this == it); }
// ++it
iterator &operator ++ () iterator &operator ++ ()
{ {
ChainVertex += ChainDirection; ChainVertex += ChainDirection;
@ -402,7 +403,23 @@ public:
Chain += Direction; Chain += Direction;
resetChain(); resetChain();
} }
// FIXME add return value here!
return *this;
}
// it++
iterator operator ++ (int)
{
iterator tmp(*this);
ChainVertex += ChainDirection;
if (ChainVertex == 0 || ChainVertex == (sint)pChain->Vertices.size()-1)
{
Chain += Direction;
resetChain();
}
return tmp;
} }
void resetChain() void resetChain()