diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 463f092f5..ddaa08315 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -3,23 +3,30 @@ // #include "DedicatedPlayer.hpp" -#include "../mwmechanics/aitravel.hpp" + #include "../mwbase/environment.hpp" #include "../mwstate/statemanagerimp.hpp" #include "../mwinput/inputmanagerimp.hpp" #include "../mwgui/windowmanagerimp.hpp" -#include "../mwworld/worldimp.hpp" -#include "../mwworld/player.hpp" -#include "../mwworld/customdata.hpp" + #include "../mwclass/npc.hpp" + #include "../mwmechanics/actor.hpp" +#include "../mwmechanics/aitravel.hpp" #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/mechanicsmanagerimp.hpp" -#include "../mwworld/cellstore.hpp" + #include "../mwworld/action.hpp" +#include "../mwworld/cellstore.hpp" +#include "../mwworld/customdata.hpp" +#include "../mwworld/player.hpp" +#include "../mwworld/worldimp.hpp" + #include "Main.hpp" #include "GUIController.hpp" +#include "WorldController.hpp" + #include "../mwworld/inventorystore.hpp" #include #include @@ -70,9 +77,10 @@ void Players::createPlayer(RakNet::RakNetGUID guid) dedicPlayer->reference = new MWWorld::ManualRef(world->getStore(), recid, 1); } - // Temporarily spawn or move player to exterior 0,0 whenever setting base info + // Temporarily spawn or move player to the center of exterior 0,0 whenever setting base info ESM::Position spawnPos; - spawnPos.pos[0] = spawnPos.pos[1] = spawnPos.pos[2] = 0; + spawnPos.pos[0] = spawnPos.pos[1] = Main::get().getWorldController()->getCellSize() / 2; + spawnPos.pos[2] = 0; MWWorld::CellStore *cellStore = world->getExterior(0, 0); if (dedicPlayer->state == 0) @@ -141,7 +149,8 @@ void Players::disconnectPlayer(RakNet::RakNetGUID guid) // Move player to exterior 0,0 ESM::Position newPos; - newPos.pos[0] = newPos.pos[1] = newPos.pos[2] = 0; + newPos.pos[0] = newPos.pos[1] = Main::get().getWorldController()->getCellSize() / 2; + newPos.pos[2] = 0; MWWorld::CellStore *cellStore = world->getExterior(0, 0); players[guid]->getPtr().getBase()->canChangeCell = true; diff --git a/apps/openmw/mwmp/WorldController.cpp b/apps/openmw/mwmp/WorldController.cpp index ffbb258ca..783bc19cc 100644 --- a/apps/openmw/mwmp/WorldController.cpp +++ b/apps/openmw/mwmp/WorldController.cpp @@ -20,6 +20,11 @@ mwmp::WorldController::~WorldController() } +int mwmp::WorldController::getCellSize() const +{ + return 8192; +} + MWWorld::CellStore *mwmp::WorldController::getCell(const ESM::Cell& cell) { MWWorld::CellStore *cellStore; diff --git a/apps/openmw/mwmp/WorldController.hpp b/apps/openmw/mwmp/WorldController.hpp index 3b05b55e9..7d055ac32 100644 --- a/apps/openmw/mwmp/WorldController.hpp +++ b/apps/openmw/mwmp/WorldController.hpp @@ -12,10 +12,12 @@ namespace mwmp WorldController(); ~WorldController(); + int getCellSize() const; + + virtual MWWorld::CellStore *getCell(const ESM::Cell& cell); + void openContainer(const MWWorld::Ptr& container, bool loot); void closeContainer(const MWWorld::Ptr& container); - - virtual MWWorld::CellStore *getCell(const ESM::Cell& cell); }; }