//-----------------------------------------------------------------------------
// Purpose: Receive hud update message from server
// Input  : *pszName - 
//			iSize - 
//			*pbuf - 
// Output : int
//-----------------------------------------------------------------------------
int CTechnologyTreeDoc::MsgFunc_Technology(bf_read &msg)
{
	int index;
	int available;
	int voters;
	float resourcelevel;
	bool preferred;

	// Which tech
	index		= msg.ReadByte();
	// Available to this team?
	available	= msg.ReadByte();
	// # of players indicating this as their preferred tech for new spending
	voters		= msg.ReadByte();

	preferred = ( voters & 0x80 ) ? true : false;
	voters &= 0x7f;

	resourcelevel = (float)msg.ReadShort();
	
	// Look it up by index
	CBaseTechnology *item = m_pTree->GetTechnology( index );
	if ( item )
	{	
		bool wasactive = item->GetActive();

		bool justactivated = !wasactive && available;

		// Set data elements
		item->SetActive( available ? true : false );
		item->SetVoters( voters );
		item->SetResourceLevel( resourcelevel );

		// If this is the tech I am voting for, clear my vote
		if ( preferred )
		{
			// Sets the flag on the item, too
			m_pTree->SetPreferredTechnology( item );
		}
		else
		{
			// Force deselection in case there is no active preference on the server any more
			item->SetPreferred( false );
		}

		if ( justactivated && item->GetLevel() > 0 && !item->GetHintsGiven( TF_HINT_NEWTECHNOLOGY ) )
		{
			// So we only give this hint once this game, even if we respawn, etc.
			item->SetHintsGiven( TF_HINT_NEWTECHNOLOGY, true );
			// Note, only show a max of three or 4 newtechnology hints at a time
			CreateGlobalHint( TF_HINT_NEWTECHNOLOGY, item->GetPrintName(), index, 3 );
		}

		// hogsy start - this might be temporary, just keep it here for now.
		CCommanderStatusPanel::StatusPanel()->SetTechnology(item);
		// hogsy end
	}
	
	return 1;
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : hintid - 
//			100 - 
//			1 - 
//			-1 - 
//-----------------------------------------------------------------------------
C_TFBaseHint *CreateGlobalHint_Panel( vgui::Panel *targetPanel, int hintid, const char *subsection /*=NULL*/, int entity /*= -1*/, int maxduplicates /*=0*/ )
{
	C_TFBaseHint *hint = CreateGlobalHint( hintid, subsection, entity, maxduplicates );
	if ( hint )
	{
		// Find an appropriate position near the panel
		hint->SetHintTarget( targetPanel );
	}
	return hint;
}