tinkering around

This commit is contained in:
Perttu Ahola 2010-12-25 11:27:14 +02:00
parent ed6039d472
commit c37eb9b139
5 changed files with 21 additions and 14 deletions

@ -671,7 +671,7 @@ SharedBuffer<u8> Channel::ProcessPacket(
con->PrintInfo(); con->PrintInfo();
dout_con<<"DISCO: Removing peer "<<(peer_id)<<std::endl; dout_con<<"DISCO: Removing peer "<<(peer_id)<<std::endl;
if(con->deletePeer(peer_id) == false) if(con->deletePeer(peer_id, false) == false)
{ {
con->PrintInfo(derr_con); con->PrintInfo(derr_con);
derr_con<<"DISCO: Peer not found"<<std::endl; derr_con<<"DISCO: Peer not found"<<std::endl;
@ -1301,15 +1301,13 @@ nextpeer:
continue; continue;
} }
// Remove timeouted peers // Remove timed out peers
core::list<u16>::Iterator i = timeouted_peers.begin(); core::list<u16>::Iterator i = timeouted_peers.begin();
for(; i != timeouted_peers.end(); i++) for(; i != timeouted_peers.end(); i++)
{ {
PrintInfo(derr_con); PrintInfo(derr_con);
derr_con<<"RunTimeouts(): Removing peer "<<(*i)<<std::endl; derr_con<<"RunTimeouts(): Removing peer "<<(*i)<<std::endl;
m_peerhandler->deletingPeer(m_peers[*i], true); deletePeer(*i, true);
delete m_peers[*i];
m_peers.remove(*i);
} }
} }
@ -1355,11 +1353,11 @@ core::list<Peer*> Connection::GetPeers()
return list; return list;
} }
bool Connection::deletePeer(u16 peer_id) bool Connection::deletePeer(u16 peer_id, bool timeout)
{ {
if(m_peers.find(peer_id) == NULL) if(m_peers.find(peer_id) == NULL)
return false; return false;
m_peerhandler->deletingPeer(m_peers[peer_id], true); m_peerhandler->deletingPeer(m_peers[peer_id], timeout);
delete m_peers[peer_id]; delete m_peers[peer_id];
m_peers.remove(peer_id); m_peers.remove(peer_id);
return true; return true;

@ -477,7 +477,7 @@ public:
// Calls PeerHandler::deletingPeer // Calls PeerHandler::deletingPeer
// Returns false if peer was not found // 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; } void SetPeerID(u16 id){ m_peer_id = id; }
u16 GetPeerID(){ return m_peer_id; } u16 GetPeerID(){ return m_peer_id; }

@ -95,7 +95,7 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
Environment->addButton(rect, this, 257, L"Exit"); Environment->addButton(rect, this, 257, L"Exit");
} }
{ {
core::rect<s32> rect(0, 0, 180, 220); core::rect<s32> rect(0, 0, 180, 240);
rect = rect + v2s32(size.X/2 + 90, size.Y/2-rect.getHeight()/2); rect = rect + v2s32(size.X/2 + 90, size.Y/2-rect.getHeight()/2);
const wchar_t *text = const wchar_t *text =
L"Keys:\n" L"Keys:\n"

@ -89,10 +89,6 @@ SUGG: Implement a "Fast check queue" (a queue with a map for checking
if something is already in it) if something is already in it)
- Use it in active block queue in water flowing - 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: Precalculate lighting translation table at runtime (at startup)
SUGG: A version number to blocks, which increments when the block is 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 TODO: Make an option to the server to disable building and digging near
the starting position 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: Doing now:
====================================================================== ======================================================================
@ -2347,7 +2349,7 @@ int main(int argc, char *argv[])
while(client.getChatMessage(message)) while(client.getChatMessage(message))
{ {
chat_lines.push_back(ChatLine(message)); chat_lines.push_back(ChatLine(message));
if(chat_lines.size() > 7) if(chat_lines.size() > 5)
{ {
core::list<ChatLine>::Iterator core::list<ChatLine>::Iterator
i = chat_lines.begin(); i = chat_lines.begin();
@ -2385,6 +2387,11 @@ int main(int argc, char *argv[])
screensize.Y - 10 screensize.Y - 10
); );
chat_guitext->setRelativePosition(rect); chat_guitext->setRelativePosition(rect);
if(chat_lines.size() == 0)
chat_guitext->setVisible(false);
else
chat_guitext->setVisible(true);
} }
/* /*

@ -3133,6 +3133,8 @@ void Server::handlePeerChange(PeerChange &c)
message += L"*** "; message += L"*** ";
message += name; message += name;
message += L" left game"; message += L" left game";
if(c.timeout)
message += L" (timed out)";
} }
// Delete player // Delete player