Core/Map:

- Remove mysterious restriction in visibilityhelper for gameobjects
- Some cleanup in CheckAreaExploreAndOutdoor() and GridDefines.h
- Set nocreate for cells visited in Map::VisitNearbyCellsOf
This commit is contained in:
kaelima
2012-03-12 04:33:24 +01:00
parent 8af0067016
commit 6217583627
4 changed files with 26 additions and 30 deletions
+12 -17
View File
@@ -6790,7 +6790,7 @@ void Player::CheckAreaExploreAndOutdoor()
if (sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK) && !isOutdoor) if (sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK) && !isOutdoor)
RemoveAurasWithAttribute(SPELL_ATTR0_OUTDOORS_ONLY); RemoveAurasWithAttribute(SPELL_ATTR0_OUTDOORS_ONLY);
if (areaFlag==0xffff) if (areaFlag == 0xffff)
return; return;
int offset = areaFlag / 32; int offset = areaFlag / 32;
@@ -6809,21 +6809,23 @@ void Player::CheckAreaExploreAndOutdoor()
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA);
AreaTableEntry const* p = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId()); AreaTableEntry const* areaEntry = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId());
if (!p) if (!areaEntry)
{ {
sLog->outError("PLAYER: Player %u discovered unknown area (x: %f y: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetMapId()); sLog->outError("Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId());
return;
} }
else if (p->area_level > 0)
if (areaEntry->area_level > 0)
{ {
uint32 area = p->ID; uint32 area = areaEntry->ID;
if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) if (getLevel() >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{ {
SendExplorationExperience(area, 0); SendExplorationExperience(area, 0);
} }
else else
{ {
int32 diff = int32(getLevel()) - p->area_level; int32 diff = int32(getLevel()) - areaEntry->area_level;
uint32 XP = 0; uint32 XP = 0;
if (diff < -5) if (diff < -5)
{ {
@@ -6837,17 +6839,17 @@ void Player::CheckAreaExploreAndOutdoor()
else if (exploration_percent < 0) else if (exploration_percent < 0)
exploration_percent = 0; exploration_percent = 0;
XP = uint32(sObjectMgr->GetBaseXP(p->area_level)*exploration_percent/100*sWorld->getRate(RATE_XP_EXPLORE)); XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level)*exploration_percent/100*sWorld->getRate(RATE_XP_EXPLORE));
} }
else else
{ {
XP = uint32(sObjectMgr->GetBaseXP(p->area_level)*sWorld->getRate(RATE_XP_EXPLORE)); XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level)*sWorld->getRate(RATE_XP_EXPLORE));
} }
GiveXP(XP, NULL); GiveXP(XP, NULL);
SendExplorationExperience(area, XP); SendExplorationExperience(area, XP);
} }
sLog->outDetail("PLAYER: Player %u discovered a new area: %u", GetGUIDLow(), area); sLog->outDetail("Player %u discovered a new area: %u", GetGUIDLow(), area);
} }
} }
} }
@@ -21464,13 +21466,6 @@ inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, T* target, std::set
s64.insert(target->GetGUID()); s64.insert(target->GetGUID());
} }
template<>
inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target, std::set<Unit*>& /*v*/)
{
if (!target->IsTransport())
s64.insert(target->GetGUID());
}
template<> template<>
inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, Creature* target, std::set<Unit*>& v) inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, Creature* target, std::set<Unit*>& v)
{ {
+2 -2
View File
@@ -178,8 +178,8 @@ namespace Trinity
double x_offset = (double(x) - center_offset)/size; double x_offset = (double(x) - center_offset)/size;
double y_offset = (double(y) - center_offset)/size; double y_offset = (double(y) - center_offset)/size;
int x_val = int(x_offset+CENTER_VAL + 0.5f); int x_val = int(x_offset + CENTER_VAL + 0.5f);
int y_val = int(y_offset+CENTER_VAL + 0.5f); int y_val = int(y_offset + CENTER_VAL + 0.5f);
return RET_TYPE(x_val, y_val); return RET_TYPE(x_val, y_val);
} }
@@ -120,7 +120,7 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u)
void PlayerRelocationNotifier::Visit(PlayerMapType &m) void PlayerRelocationNotifier::Visit(PlayerMapType &m)
{ {
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{ {
Player* player = iter->getSource(); Player* player = iter->getSource();
+4 -3
View File
@@ -493,6 +493,7 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::Obj
markCell(cell_id); markCell(cell_id);
CellCoord pair(x, y); CellCoord pair(x, y);
Cell cell(pair); Cell cell(pair);
cell.SetNoCreate();
Visit(cell, gridVisitor); Visit(cell, gridVisitor);
Visit(cell, worldVisitor); Visit(cell, worldVisitor);
} }
@@ -509,9 +510,9 @@ void Map::Update(const uint32 t_diff)
if (player && player->IsInWorld()) if (player && player->IsInWorld())
{ {
//player->Update(t_diff); //player->Update(t_diff);
WorldSession* pSession = player->GetSession(); WorldSession* session = player->GetSession();
MapSessionFilter updater(pSession); MapSessionFilter updater(session);
pSession->Update(t_diff, updater); session->Update(t_diff, updater);
} }
} }
/// update active cells around players and active objects /// update active cells around players and active objects