diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index d559f8f82..c00163510 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -170,6 +170,17 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) LOG_APPEND(Log::LOG_INFO, "- Moved to %s", player->cell.getDescription().c_str()); + player->doForNearest([this](Player *pl, Player *other){ + const RakNet::RakNetGUID &guid = pl->guid; + playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(other, guid); + playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(other, guid); + playerController->GetPacket(ID_PLAYER_SKILL)->Send(other, guid); + //playerController->GetPacket(ID_PLAYER_POS)->Send(pl, guid); + playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(other, guid); + playerController->GetPacket(ID_PLAYER_ATTACK)->Send(other, guid); + playerController->GetPacket(ID_PLAYER_DRAWSTATE)->Send(other, guid); + }); + myPacket->Send(player, true); //send to other clients Script::Call(player->getId()); } diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 17302d90c..d69c34548 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -154,3 +154,17 @@ void Player::sendToNearest(mwmp::PlayerPacket *myPacket) } } } + +void Player::doForNearest(std::function func) +{ + for(auto cell : getCells()) + { + for(auto pl : *cell) + { + if(pl == this) + continue; + + func(this, pl); + } + } +} diff --git a/apps/openmw-mp/Player.hpp b/apps/openmw-mp/Player.hpp index b3f9b4346..ebfb084be 100644 --- a/apps/openmw-mp/Player.hpp +++ b/apps/openmw-mp/Player.hpp @@ -73,6 +73,8 @@ public: CellController::TContainer getCells(); void sendToNearest(mwmp::PlayerPacket *myPacket); + void doForNearest(std::function func); + public: mwmp::InventoryChanges inventoryChangesBuffer; mwmp::SpellbookChanges spellbookChangesBuffer;