Skip to content
Browse files

Core/Misc: Some fixes here and there

Closes #7277
  • Loading branch information...
1 parent 28c0874 commit fb1ac16b0ce27567dc4bb435ee4fa0b0b228e4ad @Chaplain Chaplain committed with Shauren
View
8 src/server/collision/Maps/TileAssembler.cpp
@@ -336,9 +336,15 @@ namespace VMAP
void TileAssembler::exportGameobjectModels()
{
FILE* model_list = fopen((iSrcDir + "/" + "temp_gameobject_models").c_str(), "rb");
+ if (!model_list)
+ return;
+
FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb");
- if (!model_list || !model_list_copy)
+ if (!model_list_copy)
+ {
+ fclose(model_list);
return;
+ }
uint32 name_length, displayId;
char buff[500];
View
4 src/server/game/DungeonFinding/LFGMgr.cpp
@@ -1239,11 +1239,11 @@ LfgAnswer LFGMgr::GetCompatibles(std::string key)
void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap)
{
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();
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
LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
View
22 src/tools/vmap4_extractor/vmapexport.cpp
@@ -382,9 +382,9 @@ bool processArgv(int argc, char ** argv, const char *versionString)
{
bool result = true;
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)
{
@@ -447,7 +447,7 @@ int main(int argc, char ** argv)
const char *versionString = "V4.00 2012_02";
// Use command line arguments, when some
- if(!processArgv(argc, argv, versionString))
+ if (!processArgv(argc, argv, versionString))
return 1;
// 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);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Create the working directory
- if(mkdir(szWorkDirWmo
+ if (mkdir(szWorkDirWmo
#ifdef __linux__
, 0711
#endif
@@ -482,11 +482,11 @@ int main(int argc, char ** argv)
for (size_t i=0; i < archiveNames.size(); ++i)
{
MPQArchive *archive = new MPQArchive(archiveNames[i].c_str());
- if(!gOpenArchives.size() || gOpenArchives.front() != archive)
+ if (gOpenArchives.empty() || gOpenArchives.front() != 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);
return 1;
@@ -494,15 +494,15 @@ int main(int argc, char ** argv)
ReadLiquidTypeTableDBC();
// extract data
- if(success)
+ if (success)
success = ExtractWmo();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//map.dbc
- if(success)
+ if (success)
{
DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc");
- if(!dbc->open())
+ if (!dbc->open())
{
delete dbc;
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_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);
strcpy(map_ids[x].name,dbc->getRecord(x).getString(1));
@@ -527,7 +527,7 @@ int main(int argc, char ** argv)
}
printf("\n");
- if(!success)
+ if (!success)
{
printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData);
getchar();

0 comments on commit fb1ac16

Please sign in to comment.
Something went wrong with that request. Please try again.