1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-21 18:09:39 +00:00

Add debug info about ID_GAME_BASE_INFO packets

This commit is contained in:
David Cernat 2016-08-17 21:18:04 +03:00
parent 8eda381016
commit e5cb58e7c4
3 changed files with 14 additions and 5 deletions

View file

@ -6,6 +6,7 @@
#include <RakPeer.h> #include <RakPeer.h>
#include <Kbhit.h> #include <Kbhit.h>
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#include <iostream> #include <iostream>
#include <Script/Script.hpp> #include <Script/Script.hpp>
#include <Script/API/TimerAPI.hpp> #include <Script/API/TimerAPI.hpp>
@ -118,7 +119,7 @@ void Networking::Update(RakNet::Packet *packet)
{ {
case ID_GAME_BASE_INFO: case ID_GAME_BASE_INFO:
{ {
DEBUG_PRINTF("ID_GAME_BASE_INFO\n"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_BASE_INFO about %s", player->Npc()->mName.c_str());
myPacket->Read(player); myPacket->Read(player);
myPacket->Send(player, true); myPacket->Send(player, true);

View file

@ -486,7 +486,7 @@ bool LocalPlayer::CharGenThread() // ToDo: need fix
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
(*Npc()) = *player.get<ESM::NPC>()->mBase; (*Npc()) = *player.get<ESM::NPC>()->mBase;
printf("Sending ID_GAME_BASE_INFO to server with my CharGen info"); printf("Sending ID_GAME_BASE_INFO to server with my CharGen info\n");
GetNetworking()->GetPacket(ID_GAME_BASE_INFO)->Send(this); GetNetworking()->GetPacket(ID_GAME_BASE_INFO)->Send(this);
if (CharGenStage()->end != 1) if (CharGenStage()->end != 1)

View file

@ -180,9 +180,12 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
} }
case ID_GAME_BASE_INFO: case ID_GAME_BASE_INFO:
{ {
printf("Received ID_GAME_BASE_INFO from server\n");
if (id == myid) if (id == myid)
{ {
cout << "TEST: " << packet->length << endl; printf("- Packet was about my id\n");
if (packet->length == myPacket->headerSize()) if (packet->length == myPacket->headerSize())
{ {
cout << "ID_GAME_BASE_INFO request only" << endl; cout << "ID_GAME_BASE_INFO request only" << endl;
@ -191,14 +194,19 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
else else
{ {
myPacket->Packet(&bsIn, getLocalPlayer(), false); myPacket->Packet(&bsIn, getLocalPlayer(), false);
cout << "ID_GAME_BASE_INFO" << endl; cout << "- Updating LocalPlayer" << endl;
getLocalPlayer()->updateChar(); getLocalPlayer()->updateChar();
} }
} }
else else
{ {
if (pl == 0) printf("- Packet was about %s\n", pl == 0 ? "new player" : pl->Npc()->mName.c_str());
if (pl == 0) {
printf("- Exchanging data with new player\n");
pl = Players::NewPlayer(id); pl = Players::NewPlayer(id);
}
myPacket->Packet(&bsIn, pl, false); myPacket->Packet(&bsIn, pl, false);
Players::CreatePlayer(id); Players::CreatePlayer(id);