1
0

- Make Color was using 2 extra characters which took 2 characters off the 16 max (including color codes) for scoreboard display

- Added xC9 PlayerListItem packet and added code for player names to be added and removed from the scoreboard (need a catch-all for client disconnects: crashes, timeouts, etc)
 - Changed wid wording to a_WindowType

git-svn-id: http://mc-server.googlecode.com/svn/trunk@113 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
mtilden@gmail.com
2011-12-26 01:07:35 +00:00
parent e8f230f24e
commit bf838238e4
10 changed files with 91 additions and 5 deletions

View File

@@ -29,6 +29,7 @@
#include "packets/cPacket_Metadata.h"
#include "packets/cPacket_Chat.h"
#include "packets/cPacket_NewInvalidState.h"
#include "packets/cPacket_PlayerListItem.h"
#include "Vector3d.h"
#include "Vector3f.h"
@@ -232,6 +233,20 @@ void cPlayer::Tick(float a_Dt)
if(e_EPMetaState == BURNING){
InStateBurning(a_Dt);
}
// Send Player List
cWorld::PlayerList PlayerList = cRoot::Get()->GetWorld()->GetAllPlayers();
for( cWorld::PlayerList::iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr )
{
if ((*itr) && (*itr)->GetClientHandle() && !((*itr)->GetClientHandle()->IsDestroyed())) {
cPacket_PlayerListItem PlayerList;
PlayerList.m_PlayerName = GetColor() + GetName();
PlayerList.m_Online = true;
PlayerList.m_Ping = (short)5;
(*itr)->GetClientHandle()->Send( PlayerList );
}
}
}
void cPlayer::InStateBurning(float a_Dt) {
@@ -406,10 +421,10 @@ void cPlayer::OpenWindow( cWindow* a_Window )
m_CurrentWindow = a_Window;
}
void cPlayer::CloseWindow(char wID = -1)
void cPlayer::CloseWindow(char a_WindowType)
{
if( m_CurrentWindow ) m_CurrentWindow->Close( *this );
if (wID == 0) {
if (a_WindowType == 0) {
if(GetInventory().GetWindow()->GetDraggingItem() && GetInventory().GetWindow()->GetDraggingItem()->m_ItemCount > 0)
{
LOG("Player holds item! Dropping it...");