[Client] Send ID_PLAYER_CELL_STATE to server at end of CharGen

Also, allow requests for ID_PLAYER_CELL_STATE from the server.
pull/163/head
David Cernat 8 years ago
parent 44e27148d5
commit a2e3fe18fe

@ -139,6 +139,8 @@ bool LocalPlayer::charGenThread()
getNetworking()->getPlayerPacket(ID_GAME_CHARGEN)->Send(this); getNetworking()->getPlayerPacket(ID_GAME_CHARGEN)->Send(this);
} }
sendCellStates();
// Set the last stage variable to 0 to indicate that CharGen is finished // Set the last stage variable to 0 to indicate that CharGen is finished
charGenStage.end = 0; charGenStage.end = 0;
} }
@ -1003,6 +1005,7 @@ void LocalPlayer::sendSpellbook()
void LocalPlayer::sendCellStates() void LocalPlayer::sendCellStates()
{ {
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_CELL_STATE)->Send(this); Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_CELL_STATE)->Send(this);
} }
void LocalPlayer::sendSpellAddition(std::string id) void LocalPlayer::sendSpellAddition(std::string id)

@ -530,6 +530,12 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
} }
case ID_PLAYER_CELL_STATE: case ID_PLAYER_CELL_STATE:
{ {
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
getLocalPlayer()->sendCellStates();
}
break; break;
} }
case ID_GAME_DRAWSTATE: case ID_GAME_DRAWSTATE:

@ -354,9 +354,6 @@ namespace MWWorld
void Scene::changeCellGrid (int X, int Y, bool changeEvent) void Scene::changeCellGrid (int X, int Y, bool changeEvent)
{ {
// Added by tes3mp
mwmp::Main::get().getLocalPlayer()->clearCellStates();
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen(); Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
Loading::ScopedLoad load(loadingListener); Loading::ScopedLoad load(loadingListener);
@ -436,7 +433,10 @@ namespace MWWorld
// Added by tes3mp // Added by tes3mp
if (mwmp::Main::get().getLocalPlayer()->hasFinishedCharGen()) if (mwmp::Main::get().getLocalPlayer()->hasFinishedCharGen())
{
mwmp::Main::get().getLocalPlayer()->sendCellStates(); mwmp::Main::get().getLocalPlayer()->sendCellStates();
mwmp::Main::get().getLocalPlayer()->clearCellStates();
}
CellStore* current = MWBase::Environment::get().getWorld()->getExterior(X,Y); CellStore* current = MWBase::Environment::get().getWorld()->getExterior(X,Y);
MWBase::Environment::get().getWindowManager()->changeCell(current); MWBase::Environment::get().getWindowManager()->changeCell(current);
@ -518,9 +518,6 @@ namespace MWWorld
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent) void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent)
{ {
// Added by tes3mp
mwmp::Main::get().getLocalPlayer()->clearCellStates();
CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName); CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName);
bool loadcell = (mCurrentCell == NULL); bool loadcell = (mCurrentCell == NULL);
if(!loadcell) if(!loadcell)
@ -570,7 +567,10 @@ namespace MWWorld
// Added by tes3mp // Added by tes3mp
if (mwmp::Main::get().getLocalPlayer()->hasFinishedCharGen()) if (mwmp::Main::get().getLocalPlayer()->hasFinishedCharGen())
{
mwmp::Main::get().getLocalPlayer()->sendCellStates(); mwmp::Main::get().getLocalPlayer()->sendCellStates();
mwmp::Main::get().getLocalPlayer()->clearCellStates();
}
changePlayerCell(cell, position, adjustPlayerPos); changePlayerCell(cell, position, adjustPlayerPos);

Loading…
Cancel
Save