Core/Misc: Some fixes here and there

Closes #7277
This commit is contained in:
Chaplain
2012-08-20 11:05:50 +02:00
committed by Shauren
parent 28c0874873
commit fb1ac16b0c
3 changed files with 21 additions and 15 deletions
+8 -2
View File
@@ -336,10 +336,16 @@ namespace VMAP
void TileAssembler::exportGameobjectModels() void TileAssembler::exportGameobjectModels()
{ {
FILE* model_list = fopen((iSrcDir + "/" + "temp_gameobject_models").c_str(), "rb"); FILE* model_list = fopen((iSrcDir + "/" + "temp_gameobject_models").c_str(), "rb");
FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb"); if (!model_list)
if (!model_list || !model_list_copy)
return; return;
FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb");
if (!model_list_copy)
{
fclose(model_list);
return;
}
uint32 name_length, displayId; uint32 name_length, displayId;
char buff[500]; char buff[500];
while (!feof(model_list)) while (!feof(model_list))
+2 -2
View File
@@ -1239,11 +1239,11 @@ LfgAnswer LFGMgr::GetCompatibles(std::string key)
void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap) void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap)
{ {
lockMap.clear(); lockMap.clear();
for (PlayerSet::const_iterator it = players.begin(); it != players.end() && dungeons.size(); ++it) for (PlayerSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
{ {
uint64 guid = (*it)->GetGUID(); uint64 guid = (*it)->GetGUID();
LfgLockMap cachedLockMap = GetLockedDungeons(guid); LfgLockMap cachedLockMap = GetLockedDungeons(guid);
for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2) for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2)
{ {
uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids
LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId); LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
+11 -11
View File
@@ -382,9 +382,9 @@ bool processArgv(int argc, char ** argv, const char *versionString)
{ {
bool result = true; bool result = true;
hasInputPathParam = false; hasInputPathParam = false;
bool preciseVectorData = false; preciseVectorData = false;
for(int i=1; i< argc; ++i) for(int i = 1; i < argc; ++i)
{ {
if(strcmp("-s",argv[i]) == 0) if(strcmp("-s",argv[i]) == 0)
{ {
@@ -447,7 +447,7 @@ int main(int argc, char ** argv)
const char *versionString = "V4.00 2012_02"; const char *versionString = "V4.00 2012_02";
// Use command line arguments, when some // Use command line arguments, when some
if(!processArgv(argc, argv, versionString)) if (!processArgv(argc, argv, versionString))
return 1; return 1;
// some simple check if working dir is dirty // some simple check if working dir is dirty
@@ -469,7 +469,7 @@ int main(int argc, char ** argv)
printf("Extract %s. Beginning work ....\n",versionString); printf("Extract %s. Beginning work ....\n",versionString);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Create the working directory // Create the working directory
if(mkdir(szWorkDirWmo if (mkdir(szWorkDirWmo
#ifdef __linux__ #ifdef __linux__
, 0711 , 0711
#endif #endif
@@ -482,11 +482,11 @@ int main(int argc, char ** argv)
for (size_t i=0; i < archiveNames.size(); ++i) for (size_t i=0; i < archiveNames.size(); ++i)
{ {
MPQArchive *archive = new MPQArchive(archiveNames[i].c_str()); MPQArchive *archive = new MPQArchive(archiveNames[i].c_str());
if(!gOpenArchives.size() || gOpenArchives.front() != archive) if (gOpenArchives.empty() || gOpenArchives.front() != archive)
delete archive; delete archive;
} }
if(gOpenArchives.empty()) if (gOpenArchives.empty())
{ {
printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path); printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path);
return 1; return 1;
@@ -494,15 +494,15 @@ int main(int argc, char ** argv)
ReadLiquidTypeTableDBC(); ReadLiquidTypeTableDBC();
// extract data // extract data
if(success) if (success)
success = ExtractWmo(); success = ExtractWmo();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//map.dbc //map.dbc
if(success) if (success)
{ {
DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc");
if(!dbc->open()) if (!dbc->open())
{ {
delete dbc; delete dbc;
printf("FATAL ERROR: Map.dbc not found in data file.\n"); printf("FATAL ERROR: Map.dbc not found in data file.\n");
@@ -510,7 +510,7 @@ int main(int argc, char ** argv)
} }
map_count=dbc->getRecordCount (); map_count=dbc->getRecordCount ();
map_ids=new map_id[map_count]; map_ids=new map_id[map_count];
for(unsigned int x=0;x<map_count;++x) for (unsigned int x=0;x<map_count;++x)
{ {
map_ids[x].id=dbc->getRecord (x).getUInt(0); map_ids[x].id=dbc->getRecord (x).getUInt(0);
strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1));
@@ -527,7 +527,7 @@ int main(int argc, char ** argv)
} }
printf("\n"); printf("\n");
if(!success) if (!success)
{ {
printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData);
getchar(); getchar();