mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10782] Use Team enum types in all appropriate cases and catches bug in result fix.
* Fixed wrong arenaid use at leave arena queue. * Fixed memory lost and etc at not virtual EndBattleground call * Fixed crash at arena join with fake data from client. * Code cleanups.
This commit is contained in:
parent
c2331f58bc
commit
cc0655a402
38 changed files with 315 additions and 321 deletions
|
|
@ -1724,7 +1724,7 @@ bool ObjectMgr::GetPlayerNameByGUID(ObjectGuid guid, std::string &name) const
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const
|
||||
Team ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const
|
||||
{
|
||||
// prevent DB access for online player
|
||||
if (Player* player = GetPlayer(guid))
|
||||
|
|
@ -1741,7 +1741,7 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const
|
|||
return Player::TeamForRace(race);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return TEAM_NONE;
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GetPlayerAccountIdByGUID(ObjectGuid guid) const
|
||||
|
|
@ -5771,7 +5771,7 @@ void ObjectMgr::LoadEventIdScripts()
|
|||
sLog.outString( ">> Loaded %u scripted event id", count );
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, uint32 team )
|
||||
uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, Team team )
|
||||
{
|
||||
bool found = false;
|
||||
float dist;
|
||||
|
|
@ -5834,7 +5834,7 @@ void ObjectMgr::GetTaxiPath( uint32 source, uint32 destination, uint32 &path, ui
|
|||
path = dest_i->second.ID;
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, uint32 team, bool allowed_alt_team /* = false */)
|
||||
uint32 ObjectMgr::GetTaxiMountDisplayId( uint32 id, Team team, bool allowed_alt_team /* = false */)
|
||||
{
|
||||
uint16 mount_entry = 0;
|
||||
|
||||
|
|
@ -5904,33 +5904,33 @@ void ObjectMgr::LoadGraveyardZones()
|
|||
uint32 team = fields[2].GetUInt32();
|
||||
|
||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId);
|
||||
if(!entry)
|
||||
if (!entry)
|
||||
{
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.",safeLocId);
|
||||
continue;
|
||||
}
|
||||
|
||||
AreaTableEntry const *areaEntry = GetAreaEntryByAreaID(zoneId);
|
||||
if(!areaEntry)
|
||||
if (!areaEntry)
|
||||
{
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` has record for not existing zone id (%u), skipped.",zoneId);
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` has record for not existing zone id (%u), skipped.", zoneId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(areaEntry->zone != 0)
|
||||
if (areaEntry->zone != 0)
|
||||
{
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` has record subzone id (%u) instead of zone, skipped.",zoneId);
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` has record subzone id (%u) instead of zone, skipped.", zoneId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(team!=0 && team!=HORDE && team!=ALLIANCE)
|
||||
if (team != TEAM_NONE && team != HORDE && team != ALLIANCE)
|
||||
{
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` has record for non player faction (%u), skipped.",team);
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` has record for non player faction (%u), skipped.", team);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!AddGraveYardLink(safeLocId,zoneId,team,false))
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId);
|
||||
if(!AddGraveYardLink(safeLocId, zoneId, Team(team), false))
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId);
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
|
@ -5939,7 +5939,7 @@ void ObjectMgr::LoadGraveyardZones()
|
|||
sLog.outString( ">> Loaded %u graveyard-zone links", count );
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team)
|
||||
WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, Team team)
|
||||
{
|
||||
// search for zone associated closest graveyard
|
||||
uint32 zoneId = sTerrainMgr.GetZoneId(MapId,x,y,z);
|
||||
|
|
@ -5955,7 +5955,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
|
|||
|
||||
if (bounds.first == bounds.second)
|
||||
{
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.",zoneId,team);
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, uint32(team));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -5987,7 +5987,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
|
|||
|
||||
// skip enemy faction graveyard
|
||||
// team == 0 case can be at call from .neargrave
|
||||
if(data.team != 0 && team != 0 && data.team != team)
|
||||
if (data.team != TEAM_NONE && team != TEAM_NONE && data.team != team)
|
||||
continue;
|
||||
|
||||
// find now nearest graveyard at other (continent) map
|
||||
|
|
@ -6065,7 +6065,7 @@ GraveYardData const* ObjectMgr::FindGraveYardData(uint32 id, uint32 zoneId) cons
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inDB)
|
||||
bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, Team team, bool inDB)
|
||||
{
|
||||
if(FindGraveYardData(id,zoneId))
|
||||
return false;
|
||||
|
|
@ -6081,7 +6081,7 @@ bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inD
|
|||
if(inDB)
|
||||
{
|
||||
WorldDatabase.PExecuteLog("INSERT INTO game_graveyard_zone ( id,ghost_zone,faction) "
|
||||
"VALUES ('%u', '%u','%u')",id,zoneId,team);
|
||||
"VALUES ('%u', '%u','%u')", id, zoneId, uint32(team));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -8235,7 +8235,7 @@ bool PlayerCondition::Meets(Player const * player) const
|
|||
return faction && player->GetReputationMgr().GetRank(faction) >= ReputationRank(value2);
|
||||
}
|
||||
case CONDITION_TEAM:
|
||||
return player->GetTeam() == value1;
|
||||
return uint32(player->GetTeam()) == value1;
|
||||
case CONDITION_SKILL:
|
||||
return player->HasSkill(value1) && player->GetBaseSkillValue(value1) >= value2;
|
||||
case CONDITION_QUESTREWARDED:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue