mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Ignore packets from server that try to move LocalPlayer to invalid cells
This commit is contained in:
parent
dc9b814ff6
commit
f7b5e5e638
2 changed files with 27 additions and 6 deletions
|
@ -36,6 +36,7 @@ LocalPlayer::LocalPlayer()
|
||||||
CharGenStage()->current = 0;
|
CharGenStage()->current = 0;
|
||||||
CharGenStage()->end = 1;
|
CharGenStage()->end = 1;
|
||||||
consoleAllowed = true;
|
consoleAllowed = true;
|
||||||
|
ignorePosPacket = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPlayer::~LocalPlayer()
|
LocalPlayer::~LocalPlayer()
|
||||||
|
@ -74,7 +75,7 @@ void LocalPlayer::charGen(int stageFirst, int stageEnd)
|
||||||
CharGenStage()->end = stageEnd;
|
CharGenStage()->end = stageEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalPlayer::charGenThread() // todo: need fix
|
bool LocalPlayer::charGenThread()
|
||||||
{
|
{
|
||||||
MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
|
MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
|
||||||
|
|
||||||
|
@ -688,9 +689,18 @@ void LocalPlayer::setPosition()
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
MWWorld::Ptr player = world->getPlayerPtr();
|
MWWorld::Ptr player = world->getPlayerPtr();
|
||||||
|
|
||||||
|
// If we're ignoring this position packet because of an invalid cell change,
|
||||||
|
// don't make the next one get ignored as well
|
||||||
|
if (ignorePosPacket)
|
||||||
|
{
|
||||||
|
ignorePosPacket = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
world->getPlayer().setTeleported(true);
|
world->getPlayer().setTeleported(true);
|
||||||
world->moveObject(player, Position()->pos[0], Position()->pos[1], Position()->pos[2]);
|
world->moveObject(player, Position()->pos[0], Position()->pos[1], Position()->pos[2]);
|
||||||
world->rotateObject(player, Position()->rot[0], Position()->rot[1], Position()->rot[2]);
|
world->rotateObject(player, Position()->rot[0], Position()->rot[1], Position()->rot[2]);
|
||||||
|
}
|
||||||
|
|
||||||
updatePosition(true);
|
updatePosition(true);
|
||||||
}
|
}
|
||||||
|
@ -722,10 +732,20 @@ void LocalPlayer::setCell()
|
||||||
world->fixPosition(player);
|
world->fixPosition(player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
world->findInteriorPosition(GetCell()->mName, pos);
|
world->findInteriorPosition(GetCell()->mName, pos);
|
||||||
world->changeToInteriorCell(GetCell()->mName, pos, true);
|
world->changeToInteriorCell(GetCell()->mName, pos, true);
|
||||||
}
|
}
|
||||||
|
// If we've been sent to an invalid interior, ignore the incoming
|
||||||
|
// packet about our position in that cell
|
||||||
|
catch (std::exception&)
|
||||||
|
{
|
||||||
|
LOG_APPEND(Log::LOG_INFO, "%s", "- Cell doesn't exist on this client");
|
||||||
|
ignorePosPacket = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateCell(true);
|
updateCell(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,6 +175,7 @@ namespace mwmp
|
||||||
double hour;
|
double hour;
|
||||||
Inventory inventory;
|
Inventory inventory;
|
||||||
bool consoleAllowed;
|
bool consoleAllowed;
|
||||||
|
bool ignorePosPacket;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
|
|
Loading…
Reference in a new issue