From c37eb9b139a6730e2bd835dd8820a3be92b855cb Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 25 Dec 2010 11:27:14 +0200 Subject: [PATCH] tinkering around --- src/connection.cpp | 12 +++++------- src/connection.h | 2 +- src/guiPauseMenu.cpp | 2 +- src/main.cpp | 17 ++++++++++++----- src/server.cpp | 2 ++ 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/connection.cpp b/src/connection.cpp index 0bc8492e..6c37ff63 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -671,7 +671,7 @@ SharedBuffer Channel::ProcessPacket( con->PrintInfo(); dout_con<<"DISCO: Removing peer "<<(peer_id)<deletePeer(peer_id) == false) + if(con->deletePeer(peer_id, false) == false) { con->PrintInfo(derr_con); derr_con<<"DISCO: Peer not found"<::Iterator i = timeouted_peers.begin(); for(; i != timeouted_peers.end(); i++) { PrintInfo(derr_con); derr_con<<"RunTimeouts(): Removing peer "<<(*i)<deletingPeer(m_peers[*i], true); - delete m_peers[*i]; - m_peers.remove(*i); + deletePeer(*i, true); } } @@ -1355,11 +1353,11 @@ core::list Connection::GetPeers() return list; } -bool Connection::deletePeer(u16 peer_id) +bool Connection::deletePeer(u16 peer_id, bool timeout) { if(m_peers.find(peer_id) == NULL) return false; - m_peerhandler->deletingPeer(m_peers[peer_id], true); + m_peerhandler->deletingPeer(m_peers[peer_id], timeout); delete m_peers[peer_id]; m_peers.remove(peer_id); return true; diff --git a/src/connection.h b/src/connection.h index ad45278b..73d04371 100644 --- a/src/connection.h +++ b/src/connection.h @@ -477,7 +477,7 @@ public: // Calls PeerHandler::deletingPeer // Returns false if peer was not found - bool deletePeer(u16 peer_id); + bool deletePeer(u16 peer_id, bool timeout); void SetPeerID(u16 id){ m_peer_id = id; } u16 GetPeerID(){ return m_peer_id; } diff --git a/src/guiPauseMenu.cpp b/src/guiPauseMenu.cpp index ae1f58a9..10d272b3 100644 --- a/src/guiPauseMenu.cpp +++ b/src/guiPauseMenu.cpp @@ -95,7 +95,7 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize) Environment->addButton(rect, this, 257, L"Exit"); } { - core::rect rect(0, 0, 180, 220); + core::rect rect(0, 0, 180, 240); rect = rect + v2s32(size.X/2 + 90, size.Y/2-rect.getHeight()/2); const wchar_t *text = L"Keys:\n" diff --git a/src/main.cpp b/src/main.cpp index 524f1246..47840eae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -89,10 +89,6 @@ SUGG: Implement a "Fast check queue" (a queue with a map for checking if something is already in it) - Use it in active block queue in water flowing -SUGG: Signs could be done in the same way as torches. For this, blocks - need an additional metadata field for the texts - - This is also needed for item container chests - SUGG: Precalculate lighting translation table at runtime (at startup) SUGG: A version number to blocks, which increments when the block is @@ -179,6 +175,12 @@ TODO: Check if the usage of Client::isFetchingBlocks() in TODO: Make an option to the server to disable building and digging near the starting position +SUGG: Signs could be done in the same way as torches. For this, blocks + need an additional metadata field for the texts + - This is also needed for item container chests +TODO: There has to be some better way to handle static objects than to + send them all the time. This affects signs and item objects. + Doing now: ====================================================================== @@ -2347,7 +2349,7 @@ int main(int argc, char *argv[]) while(client.getChatMessage(message)) { chat_lines.push_back(ChatLine(message)); - if(chat_lines.size() > 7) + if(chat_lines.size() > 5) { core::list::Iterator i = chat_lines.begin(); @@ -2385,6 +2387,11 @@ int main(int argc, char *argv[]) screensize.Y - 10 ); chat_guitext->setRelativePosition(rect); + + if(chat_lines.size() == 0) + chat_guitext->setVisible(false); + else + chat_guitext->setVisible(true); } /* diff --git a/src/server.cpp b/src/server.cpp index e210d4d6..c8f9be00 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3133,6 +3133,8 @@ void Server::handlePeerChange(PeerChange &c) message += L"*** "; message += name; message += L" left game"; + if(c.timeout) + message += L" (timed out)"; } // Delete player -- 2.30.2