Backed out changeset 09d9acdcaed4

Sorry for the inconvenience. Part of this push was an untested patch that was miss pushed

--HG--
branch : trunk
This commit is contained in:
tartalo
2009-10-22 01:54:14 +02:00
parent 2d713bbc70
commit 46c411b778
2 changed files with 3 additions and 44 deletions
-39
View File
@@ -30,7 +30,6 @@
#include "Transports.h" #include "Transports.h"
#include "GridDefines.h" #include "GridDefines.h"
#include "MapInstanced.h" #include "MapInstanced.h"
#include "InstanceData.h"
#include "DestinationHolderImp.h" #include "DestinationHolderImp.h"
#include "World.h" #include "World.h"
#include "CellImpl.h" #include "CellImpl.h"
@@ -230,49 +229,11 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
} }
} }
//Get instance where player is bound
InstancePlayerBind* boundedInstance = player->GetBoundInstance(mapid, player->GetDifficulty());
Map *boundedMap;
//Search player's instance map
for(MapMapType::iterator itr = i_maps.find(mapid); itr != i_maps.end(); )
{
Map *map = itr->second;
if(!map->Instanceable())
break;
MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps();
for(MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
if (boundedInstance->save->GetInstanceId() == mitr->first)
boundedMap = map;
}
//Encounters in progress
if (boundedMap && ((InstanceMap*)boundedMap)->GetInstanceData() && ((InstanceMap*)boundedMap)->GetInstanceData()->IsEncounterInProgress())
{
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' while an encounter is in progress.", player->GetName(), mapName);
player->SendTransferAborted(mapid, TRANSFER_ABORT_ZONE_IN_COMBAT);
return(false);
}
// Requirements // Requirements
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(mapid); InstanceTemplate const* instance = objmgr.GetInstanceTemplate(mapid);
if(!instance) if(!instance)
return false; return false;
//Instance is full
if (boundedMap)
{
Map::PlayerList const &players = boundedMap->GetPlayers();
uint8 count = 0;
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
++count;
if (count == player->GetDifficulty() ? instance->maxPlayersHeroic : instance->maxPlayers)
{
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' because it's full.", player->GetName(), mapName);
player->SendTransferAborted(mapid, TRANSFER_ABORT_MAX_PLAYERS);
return(false);
}
}
return player->Satisfy(objmgr.GetAccessRequirement(instance->access_id), mapid, true); return player->Satisfy(objmgr.GetAccessRequirement(instance->access_id), mapid, true);
} }
else else
+3 -5
View File
@@ -19466,8 +19466,6 @@ void Player::SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg)
case TRANSFER_ABORT_INSUF_EXPAN_LVL: case TRANSFER_ABORT_INSUF_EXPAN_LVL:
case TRANSFER_ABORT_DIFFICULTY: case TRANSFER_ABORT_DIFFICULTY:
case TRANSFER_ABORT_UNIQUE_MESSAGE: case TRANSFER_ABORT_UNIQUE_MESSAGE:
case TRANSFER_ABORT_ZONE_IN_COMBAT:
case TRANSFER_ABORT_MAX_PLAYERS:
data << uint8(arg); data << uint8(arg);
break; break;
} }
@@ -20291,9 +20289,9 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource) void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource)
{ {
if (!pRewardSource || pRewardSource->GetTypeId() != TYPEID_UNIT) if (!pRewardSource)
return; return;
uint64 creature_guid = pRewardSource->GetGUID(); uint64 creature_guid = (pRewardSource && pRewardSource->GetTypeId()==TYPEID_UNIT) ? pRewardSource->GetGUID() : uint64(0);
// prepare data for near group iteration // prepare data for near group iteration
if(Group *pGroup = GetGroup()) if(Group *pGroup = GetGroup())
@@ -20319,7 +20317,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const
{ {
if (!pRewardSource) if (!pRewardSource)
return false; return;
const WorldObject* player = GetCorpse(); const WorldObject* player = GetCorpse();
if(!player || isAlive()) if(!player || isAlive())
player = this; player = this;