From 578c9c4694344cb6e7c0e820f0687c98d3d5402d Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 23 Sep 2012 16:25:32 +0000 Subject: Tweaked logging. Less output for UI. More output for player pos confirming (FS #245) and for player spawning git-svn-id: http://mc-server.googlecode.com/svn/trunk@875 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol125.cpp | 7 ----- source/UI/SlotArea.cpp | 10 +++---- source/UI/cWindow.cpp | 5 ---- source/cClientHandle.cpp | 6 ++++ source/cClientHandle.h | 74 +++++++++++++++++++++++------------------------ source/cFurnaceEntity.cpp | 2 -- 6 files changed, 48 insertions(+), 56 deletions(-) (limited to 'source') diff --git a/source/Protocol125.cpp b/source/Protocol125.cpp index f9a13668b..09e422c48 100644 --- a/source/Protocol125.cpp +++ b/source/Protocol125.cpp @@ -752,10 +752,6 @@ void cProtocol125::SendWindowClose(char a_WindowID) void cProtocol125::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) { - LOGD("Sending a WindowOpen packet: ID = %d, Type = %d, Title = \"%s\", NumSlots = %d", - a_WindowID, a_WindowType, a_WindowTitle.c_str(), a_NumSlots - ); - if (a_WindowType < 0) { // Do not send for inventory windows @@ -1256,9 +1252,6 @@ void cProtocol125::SendPreChunk(int a_ChunkX, int a_ChunkZ, bool a_ShouldLoad) void cProtocol125::SendWindowSlots(char a_WindowID, int a_NumItems, const cItem * a_Items) { - LOGD("Sending a InventoryWhole packet: WindowID = %d, NumItems = %d", - a_WindowID, a_NumItems - ); WriteByte (PACKET_INVENTORY_WHOLE); WriteByte (a_WindowID); WriteShort((short)a_NumItems); diff --git a/source/UI/SlotArea.cpp b/source/UI/SlotArea.cpp index d7a77bd6e..6da0a15b8 100644 --- a/source/UI/SlotArea.cpp +++ b/source/UI/SlotArea.cpp @@ -24,7 +24,6 @@ cSlotArea::cSlotArea(int a_NumSlots, cWindow & a_ParentWindow) : m_NumSlots(a_NumSlots), m_ParentWindow(a_ParentWindow) { - LOGD("Created a new cSlotArea with %d slots", a_NumSlots); } @@ -33,11 +32,13 @@ cSlotArea::cSlotArea(int a_NumSlots, cWindow & a_ParentWindow) : void cSlotArea::Clicked(cPlayer & a_Player, int a_SlotNum, bool a_IsRightClick, bool a_IsShiftPressed, const cItem & a_ClickedItem) { + /* LOGD("Slot area with %d slots clicked at slot number %d, clicked item %s, slot item %s", GetNumSlots(), a_SlotNum, ItemToFullString(a_ClickedItem).c_str(), ItemToFullString(*GetSlot(a_SlotNum, a_Player)).c_str() ); + */ ASSERT((a_SlotNum >= 0) && (a_SlotNum < GetNumSlots())); @@ -62,10 +63,9 @@ void cSlotArea::Clicked(cPlayer & a_Player, int a_SlotNum, bool a_IsRightClick, cItem Slot(*GetSlot(a_SlotNum, a_Player)); if (!Slot.IsEqual(a_ClickedItem)) { - LOGD("*** Window lost sync ***"); - LOGD("My Type: %i Their Type: %i", Slot.m_ItemID, a_ClickedItem.m_ItemID); - LOGD("My Count: %i Their Count: %i", Slot.m_ItemCount, a_ClickedItem.m_ItemCount); - LOGD("My Dmg: %i Their Dmg: %i", Slot.m_ItemHealth, a_ClickedItem.m_ItemHealth); + LOGD("*** Window lost sync at item %d in SlotArea with %d items ***", a_SlotNum, m_NumSlots); + LOGD("My item: %s", ItemToFullString(Slot).c_str()); + LOGD("Their item: %s", ItemToFullString(a_ClickedItem).c_str()); bAsync = true; } cItem & DraggingItem = a_Player.GetDraggingItem(); diff --git a/source/UI/cWindow.cpp b/source/UI/cWindow.cpp index 7efbfaa5e..bd6724751 100644 --- a/source/UI/cWindow.cpp +++ b/source/UI/cWindow.cpp @@ -33,9 +33,6 @@ cWindow::cWindow(cWindow::WindowType a_WindowType, const AString & a_WindowTitle { m_WindowID = 0; } - LOGD("Created a window at %p, type = %d, ID = %i, title = \"%s\".", - this, m_WindowType, m_WindowID, m_WindowTitle.c_str() - ); } @@ -44,7 +41,6 @@ cWindow::cWindow(cWindow::WindowType a_WindowType, const AString & a_WindowTitle cWindow::~cWindow() { - LOGD("Deleted a window at %p", this); } @@ -325,7 +321,6 @@ void cWindow::SendSlot(cPlayer & a_Player, cSlotArea * a_SlotArea, int a_Relativ void cWindow::Destroy(void) { - LOGD("Destroying window %p (type %d)", this, m_WindowType); if (m_Owner != NULL) { m_Owner->CloseWindow(); diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 7108c7711..f13be381b 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -782,6 +782,8 @@ void cClientHandle::HandlePlayerMoveLook(double a_PosX, double a_PosY, double a_ else { LOGWARNING("Player \"%s\" sent a weird position confirmation %.2f blocks away, retrying", m_Username.c_str(), sqrt(Dist)); + LOGD(" Expected pos: {%0.2f, %0.2f, %0.2f}", m_ConfirmPosition.x, m_ConfirmPosition.y, m_ConfirmPosition.z); + LOGD(" Received pos: {%0.2f, %0.2f, %0.2f}", a_PosX, a_PosY, a_PosZ); m_ConfirmPosition = m_Player->GetPosition(); SendPlayerMoveLook(); } @@ -1305,6 +1307,10 @@ void cClientHandle::SendPlayerSpawn(const cPlayer & a_Player) return; } + LOG("Spawning player \"%s\" on client \"%s\" @ %s", + a_Player.GetName().c_str(), GetPlayer()->GetName().c_str(), GetIPString().c_str() + ); + m_Protocol->SendPlayerSpawn(a_Player); } diff --git a/source/cClientHandle.h b/source/cClientHandle.h index 4668a2aa8..78c6a1289 100644 --- a/source/cClientHandle.h +++ b/source/cClientHandle.h @@ -75,44 +75,44 @@ public: bool IsPlaying(void) const {return (m_State == csPlaying); } - void SendDisconnect(const AString & a_Reason); - void SendInventorySlot(char a_WindowID, short a_SlotNum, const cItem & a_Item); - void SendChat(const AString & a_Message); - void SendPlayerAnimation(const cPlayer & a_Player, char a_Animation); - void SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item); - void SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots); - void SendWindowClose(char a_WindowID); - void SendWholeInventory(const cInventory & a_Inventory); - void SendWholeInventory(const cWindow & a_Window); - void SendTeleportEntity(const cEntity & a_Entity); - void SendPlayerListItem(const cPlayer & a_Player, bool a_IsOnline); - void SendPlayerPosition(void); - void SendEntRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ); - void SendEntRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ); - void SendEntLook (const cEntity & a_Entity); - void SendEntHeadLook (const cEntity & a_Entity); - void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType); - void SendHealth (void); - void SendRespawn(void); - void SendGameMode(eGameMode a_GameMode); - void SendDestroyEntity(const cEntity & a_Entity); - void SendPlayerMoveLook(void); - void SendEntityStatus(const cEntity & a_Entity, char a_Status); - void SendMetadata(const cPawn & a_Entity); + void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType); + void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); + void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes); + void SendChat (const AString & a_Message); + void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer); + void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player); + void SendDestroyEntity (const cEntity & a_Entity); + void SendDisconnect (const AString & a_Reason); + void SendEntHeadLook (const cEntity & a_Entity); + void SendEntLook (const cEntity & a_Entity); + void SendEntRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ); + void SendEntRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ); + void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item); + void SendEntityStatus (const cEntity & a_Entity, char a_Status); + void SendGameMode (eGameMode a_GameMode); + void SendHealth (void); void SendInventoryProgress(char a_WindowID, short a_Progressbar, short a_Value); - void SendPlayerSpawn(const cPlayer & a_Player); - void SendPickupSpawn(const cPickup & a_Pickup); - void SendSpawnMob (const cMonster & a_Mob); - void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); - void SendCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player); - void SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - void SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes); - void SendUnloadChunk(int a_ChunkX, int a_ChunkZ); - void SendWeather(eWeather a_Weather); - void SendTimeUpdate(Int64 a_WorldTime); - void SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ); - void SendSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch); // a_Src coords are Block * 8 - void SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer); + void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item); + void SendMetadata (const cPawn & a_Entity); + void SendPickupSpawn (const cPickup & a_Pickup); + void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation); + void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline); + void SendPlayerMoveLook (void); + void SendPlayerPosition (void); + void SendPlayerSpawn (const cPlayer & a_Player); + void SendRespawn (void); + void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch); // a_Src coords are Block * 8 + void SendSpawnMob (const cMonster & a_Mob); + void SendTeleportEntity (const cEntity & a_Entity); + void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ); + void SendTimeUpdate (Int64 a_WorldTime); + void SendUnloadChunk (int a_ChunkX, int a_ChunkZ); + void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); + void SendWeather (eWeather a_Weather); + void SendWholeInventory (const cInventory & a_Inventory); + void SendWholeInventory (const cWindow & a_Window); + void SendWindowClose (char a_WindowID); + void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots); const AString & GetUsername(void) const; //tolua_export diff --git a/source/cFurnaceEntity.cpp b/source/cFurnaceEntity.cpp index 0f51f4ade..7ad088586 100644 --- a/source/cFurnaceEntity.cpp +++ b/source/cFurnaceEntity.cpp @@ -85,8 +85,6 @@ void cFurnaceEntity::Destroy() void cFurnaceEntity::UsedBy(cPlayer * a_Player) { - LOG("Used a furnace"); - if (GetWindow() == NULL) { OpenWindow(new cFurnaceWindow(m_PosX, m_PosY, m_PosZ, this)); -- cgit v1.2.3