mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[6865] Improve db access in guild and arena team code.
Note: Using SetUInt32ValueInDB() is still not safe, because it's executed async. Three possible solutions: 1) remove data field 2) get rid of SetUInt32ValueInDB() calls (probably not possible) 3) make SaveValuesArrayInDB() executed directly
This commit is contained in:
parent
d0ea9cbb23
commit
1ad9adc467
4 changed files with 29 additions and 16 deletions
|
|
@ -138,19 +138,23 @@ bool ArenaTeam::AddMember(uint64 PlayerGuid)
|
|||
{
|
||||
pl->SetInArenaTeam(Id, GetSlot());
|
||||
pl->SetArenaTeamIdInvited(0);
|
||||
|
||||
// hide promote/remove buttons
|
||||
if(CaptainGuid != PlayerGuid)
|
||||
pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Player::SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6), Id, PlayerGuid);
|
||||
}
|
||||
Tokens tokens;
|
||||
if(Player::LoadValuesArrayFromDB(tokens,PlayerGuid))
|
||||
{
|
||||
Player::SetUInt32ValueInArray(tokens,PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * 6), Id);
|
||||
// hide promote/remove buttons
|
||||
if(CaptainGuid != PlayerGuid)
|
||||
Player::SetUInt32ValueInArray(tokens,PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 1);
|
||||
|
||||
// hide promote/remove buttons
|
||||
if(CaptainGuid != PlayerGuid)
|
||||
{
|
||||
if(pl)
|
||||
pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 1);
|
||||
else
|
||||
Player::SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 + (GetSlot() * 6), 1, PlayerGuid);
|
||||
Player::SaveValuesArrayInDB(tokens,PlayerGuid);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue