[11355] Use ArenaType enum instead raw values

* Drop duplicate ArenaTeamTypes
* Use enum type where appropriate
* More strict check integrity arena team data at loading.
This commit is contained in:
VladimirMangos 2011-04-15 03:13:23 +04:00
parent 6f8aa617d0
commit adcb84a325
12 changed files with 114 additions and 88 deletions

View file

@ -496,7 +496,10 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
return;
}
uint8 slot = ArenaTeam::GetSlotByType(type);
if (!IsArenaTypeValid(ArenaType(type)))
return;
uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type));
if(slot >= MAX_ARENA_SLOT)
return;
@ -647,7 +650,10 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
return;
}
uint8 slot = ArenaTeam::GetSlotByType(type);
if (!IsArenaTypeValid(ArenaType(type)))
return;
uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type));
if(slot >= MAX_ARENA_SLOT)
return;
@ -752,7 +758,10 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
}
else
{
uint8 slot = ArenaTeam::GetSlotByType(type);
if (!IsArenaTypeValid(ArenaType(type)))
return;
uint8 slot = ArenaTeam::GetSlotByType(ArenaType(type));
if (slot >= MAX_ARENA_SLOT)
return;
@ -844,7 +853,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
else // or arena team
{
ArenaTeam* at = new ArenaTeam;
if (!at->Create(_player->GetObjectGuid(), type, name))
if (!at->Create(_player->GetObjectGuid(), ArenaType(type), name))
{
sLog.outError("PetitionsHandler: arena team create failed.");
delete at;