[10113] Some cleanups in Instance loading code.

* Remove reduncent chekc and args for MapInstanced::CreateInstance(const uint32 mapId, Player * player)
* Rename for avoid name duplication raw InstanceMap creating to MapInstanced::CreateInstanceMap
* Move lookup code of player/group bounde instance save to Player::GetBoundInstanceSaveForSelfOrGroup
This commit is contained in:
VladimirMangos 2010-06-27 19:26:35 +04:00
parent 3eb2d2910e
commit 6f4481a591
6 changed files with 50 additions and 45 deletions

View file

@ -16423,6 +16423,29 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, b
return NULL;
}
InstanceSave* Player::GetBoundInstanceSaveForSelfOrGroup(uint32 mapid)
{
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
if(!mapEntry)
return NULL;
InstancePlayerBind *pBind = GetBoundInstance(mapid, GetDifficulty(mapEntry->IsRaid()));
InstanceSave *pSave = pBind ? pBind->save : NULL;
// the player's permanent player bind is taken into consideration first
// then the player's group bind and finally the solo bind.
if(!pBind || !pBind->perm)
{
InstanceGroupBind *groupBind = NULL;
Group *group = GetGroup();
// use the player's difficulty setting (it may not be the same as the group's)
if(group && (groupBind = group->GetBoundInstance(this)))
pSave = groupBind->save;
}
return pSave;
}
void Player::SendRaidInfo()
{
uint32 counter = 0;