forked from teamnwah/openmw-tes3coop
[Client] Send all NPC data to newly arriving players
This commit is contained in:
parent
15f91e7825
commit
9852076590
2 changed files with 14 additions and 5 deletions
|
@ -2,7 +2,8 @@
|
||||||
// Created by koncord on 02.01.16.
|
// Created by koncord on 02.01.16.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "DedicatedPlayer.hpp"
|
#include <boost/algorithm/clamp.hpp>
|
||||||
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
|
@ -24,16 +25,16 @@
|
||||||
#include "../mwworld/action.hpp"
|
#include "../mwworld/action.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/customdata.hpp"
|
#include "../mwworld/customdata.hpp"
|
||||||
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwworld/worldimp.hpp"
|
#include "../mwworld/worldimp.hpp"
|
||||||
|
|
||||||
|
#include "DedicatedPlayer.hpp"
|
||||||
#include "Main.hpp"
|
#include "Main.hpp"
|
||||||
#include "GUIController.hpp"
|
#include "GUIController.hpp"
|
||||||
#include "CellController.hpp"
|
#include "CellController.hpp"
|
||||||
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
|
||||||
#include <boost/algorithm/clamp.hpp>
|
|
||||||
#include <components/openmw-mp/Log.hpp>
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -495,6 +496,14 @@ void DedicatedPlayer::updateCell()
|
||||||
// update has been called
|
// update has been called
|
||||||
ptr.getBase()->canChangeCell = true;
|
ptr.getBase()->canChangeCell = true;
|
||||||
updatePtr(world->moveObject(ptr, cellStore, position.pos[0], position.pos[1], position.pos[2]));
|
updatePtr(world->moveObject(ptr, cellStore, position.pos[0], position.pos[1], position.pos[2]));
|
||||||
|
|
||||||
|
// If this player is now in a cell that is active for us, we should send them all
|
||||||
|
// NPC data in that cell
|
||||||
|
if (MWBase::Environment::get().getWorld()->isCellActive(cellStore))
|
||||||
|
{
|
||||||
|
if (Main::get().getCellController()->isActiveCell(cell))
|
||||||
|
Main::get().getCellController()->getCell(cell)->updateLocal(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ void LocalActor::updatePosition(bool forceUpdate)
|
||||||
bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 || direction.pos[2] != 0 ||
|
bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 || direction.pos[2] != 0 ||
|
||||||
direction.rot[0] != 0 || direction.rot[1] != 0 || direction.rot[2] != 0);
|
direction.rot[0] != 0 || direction.rot[1] != 0 || direction.rot[2] != 0);
|
||||||
|
|
||||||
if (posIsChanging || posWasChanged)
|
if (posIsChanging || posWasChanged || forceUpdate)
|
||||||
{
|
{
|
||||||
posWasChanged = posIsChanging;
|
posWasChanged = posIsChanging;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue