Core: Fix more warnings and fix compile under linux 64
--HG-- branch : trunk
This commit is contained in:
@@ -34,28 +34,37 @@ struct RawData
|
|||||||
char time_str[200];
|
char time_str[200];
|
||||||
};
|
};
|
||||||
|
|
||||||
void extractDataFromSvn(FILE* EntriesFile, bool url, RawData& data)
|
bool extractDataFromSvn(std::string filename, bool url, RawData& data)
|
||||||
{
|
{
|
||||||
char buf[200];
|
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
||||||
|
if (!EntriesFile)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char aux[800];
|
||||||
|
char buf[200];
|
||||||
char repo_str[200];
|
char repo_str[200];
|
||||||
char num_str[200];
|
char num_str[200];
|
||||||
|
bool ret = false;
|
||||||
|
|
||||||
fgets(buf,200,EntriesFile);
|
if (fgets(aux, 600, EntriesFile) && fgets(buf, 200, EntriesFile))
|
||||||
fgets(buf,200,EntriesFile);
|
{
|
||||||
fgets(buf,200,EntriesFile);
|
sscanf(buf, "%s", num_str);
|
||||||
fgets(buf,200,EntriesFile); sscanf(buf,"%s",num_str);
|
if (fgets(buf, 200, EntriesFile))
|
||||||
fgets(buf,200,EntriesFile); sscanf(buf,"%s",repo_str);
|
{
|
||||||
fgets(buf,200,EntriesFile);
|
sscanf(buf, "%s", repo_str);
|
||||||
fgets(buf,200,EntriesFile);
|
if (fgets(aux, 800, EntriesFile) && fgets(buf, 200, EntriesFile))
|
||||||
fgets(buf,200,EntriesFile);
|
{
|
||||||
fgets(buf,200,EntriesFile);
|
sscanf(buf, "%10sT%8s", data.date_str, data.time_str);
|
||||||
fgets(buf,200,EntriesFile); sscanf(buf,"%10sT%8s",data.date_str,data.time_str);
|
if (url)
|
||||||
|
|
||||||
if(url)
|
|
||||||
sprintf(data.rev_str,"%s at %s",num_str,repo_str);
|
sprintf(data.rev_str,"%s at %s",num_str,repo_str);
|
||||||
else
|
else
|
||||||
strcpy(data.rev_str,num_str);
|
strcpy(data.rev_str,num_str);
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(EntriesFile);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void extractDataFromHG(FILE* EntriesFile, std::string /*path*/, bool /*url*/, RawData& data)
|
void extractDataFromHG(FILE* EntriesFile, std::string /*path*/, bool /*url*/, RawData& data)
|
||||||
@@ -66,16 +75,16 @@ void extractDataFromHG(FILE* EntriesFile, std::string /*path*/, bool /*url*/, Ra
|
|||||||
char revision_str[200];
|
char revision_str[200];
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
while(fgets(buf,200,EntriesFile))
|
while (fgets(buf,200,EntriesFile))
|
||||||
{
|
{
|
||||||
if(sscanf(buf,"%s %s",hash_str,revision_str)==2)
|
if (sscanf(buf,"%s %s",hash_str,revision_str)==2)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
strcpy(data.hash_str,"*");
|
strcpy(data.hash_str,"*");
|
||||||
strcpy(data.rev_str,"*");
|
strcpy(data.rev_str,"*");
|
||||||
@@ -106,17 +115,19 @@ void extractDataFromArchive(FILE* EntriesFile, std::string /*path*/, bool /*url*
|
|||||||
char revision_str[200];
|
char revision_str[200];
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
fgets(buf,200,EntriesFile);
|
if (fgets(buf,200,EntriesFile))
|
||||||
while(fgets(buf,200,EntriesFile))
|
|
||||||
{
|
{
|
||||||
if(sscanf(buf,"%s %s",revision_str,hash_str)==2)
|
while (fgets(buf,200,EntriesFile))
|
||||||
|
{
|
||||||
|
if (sscanf(buf,"%s %s",revision_str,hash_str)==2)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
strcpy(data.hash_str,"*");
|
strcpy(data.hash_str,"*");
|
||||||
strcpy(data.rev_str,"*");
|
strcpy(data.rev_str,"*");
|
||||||
@@ -148,16 +159,16 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
|
|||||||
char url_str[200];
|
char url_str[200];
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
while(fgets(buf,200,EntriesFile))
|
while (fgets(buf,200,EntriesFile))
|
||||||
{
|
{
|
||||||
if(sscanf(buf,"%s\t\tbranch %s of %s",hash_str,branch_str,url_str)==3)
|
if (sscanf(buf,"%s\t\tbranch %s of %s",hash_str,branch_str,url_str)==3)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
strcpy(data.hash_str,"*");
|
strcpy(data.hash_str,"*");
|
||||||
strcpy(data.rev_str,"*");
|
strcpy(data.rev_str,"*");
|
||||||
@@ -166,7 +177,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(url)
|
if (url)
|
||||||
{
|
{
|
||||||
char* host_str = NULL;
|
char* host_str = NULL;
|
||||||
char* acc_str = NULL;
|
char* acc_str = NULL;
|
||||||
@@ -175,7 +186,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
|
|||||||
// parse URL like [email protected]:mangos/mangos
|
// parse URL like [email protected]:mangos/mangos
|
||||||
char url_buf[200];
|
char url_buf[200];
|
||||||
int res = sscanf(url_str,"git@%s",url_buf);
|
int res = sscanf(url_str,"git@%s",url_buf);
|
||||||
if(res)
|
if (res)
|
||||||
{
|
{
|
||||||
host_str = strtok(url_buf,":");
|
host_str = strtok(url_buf,":");
|
||||||
acc_str = strtok(NULL,"/");
|
acc_str = strtok(NULL,"/");
|
||||||
@@ -184,7 +195,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = sscanf(url_str,"git://%s",url_buf);
|
res = sscanf(url_str,"git://%s",url_buf);
|
||||||
if(res)
|
if (res)
|
||||||
{
|
{
|
||||||
host_str = strtok(url_buf,"/");
|
host_str = strtok(url_buf,"/");
|
||||||
acc_str = strtok(NULL,"/");
|
acc_str = strtok(NULL,"/");
|
||||||
@@ -193,7 +204,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
|
|||||||
}
|
}
|
||||||
|
|
||||||
// can generate nice link
|
// can generate nice link
|
||||||
if(res)
|
if (res)
|
||||||
sprintf(data.rev_str,"http://%s/%s/%s/commit/%s",host_str,acc_str,repo_str,hash_str);
|
sprintf(data.rev_str,"http://%s/%s/%s/commit/%s",host_str,acc_str,repo_str,hash_str);
|
||||||
// unknonw URL format, use as-is
|
// unknonw URL format, use as-is
|
||||||
else
|
else
|
||||||
@@ -207,18 +218,18 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
|
|||||||
time_t rev_time = 0;
|
time_t rev_time = 0;
|
||||||
// extracting date/time
|
// extracting date/time
|
||||||
FILE* LogFile = fopen((path+".git/logs/HEAD").c_str(), "r");
|
FILE* LogFile = fopen((path+".git/logs/HEAD").c_str(), "r");
|
||||||
if(LogFile)
|
if (LogFile)
|
||||||
{
|
{
|
||||||
while(fgets(buf,200,LogFile))
|
while (fgets(buf,200,LogFile))
|
||||||
{
|
{
|
||||||
char buf2[200];
|
char buf2[200];
|
||||||
char new_hash[200];
|
char new_hash[200];
|
||||||
int unix_time = 0;
|
int unix_time = 0;
|
||||||
int res2 = sscanf(buf,"%s %s %s %s %i",buf2,new_hash,buf2,buf2,&unix_time);
|
int res2 = sscanf(buf,"%s %s %s %s %i",buf2,new_hash,buf2,buf2,&unix_time);
|
||||||
if(res2!=5)
|
if (res2!=5)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(strcmp(hash_str,new_hash))
|
if (strcmp(hash_str,new_hash))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
rev_time = unix_time;
|
rev_time = unix_time;
|
||||||
@@ -227,7 +238,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
|
|||||||
|
|
||||||
fclose(LogFile);
|
fclose(LogFile);
|
||||||
|
|
||||||
if(rev_time)
|
if (rev_time)
|
||||||
{
|
{
|
||||||
tm* aTm = localtime(&rev_time);
|
tm* aTm = localtime(&rev_time);
|
||||||
// YYYY year
|
// YYYY year
|
||||||
@@ -252,21 +263,10 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool extractDataFromSvn(std::string filename, bool url, RawData& data)
|
|
||||||
{
|
|
||||||
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
|
||||||
if(!EntriesFile)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
extractDataFromSvn(EntriesFile,url,data);
|
|
||||||
fclose(EntriesFile);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool extractDataFromGit(std::string filename, std::string path, bool url, RawData& data)
|
bool extractDataFromGit(std::string filename, std::string path, bool url, RawData& data)
|
||||||
{
|
{
|
||||||
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
||||||
if(!EntriesFile)
|
if (!EntriesFile)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
extractDataFromGit(EntriesFile,path,url,data);
|
extractDataFromGit(EntriesFile,path,url,data);
|
||||||
@@ -277,7 +277,7 @@ bool extractDataFromGit(std::string filename, std::string path, bool url, RawDat
|
|||||||
bool extractDataFromHG(std::string filename, std::string path, bool url, RawData& data)
|
bool extractDataFromHG(std::string filename, std::string path, bool url, RawData& data)
|
||||||
{
|
{
|
||||||
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
||||||
if(!EntriesFile)
|
if (!EntriesFile)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
extractDataFromHG(EntriesFile,path,url,data);
|
extractDataFromHG(EntriesFile,path,url,data);
|
||||||
@@ -288,7 +288,7 @@ bool extractDataFromHG(std::string filename, std::string path, bool url, RawData
|
|||||||
bool extractDataFromArchive(std::string filename, std::string path, bool url, RawData& data)
|
bool extractDataFromArchive(std::string filename, std::string path, bool url, RawData& data)
|
||||||
{
|
{
|
||||||
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
||||||
if(!EntriesFile)
|
if (!EntriesFile)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
extractDataFromArchive(EntriesFile,path,url,data);
|
extractDataFromArchive(EntriesFile,path,url,data);
|
||||||
@@ -340,13 +340,13 @@ int main(int argc, char **argv)
|
|||||||
// -m build mode string
|
// -m build mode string
|
||||||
for (int k = 1; k <= argc; ++k)
|
for (int k = 1; k <= argc; ++k)
|
||||||
{
|
{
|
||||||
if(!argv[k] || !*argv[k])
|
if (!argv[k] || !*argv[k])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(argv[k][0]!='-')
|
if (argv[k][0]!='-')
|
||||||
{
|
{
|
||||||
path = argv[k];
|
path = argv[k];
|
||||||
if(path.size() > 0 && (path[path.size()-1]!='/' || path[path.size()-1]!='\\'))
|
if (path.size() > 0 && (path[path.size()-1]!='/' || path[path.size()-1]!='\\'))
|
||||||
path += '/';
|
path += '/';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -391,7 +391,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
if(svn_prefered)
|
if (svn_prefered)
|
||||||
{
|
{
|
||||||
/// SVN data
|
/// SVN data
|
||||||
res = extractDataFromSvn(path+".svn/entries",use_url,data);
|
res = extractDataFromSvn(path+".svn/entries",use_url,data);
|
||||||
@@ -417,7 +417,7 @@ int main(int argc, char **argv)
|
|||||||
if (!res)
|
if (!res)
|
||||||
res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data);
|
res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data);
|
||||||
}
|
}
|
||||||
else if(git_prefered)
|
else if (git_prefered)
|
||||||
{
|
{
|
||||||
// GIT data
|
// GIT data
|
||||||
res = extractDataFromGit(path+".git/FETCH_HEAD",path,use_url,data);
|
res = extractDataFromGit(path+".git/FETCH_HEAD",path,use_url,data);
|
||||||
@@ -445,7 +445,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if(hg_prefered)
|
else if (hg_prefered)
|
||||||
{
|
{
|
||||||
// HG data
|
// HG data
|
||||||
res = extractDataFromHG(path+".hg/branchheads.cache",path,use_url,data);
|
res = extractDataFromHG(path+".hg/branchheads.cache",path,use_url,data);
|
||||||
@@ -472,7 +472,7 @@ int main(int argc, char **argv)
|
|||||||
res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data);
|
res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(res)
|
if (res)
|
||||||
newData = generateHeader(data.rev_str,data.date_str,data.time_str,data.hash_str);
|
newData = generateHeader(data.rev_str,data.date_str,data.time_str,data.hash_str);
|
||||||
else
|
else
|
||||||
newData = generateHeader("*", "*", "*", "*");
|
newData = generateHeader("*", "*", "*", "*");
|
||||||
@@ -481,12 +481,12 @@ int main(int argc, char **argv)
|
|||||||
/// get existed header data for compare
|
/// get existed header data for compare
|
||||||
std::string oldData;
|
std::string oldData;
|
||||||
|
|
||||||
if(FILE* HeaderFile = fopen("revision.h","rb"))
|
if (FILE* HeaderFile = fopen("revision.h","rb"))
|
||||||
{
|
{
|
||||||
while(!feof(HeaderFile))
|
while (!feof(HeaderFile))
|
||||||
{
|
{
|
||||||
int c = fgetc(HeaderFile);
|
int c = fgetc(HeaderFile);
|
||||||
if(c < 0)
|
if (c < 0)
|
||||||
break;
|
break;
|
||||||
oldData += (char)c;
|
oldData += (char)c;
|
||||||
}
|
}
|
||||||
@@ -495,9 +495,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// update header only if different data
|
/// update header only if different data
|
||||||
if(newData != oldData)
|
if (newData != oldData)
|
||||||
{
|
{
|
||||||
if(FILE* OutputFile = fopen("revision.h","wb"))
|
if (FILE* OutputFile = fopen("revision.h","wb"))
|
||||||
{
|
{
|
||||||
fprintf(OutputFile,"%s",newData.c_str());
|
fprintf(OutputFile,"%s",newData.c_str());
|
||||||
fclose(OutputFile);
|
fclose(OutputFile);
|
||||||
|
|||||||
@@ -388,7 +388,8 @@ namespace VMAP
|
|||||||
// update tree
|
// update tree
|
||||||
uint32 referencedVal;
|
uint32 referencedVal;
|
||||||
|
|
||||||
fread(&referencedVal, sizeof(uint32), 1, tf);
|
if (fread(&referencedVal, sizeof(uint32), 1, tf) == 1)
|
||||||
|
{
|
||||||
if (!iLoadedSpawns.count(referencedVal))
|
if (!iLoadedSpawns.count(referencedVal))
|
||||||
{
|
{
|
||||||
#ifdef VMAP_DEBUG
|
#ifdef VMAP_DEBUG
|
||||||
@@ -412,6 +413,9 @@ namespace VMAP
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
iLoadedTiles[packTileID(tileX, tileY)] = true;
|
iLoadedTiles[packTileID(tileX, tileY)] = true;
|
||||||
fclose(tf);
|
fclose(tf);
|
||||||
@@ -458,11 +462,12 @@ namespace VMAP
|
|||||||
// update tree
|
// update tree
|
||||||
uint32 referencedNode;
|
uint32 referencedNode;
|
||||||
|
|
||||||
fread(&referencedNode, sizeof(uint32), 1, tf);
|
if (fread(&referencedNode, sizeof(uint32), 1, tf) != 1)
|
||||||
if (!iLoadedSpawns.count(referencedNode))
|
result = false;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
|
if (!iLoadedSpawns.count(referencedNode))
|
||||||
sLog.outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
|
sLog.outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
|
||||||
}
|
|
||||||
else if (--iLoadedSpawns[referencedNode] == 0)
|
else if (--iLoadedSpawns[referencedNode] == 0)
|
||||||
{
|
{
|
||||||
iTreeValues[referencedNode].setUnloaded();
|
iTreeValues[referencedNode].setUnloaded();
|
||||||
@@ -470,6 +475,7 @@ namespace VMAP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fclose(tf);
|
fclose(tf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1188,7 +1188,7 @@ void MovementInfo::OutDebug()
|
|||||||
sLog.outString("guid " UI64FMTD, guid);
|
sLog.outString("guid " UI64FMTD, guid);
|
||||||
sLog.outString("flags %u", flags);
|
sLog.outString("flags %u", flags);
|
||||||
sLog.outString("flags2 %u", flags2);
|
sLog.outString("flags2 %u", flags2);
|
||||||
sLog.outString("time %u current time %u", flags2, ::time(NULL));
|
sLog.outString("time %u current time " UI64FMTD "", flags2, uint64(::time(NULL)));
|
||||||
sLog.outString("position: `%s`", pos.ToString().c_str());
|
sLog.outString("position: `%s`", pos.ToString().c_str());
|
||||||
if (flags & MOVEMENTFLAG_ONTRANSPORT)
|
if (flags & MOVEMENTFLAG_ONTRANSPORT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -85,28 +85,25 @@ bool Map::ExistMap(uint32 mapid,int gx,int gy)
|
|||||||
char* tmp = new char[len];
|
char* tmp = new char[len];
|
||||||
snprintf(tmp, len, (char *)(sWorld.GetDataPath()+"maps/%03u%02u%02u.map").c_str(),mapid,gx,gy);
|
snprintf(tmp, len, (char *)(sWorld.GetDataPath()+"maps/%03u%02u%02u.map").c_str(),mapid,gx,gy);
|
||||||
|
|
||||||
|
bool ret = false;
|
||||||
FILE *pf=fopen(tmp,"rb");
|
FILE *pf=fopen(tmp,"rb");
|
||||||
|
|
||||||
if (!pf)
|
if (!pf)
|
||||||
{
|
|
||||||
sLog.outError("Map file '%s': does not exist!",tmp);
|
sLog.outError("Map file '%s': does not exist!",tmp);
|
||||||
delete[] tmp;
|
else
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
map_fileheader header;
|
|
||||||
fread(&header, sizeof(header), 1, pf);
|
|
||||||
if (header.mapMagic != uint32(MAP_MAGIC) || header.versionMagic != uint32(MAP_VERSION_MAGIC))
|
|
||||||
{
|
{
|
||||||
|
map_fileheader header;
|
||||||
|
if (fread(&header, sizeof(header), 1, pf) == 1)
|
||||||
|
{
|
||||||
|
if (header.mapMagic != uint32(MAP_MAGIC) || header.versionMagic != uint32(MAP_VERSION_MAGIC))
|
||||||
sLog.outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.",tmp);
|
sLog.outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.",tmp);
|
||||||
|
else
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
delete [] tmp;
|
delete [] tmp;
|
||||||
fclose(pf); //close file before return
|
fclose(pf); //close file before return
|
||||||
return false;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
delete [] tmp;
|
|
||||||
fclose(pf);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Map::ExistVMap(uint32 mapid,int gx,int gy)
|
bool Map::ExistVMap(uint32 mapid,int gx,int gy)
|
||||||
@@ -1109,7 +1106,13 @@ bool GridMap::loadData(char *filename)
|
|||||||
FILE *in = fopen(filename, "rb");
|
FILE *in = fopen(filename, "rb");
|
||||||
if (!in)
|
if (!in)
|
||||||
return true;
|
return true;
|
||||||
fread(&header, sizeof(header),1,in);
|
|
||||||
|
if (fread(&header, sizeof(header),1,in) != 1)
|
||||||
|
{
|
||||||
|
fclose(in);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (header.mapMagic == uint32(MAP_MAGIC) && header.versionMagic == uint32(MAP_VERSION_MAGIC))
|
if (header.mapMagic == uint32(MAP_MAGIC) && header.versionMagic == uint32(MAP_VERSION_MAGIC))
|
||||||
{
|
{
|
||||||
// loadup area data
|
// loadup area data
|
||||||
@@ -1160,15 +1163,16 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/)
|
|||||||
{
|
{
|
||||||
map_areaHeader header;
|
map_areaHeader header;
|
||||||
fseek(in, offset, SEEK_SET);
|
fseek(in, offset, SEEK_SET);
|
||||||
fread(&header, sizeof(header), 1, in);
|
|
||||||
if (header.fourcc != uint32(MAP_AREA_MAGIC))
|
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_AREA_MAGIC))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_gridArea = header.gridArea;
|
m_gridArea = header.gridArea;
|
||||||
if (!(header.flags & MAP_AREA_NO_AREA))
|
if (!(header.flags & MAP_AREA_NO_AREA))
|
||||||
{
|
{
|
||||||
m_area_map = new uint16 [16*16];
|
m_area_map = new uint16 [16*16];
|
||||||
fread(m_area_map, sizeof(uint16), 16*16, in);
|
if (fread(m_area_map, sizeof(uint16), 16*16, in) != 16*16)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1177,8 +1181,8 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
|
|||||||
{
|
{
|
||||||
map_heightHeader header;
|
map_heightHeader header;
|
||||||
fseek(in, offset, SEEK_SET);
|
fseek(in, offset, SEEK_SET);
|
||||||
fread(&header, sizeof(header), 1, in);
|
|
||||||
if (header.fourcc != uint32(MAP_HEIGHT_MAGIC))
|
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_HEIGHT_MAGIC))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_gridHeight = header.gridHeight;
|
m_gridHeight = header.gridHeight;
|
||||||
@@ -1188,8 +1192,9 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
|
|||||||
{
|
{
|
||||||
m_uint16_V9 = new uint16 [129*129];
|
m_uint16_V9 = new uint16 [129*129];
|
||||||
m_uint16_V8 = new uint16 [128*128];
|
m_uint16_V8 = new uint16 [128*128];
|
||||||
fread(m_uint16_V9, sizeof(uint16), 129*129, in);
|
if (fread(m_uint16_V9, sizeof(uint16), 129*129, in) != 129*129 ||
|
||||||
fread(m_uint16_V8, sizeof(uint16), 128*128, in);
|
fread(m_uint16_V8, sizeof(uint16), 128*128, in) != 128*128)
|
||||||
|
return false;
|
||||||
m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535;
|
m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535;
|
||||||
m_gridGetHeight = &GridMap::getHeightFromUint16;
|
m_gridGetHeight = &GridMap::getHeightFromUint16;
|
||||||
}
|
}
|
||||||
@@ -1197,8 +1202,9 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
|
|||||||
{
|
{
|
||||||
m_uint8_V9 = new uint8 [129*129];
|
m_uint8_V9 = new uint8 [129*129];
|
||||||
m_uint8_V8 = new uint8 [128*128];
|
m_uint8_V8 = new uint8 [128*128];
|
||||||
fread(m_uint8_V9, sizeof(uint8), 129*129, in);
|
if (fread(m_uint8_V9, sizeof(uint8), 129*129, in) != 129*129 ||
|
||||||
fread(m_uint8_V8, sizeof(uint8), 128*128, in);
|
fread(m_uint8_V8, sizeof(uint8), 128*128, in) != 128*128)
|
||||||
|
return false;
|
||||||
m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255;
|
m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255;
|
||||||
m_gridGetHeight = &GridMap::getHeightFromUint8;
|
m_gridGetHeight = &GridMap::getHeightFromUint8;
|
||||||
}
|
}
|
||||||
@@ -1206,8 +1212,9 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
|
|||||||
{
|
{
|
||||||
m_V9 = new float [129*129];
|
m_V9 = new float [129*129];
|
||||||
m_V8 = new float [128*128];
|
m_V8 = new float [128*128];
|
||||||
fread(m_V9, sizeof(float), 129*129, in);
|
if (fread(m_V9, sizeof(float), 129*129, in) != 129*129 ||
|
||||||
fread(m_V8, sizeof(float), 128*128, in);
|
fread(m_V8, sizeof(float), 128*128, in) != 128*128)
|
||||||
|
return false;
|
||||||
m_gridGetHeight = &GridMap::getHeightFromFloat;
|
m_gridGetHeight = &GridMap::getHeightFromFloat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1220,8 +1227,8 @@ bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/)
|
|||||||
{
|
{
|
||||||
map_liquidHeader header;
|
map_liquidHeader header;
|
||||||
fseek(in, offset, SEEK_SET);
|
fseek(in, offset, SEEK_SET);
|
||||||
fread(&header, sizeof(header), 1, in);
|
|
||||||
if (header.fourcc != uint32(MAP_LIQUID_MAGIC))
|
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_LIQUID_MAGIC))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_liquidType = header.liquidType;
|
m_liquidType = header.liquidType;
|
||||||
@@ -1234,12 +1241,14 @@ bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/)
|
|||||||
if (!(header.flags & MAP_LIQUID_NO_TYPE))
|
if (!(header.flags & MAP_LIQUID_NO_TYPE))
|
||||||
{
|
{
|
||||||
m_liquid_type = new uint8 [16*16];
|
m_liquid_type = new uint8 [16*16];
|
||||||
fread(m_liquid_type, sizeof(uint8), 16*16, in);
|
if (fread(m_liquid_type, sizeof(uint8), 16*16, in) != 16*16)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (!(header.flags & MAP_LIQUID_NO_HEIGHT))
|
if (!(header.flags & MAP_LIQUID_NO_HEIGHT))
|
||||||
{
|
{
|
||||||
m_liquid_map = new float [m_liquid_width*m_liquid_height];
|
m_liquid_map = new float [m_liquid_width*m_liquid_height];
|
||||||
fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in);
|
if (fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in) != m_liquid_width*m_liquid_height)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void TCSoapRunnable::run()
|
|||||||
pool.activate (THR_NEW_LWP | THR_JOINABLE, POOL_SIZE);
|
pool.activate (THR_NEW_LWP | THR_JOINABLE, POOL_SIZE);
|
||||||
|
|
||||||
struct soap soap;
|
struct soap soap;
|
||||||
SOCKET m, s;
|
int m, s;
|
||||||
soap_init(&soap);
|
soap_init(&soap);
|
||||||
soap_set_imode(&soap, SOAP_C_UTFSTRING);
|
soap_set_imode(&soap, SOAP_C_UTFSTRING);
|
||||||
soap_set_omode(&soap, SOAP_C_UTFSTRING);
|
soap_set_omode(&soap, SOAP_C_UTFSTRING);
|
||||||
|
|||||||
Reference in New Issue
Block a user