diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index e053706f4..9b7713813 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -148,14 +148,24 @@ void Networking::Update(RakNet::Packet *packet) } case ID_GAME_CELL: { - DEBUG_PRINTF("ID_GAME_CELL \n"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_CELL from %s\n", + player->Npc()->mName.c_str()); if (!player->CreatureStats()->mDead) { myPacket->Read(player); + + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Moved to %s\n", + player->GetCell()->getDescription().c_str()); + myPacket->Send(player, true); //send to other clients Script::Call(player->GetID()); } + else + { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Ignored because %s is dead\n", + player->Npc()->mName.c_str()); + } break; } diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 52dad0dd7..5e6121833 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -43,6 +43,8 @@ MWWorld::Ptr DedicatedPlayer::getPtr() void Players::CreatePlayer(RakNet::RakNetGUID id) { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Setting up character info\n"); + MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); @@ -72,6 +74,9 @@ void Players::CreatePlayer(RakNet::RakNetGUID id) if (_player->state == 0) { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Creating new reference pointer for %s\n", + _player->Npc()->mName.c_str()); + MWWorld::Ptr tmp = world->placeObject(_player->reference->getPtr(), cellStore, _pos); _player->ptr.mCell = tmp.mCell; @@ -82,6 +87,9 @@ void Players::CreatePlayer(RakNet::RakNetGUID id) } else { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Updating reference pointer for %s\n", + _player->Npc()->mName.c_str()); + _player->ptr.getBase()->canChangeCell = true; _player->UpdatePtr(world->moveObject(_player->ptr, cellStore, _pos.pos[0], _pos.pos[1], _pos.pos[2])); @@ -116,7 +124,7 @@ void Players::DisconnectPlayer(RakNet::RakNetGUID id) MWBase::World *world = MWBase::Environment::get().getWorld(); world->disable(players[id]->getPtr()); - //move player to toddTest + // Move player to ToddTest ESM::Position _pos; world->findInteriorPosition("ToddTest", _pos); MWWorld::CellStore *store = world->getInterior("ToddTest"); @@ -260,6 +268,9 @@ void DedicatedPlayer::UpdatePtr(MWWorld::Ptr newPtr) DedicatedPlayer *Players::NewPlayer(RakNet::RakNetGUID guid) { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Creating new DedicatedPlayer with guid %i\n", + guid.ToUint32); + players[guid] = new DedicatedPlayer(guid); players[guid]->state = 0; return players[guid]; @@ -421,8 +432,14 @@ void DedicatedPlayer::updateCell() cellStore = world->getInterior(cell.mName); // Go no further if cell data is invalid else + { + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Server sent invalid cell change info about %s (%s)!\n", + ptr.getBase()->mRef.getRefId().c_str(), + this->Npc()->mName.c_str()); + return; - + } + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server says %s (%s) moved to %s\n", ptr.getBase()->mRef.getRefId().c_str(), this->Npc()->mName.c_str(), diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index b6d364801..7b81938cd 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -130,6 +130,11 @@ void Networking::Connect(const std::string &ip, unsigned short port) connected = true; queue = false; + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONNECTION_REQUESTED_ACCEPTED from %s\n", + serverAddr.ToString()); + + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_GAME_BASE_INFO to server\n"); + GetPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer()); break;