1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 21:45:33 +00:00

Add additional log info

This commit is contained in:
David Cernat 2016-08-18 22:29:54 +03:00
parent 97f944dde7
commit f4744f8547
3 changed files with 35 additions and 3 deletions

View file

@ -148,14 +148,24 @@ void Networking::Update(RakNet::Packet *packet)
} }
case ID_GAME_CELL: 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) if (!player->CreatureStats()->mDead)
{ {
myPacket->Read(player); 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 myPacket->Send(player, true); //send to other clients
Script::Call<Script::CallbackIdentity("OnPlayerChangeCell")>(player->GetID()); Script::Call<Script::CallbackIdentity("OnPlayerChangeCell")>(player->GetID());
} }
else
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Ignored because %s is dead\n",
player->Npc()->mName.c_str());
}
break; break;
} }

View file

@ -43,6 +43,8 @@ MWWorld::Ptr DedicatedPlayer::getPtr()
void Players::CreatePlayer(RakNet::RakNetGUID id) void Players::CreatePlayer(RakNet::RakNetGUID id)
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Setting up character info\n");
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr(); MWWorld::Ptr player = world->getPlayerPtr();
@ -72,6 +74,9 @@ void Players::CreatePlayer(RakNet::RakNetGUID id)
if (_player->state == 0) 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); MWWorld::Ptr tmp = world->placeObject(_player->reference->getPtr(), cellStore, _pos);
_player->ptr.mCell = tmp.mCell; _player->ptr.mCell = tmp.mCell;
@ -82,6 +87,9 @@ void Players::CreatePlayer(RakNet::RakNetGUID id)
} }
else else
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Updating reference pointer for %s\n",
_player->Npc()->mName.c_str());
_player->ptr.getBase()->canChangeCell = true; _player->ptr.getBase()->canChangeCell = true;
_player->UpdatePtr(world->moveObject(_player->ptr, cellStore, _pos.pos[0], _pos.pos[1], _pos.pos[2])); _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(); MWBase::World *world = MWBase::Environment::get().getWorld();
world->disable(players[id]->getPtr()); world->disable(players[id]->getPtr());
//move player to toddTest // Move player to ToddTest
ESM::Position _pos; ESM::Position _pos;
world->findInteriorPosition("ToddTest", _pos); world->findInteriorPosition("ToddTest", _pos);
MWWorld::CellStore *store = world->getInterior("ToddTest"); MWWorld::CellStore *store = world->getInterior("ToddTest");
@ -260,6 +268,9 @@ void DedicatedPlayer::UpdatePtr(MWWorld::Ptr newPtr)
DedicatedPlayer *Players::NewPlayer(RakNet::RakNetGUID guid) 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] = new DedicatedPlayer(guid);
players[guid]->state = 0; players[guid]->state = 0;
return players[guid]; return players[guid];
@ -421,7 +432,13 @@ void DedicatedPlayer::updateCell()
cellStore = world->getInterior(cell.mName); cellStore = world->getInterior(cell.mName);
// Go no further if cell data is invalid // Go no further if cell data is invalid
else 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; return;
}
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server says %s (%s) moved to %s\n", LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server says %s (%s) moved to %s\n",
ptr.getBase()->mRef.getRefId().c_str(), ptr.getBase()->mRef.getRefId().c_str(),

View file

@ -130,6 +130,11 @@ void Networking::Connect(const std::string &ip, unsigned short port)
connected = true; connected = true;
queue = false; 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()); GetPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer());
break; break;