mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +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
|
|
@ -203,7 +203,7 @@ void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all )
|
|||
}
|
||||
}
|
||||
|
||||
bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values, uint32 team )
|
||||
bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team team)
|
||||
{
|
||||
ClearTaxiDestinations();
|
||||
|
||||
|
|
@ -226,13 +226,13 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values, uint
|
|||
{
|
||||
uint32 cost;
|
||||
uint32 path;
|
||||
sObjectMgr.GetTaxiPath(m_TaxiDestinations[i-1],m_TaxiDestinations[i],path,cost);
|
||||
if(!path)
|
||||
sObjectMgr.GetTaxiPath(m_TaxiDestinations[i-1],m_TaxiDestinations[i], path, cost);
|
||||
if (!path)
|
||||
return false;
|
||||
}
|
||||
|
||||
// can't load taxi path without mount set (quest taxi path?)
|
||||
if(!sObjectMgr.GetTaxiMountDisplayId(GetTaxiSource(),team,true))
|
||||
if (!sObjectMgr.GetTaxiMountDisplayId(GetTaxiSource(), team, true))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -6205,10 +6205,10 @@ void Player::CheckAreaExploreAndOutdoor()
|
|||
}
|
||||
}
|
||||
|
||||
uint32 Player::TeamForRace(uint8 race)
|
||||
Team Player::TeamForRace(uint8 race)
|
||||
{
|
||||
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race);
|
||||
if(!rEntry)
|
||||
if (!rEntry)
|
||||
{
|
||||
sLog.outError("Race %u not found in DBC: wrong DBC files?",uint32(race));
|
||||
return ALLIANCE;
|
||||
|
|
@ -6221,7 +6221,7 @@ uint32 Player::TeamForRace(uint8 race)
|
|||
}
|
||||
|
||||
sLog.outError("Race %u have wrong teamid %u in DBC: wrong DBC files?",uint32(race),rEntry->TeamID);
|
||||
return ALLIANCE;
|
||||
return TEAM_NONE;
|
||||
}
|
||||
|
||||
uint32 Player::getFactionForRace(uint8 race)
|
||||
|
|
@ -6239,7 +6239,7 @@ uint32 Player::getFactionForRace(uint8 race)
|
|||
void Player::setFactionForRace(uint8 race)
|
||||
{
|
||||
m_team = TeamForRace(race);
|
||||
setFaction( getFactionForRace(race) );
|
||||
setFaction(getFactionForRace(race));
|
||||
}
|
||||
|
||||
ReputationRank Player::GetReputationRank(uint32 faction) const
|
||||
|
|
@ -15022,7 +15022,7 @@ void Player::_LoadBGData(QueryResult* result)
|
|||
Field *fields = result->Fetch();
|
||||
/* bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */
|
||||
m_bgData.bgInstanceID = fields[0].GetUInt32();
|
||||
m_bgData.bgTeam = fields[1].GetUInt32();
|
||||
m_bgData.bgTeam = Team(fields[1].GetUInt32());
|
||||
m_bgData.joinPos = WorldLocation(fields[6].GetUInt32(), // Map
|
||||
fields[2].GetFloat(), // X
|
||||
fields[3].GetFloat(), // Y
|
||||
|
|
@ -15537,20 +15537,20 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
SetUInt32Value(PLAYER_CHOSEN_TITLE, curTitle);
|
||||
|
||||
// Not finish taxi flight path
|
||||
if(m_bgData.HasTaxiPath())
|
||||
if (m_bgData.HasTaxiPath())
|
||||
{
|
||||
m_taxi.ClearTaxiDestinations();
|
||||
for (int i = 0; i < 2; ++i)
|
||||
m_taxi.AddTaxiDestination(m_bgData.taxiPath[i]);
|
||||
}
|
||||
else if(!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes,GetTeam()))
|
||||
else if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeam()))
|
||||
{
|
||||
// problems with taxi path loading
|
||||
TaxiNodesEntry const* nodeEntry = NULL;
|
||||
if(uint32 node_id = m_taxi.GetTaxiSource())
|
||||
if (uint32 node_id = m_taxi.GetTaxiSource())
|
||||
nodeEntry = sTaxiNodesStore.LookupEntry(node_id);
|
||||
|
||||
if(!nodeEntry) // don't know taxi start node, to homebind
|
||||
if (!nodeEntry) // don't know taxi start node, to homebind
|
||||
{
|
||||
sLog.outError("Character %u have wrong data in taxi destination list, teleport to homebind.",GetGUIDLow());
|
||||
RelocateToHomebind();
|
||||
|
|
@ -18488,7 +18488,7 @@ void Player::ContinueTaxiFlight()
|
|||
|
||||
DEBUG_LOG( "WORLD: Restart character %u taxi flight", GetGUIDLow() );
|
||||
|
||||
uint32 mountDisplayId = sObjectMgr.GetTaxiMountDisplayId(sourceNode, GetTeam(),true);
|
||||
uint32 mountDisplayId = sObjectMgr.GetTaxiMountDisplayId(sourceNode, GetTeam(), true);
|
||||
uint32 path = m_taxi.GetCurrentTaxiPath();
|
||||
|
||||
// search appropriate start path node
|
||||
|
|
@ -22118,7 +22118,7 @@ void Player::_SaveBGData()
|
|||
{
|
||||
/* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */
|
||||
CharacterDatabase.PExecute("INSERT INTO character_battleground_data VALUES ('%u', '%u', '%u', '%f', '%f', '%f', '%f', '%u', '%u', '%u', '%u')",
|
||||
GetGUIDLow(), m_bgData.bgInstanceID, m_bgData.bgTeam, m_bgData.joinPos.coord_x, m_bgData.joinPos.coord_y, m_bgData.joinPos.coord_z,
|
||||
GetGUIDLow(), m_bgData.bgInstanceID, uint32(m_bgData.bgTeam), m_bgData.joinPos.coord_x, m_bgData.joinPos.coord_y, m_bgData.joinPos.coord_z,
|
||||
m_bgData.joinPos.orientation, m_bgData.joinPos.mapid, m_bgData.taxiPath[0], m_bgData.taxiPath[1], m_bgData.mountSpell);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue