[Client] Spawn DedicatedPlayer in center of exterior cell 0,0

pull/183/merge
David Cernat 8 years ago
parent 684517e02f
commit 8c8414f098

@ -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 <boost/algorithm/clamp.hpp>
#include <components/openmw-mp/Log.hpp>
@ -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;

@ -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;

@ -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);
};
}

Loading…
Cancel
Save