|
|
|
@ -143,28 +143,36 @@ CellController::TContainer Player::getCells()
|
|
|
|
|
|
|
|
|
|
void Player::sendToNearest(mwmp::PlayerPacket *myPacket)
|
|
|
|
|
{
|
|
|
|
|
std::list <Player*> plList;
|
|
|
|
|
|
|
|
|
|
for(auto cell : getCells())
|
|
|
|
|
{
|
|
|
|
|
for(auto pl : *cell)
|
|
|
|
|
{
|
|
|
|
|
if(pl == this)
|
|
|
|
|
continue;
|
|
|
|
|
for (auto pl : *cell)
|
|
|
|
|
plList.push_back(pl);
|
|
|
|
|
|
|
|
|
|
myPacket->Send(this, pl->guid);
|
|
|
|
|
}
|
|
|
|
|
plList.sort();
|
|
|
|
|
plList.unique();
|
|
|
|
|
|
|
|
|
|
for(auto pl : plList)
|
|
|
|
|
{
|
|
|
|
|
if(pl == this) continue;
|
|
|
|
|
myPacket->Send(this, pl->guid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Player::doForNearest(std::function<void (Player *pl, Player *other)> func)
|
|
|
|
|
{
|
|
|
|
|
std::list <Player*> plList;
|
|
|
|
|
|
|
|
|
|
for(auto cell : getCells())
|
|
|
|
|
{
|
|
|
|
|
for(auto pl : *cell)
|
|
|
|
|
{
|
|
|
|
|
if(pl == this)
|
|
|
|
|
continue;
|
|
|
|
|
for (auto pl : *cell)
|
|
|
|
|
plList.push_back(pl);
|
|
|
|
|
|
|
|
|
|
func(this, pl);
|
|
|
|
|
}
|
|
|
|
|
plList.sort();
|
|
|
|
|
plList.unique();
|
|
|
|
|
|
|
|
|
|
for(auto pl : plList)
|
|
|
|
|
{
|
|
|
|
|
if(pl == this) continue;
|
|
|
|
|
func(this, pl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|