Skip to content

Commit

Permalink
Map: Compile fixes for map and bg core sync
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlikely4r committed Nov 16, 2024
1 parent 12a5d3f commit 8e04807
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 39 deletions.
10 changes: 7 additions & 3 deletions playerbot/RandomPlayerbotMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
BattleGroundBracketId bracketId = pvpDiff->GetBracketId();
#endif
#ifdef MANGOSBOT_TWO
/* to fix
if (ArenaType arenaType = sServerFacade.BgArenaType(queueTypeId))
{
BattleGroundQueue& bgQueue = sServerFacade.bgQueue(queueTypeId);
Expand All @@ -1186,13 +1187,14 @@ void RandomPlayerbotMgr::CheckBgQueue()
}
if (player->InArena())
{
if (player->GetBattleGround()->IsRated()/* && (ginfo.isRated && ginfo.arenaTeamId && ginfo.arenaTeamRating && ginfo.opponentsTeamRating)*/)
if (player->GetBattleGround()->IsRated())
TeamId = 1;
else
TeamId = 0;
}
ArenaBots[queueTypeId][bracketId][TeamId][tempT]++;
}
*/
#endif
#ifdef MANGOSBOT_ONE
if (ArenaType arenaType = sServerFacade.BgArenaType(queueTypeId))
Expand Down Expand Up @@ -1296,7 +1298,8 @@ void RandomPlayerbotMgr::CheckBgQueue()

BattleGroundBracketId bracketId = pvpDiff->GetBracketId();
#endif
#ifdef MANGOSBOT_TWO
#ifdef MANGOSBOT_TWO
/* to fix
ArenaType arenaType = sServerFacade.BgArenaType(queueTypeId);
if (arenaType != ARENA_TYPE_NONE)
{
Expand All @@ -1309,13 +1312,14 @@ void RandomPlayerbotMgr::CheckBgQueue()
}
if (bot->InArena())
{
if (bot->GetBattleGround()->IsRated()/* && (ginfo.isRated && ginfo.arenaTeamId && ginfo.arenaTeamRating && ginfo.opponentsTeamRating)*/)
if (bot->GetBattleGround()->IsRated())
TeamId = 1;
else
TeamId = 0;
}
ArenaBots[queueTypeId][bracketId][TeamId][tempT]++;
}
*/
#endif
#ifdef MANGOSBOT_ONE
ArenaType arenaType = sServerFacade.BgArenaType(queueTypeId);
Expand Down
7 changes: 0 additions & 7 deletions playerbot/ServerFacade.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,6 @@ class ServerFacade
}
#endif

#ifdef MANGOSBOT_TWO
BattleGroundQueue& bgQueue(BattleGroundQueueTypeId queueTypeId)
{
return sBattleGroundMgr.m_battleGroundQueues[queueTypeId];
}
#endif

uint32 GetAreaId(WorldObject* wo)
{
return sTerrainMgr.GetAreaId(wo->GetMapId(), wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ());
Expand Down
35 changes: 10 additions & 25 deletions playerbot/WorldPosition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,39 +609,24 @@ bool WorldPosition::loadMapAndVMap(uint32 mapId, uint32 instanceId, int x, int y
if (sTravelMgr.isBadMmap(mapId, x, y))
return false;

bool isLoaded = false;

#ifndef MANGOSBOT_TWO
if (mapId == 0 || mapId == 1 || mapId == 530 || mapId == 571)
MMAP::MMapFactory::createOrGetMMapManager()->loadMap(sWorld.GetDataPath(), mapId, x, y);
isLoaded = MMAP::MMapFactory::createOrGetMMapManager()->loadMap(sWorld.GetDataPath(), mapId, x, y);
else
{
MMAP::MMapFactory::createOrGetMMapManager()->loadMapInstance(sWorld.GetDataPath(), mapId, 0);
MMAP::MMapFactory::createOrGetMMapManager()->loadMap(sWorld.GetDataPath(), mapId, x, y);
isLoaded = MMAP::MMapFactory::createOrGetMMapManager()->loadMap(sWorld.GetDataPath(), mapId, x, y);
}
#endif

bool isLoaded = false;

#ifndef MANGOSBOT_TWO
//TerrainInfo* terrain = sTerrainMgr.LoadTerrain(mapId);
//isLoaded = terrain->GetTerrainType(x, y);
isLoaded = true;
#else
//Fix to ignore bad mmap files.
uint32 pathLen = sWorld.GetDataPath().length() + strlen("mmaps/%03i.mmap") + 1;
char* fileName = new char[pathLen];
snprintf(fileName, pathLen, (sWorld.GetDataPath() + "mmaps/%03i.mmap").c_str(), mapId);

FILE* file = fopen(fileName, "rb");
if (!file)
#else
if (mapId == 0 || mapId == 1 || mapId == 530 || mapId == 571)
isLoaded = MMAP::MMapFactory::createOrGetMMapManager()->loadMap(sWorld.GetDataPath(), mapId,0, x, y, 0);
else
{
sTravelMgr.addBadMmap(mapId, x, y);
delete[] fileName;
return false;
if(MMAP::MMapFactory::createOrGetMMapManager()->loadMapInstance(sWorld.GetDataPath(), mapId, 0))
isLoaded = MMAP::MMapFactory::createOrGetMMapManager()->loadMap(sWorld.GetDataPath(), mapId, 0, x, y, 0);
}

fclose(file);

isLoaded = MMAP::MMapFactory::createOrGetMMapManager()->loadMap(sWorld.GetDataPath(), mapId, instanceId, x, y, 0);
#endif

if(!isLoaded)
Expand Down
4 changes: 2 additions & 2 deletions playerbot/strategy/actions/BattleGroundJoinAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ bool BGStatusAction::Execute(Event& event)
// temp fix for crash
//return true;

#ifdef MANGOSBOT_TWO
#ifdef MANGOSBOT_TWOx
BattleGroundQueue& bgQueue = sServerFacade.bgQueue(queueTypeId);
GroupQueueInfo ginfo;
if (bgQueue.GetPlayerGroupInfoData(bot->GetObjectGuid(), &ginfo))
Expand Down Expand Up @@ -1428,7 +1428,7 @@ bool BGStatusAction::Execute(Event& event)
#ifndef MANGOSBOT_ZERO
if (isArena)
{
#ifdef MANGOSBOT_TWO
#ifdef MANGOSBOT_TWOx
isArena = true;
BattleGroundQueue& bgQueue = sServerFacade.bgQueue(queueTypeId);
GroupQueueInfo ginfo;
Expand Down
4 changes: 2 additions & 2 deletions playerbot/strategy/triggers/PvpTriggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool BgInviteActiveTrigger::IsActive()
BattleGroundQueueTypeId queueTypeId = bot->GetBattleGroundQueueTypeId(i);
if (queueTypeId == BATTLEGROUND_QUEUE_NONE)
continue;
#ifdef MANGOSBOT_TWO
#ifdef MANGOSBOT_TWOx
BattleGroundQueue& bgQueue = sServerFacade.bgQueue(queueTypeId);
GroupQueueInfo ginfo;
if (bgQueue.GetPlayerGroupInfoData(bot->GetObjectGuid(), &ginfo))
Expand All @@ -103,7 +103,7 @@ bool BgInviteActiveTrigger::IsActive()
}
}
#endif
#ifdef MANGOSBOT_ONE
#ifndef MANGOSBOT_ZERO
if (bot->IsInvitedForBattleGroundQueueType(queueTypeId))
return true;
#endif
Expand Down

0 comments on commit 8e04807

Please sign in to comment.