//----------------------------------------------------------------------------- // Purpose: Adds a message to the queue to be sent to a user //----------------------------------------------------------------------------- void CVGui::PostMessage(VPANEL target, KeyValues *params, VPANEL from, float delay) { // Ignore all messages in re-entrant mode if ( IsReentrant() ) { Assert( 0 ); if (params) { params->deleteThis(); } return; } if (!target) { if (params) { params->deleteThis(); } return; } MessageItem_t messageItem; messageItem._messageTo = (target != (VPANEL)-1) ? g_pIVgui->PanelToHandle(target) : 0xFFFFFFFF; messageItem._params = params; Assert(params->GetName()); messageItem._from = g_pIVgui->PanelToHandle(from); messageItem._arrivalTime = 0; messageItem._messageID = m_iCurrentMessageID++; /* message debug code //if ( stricmp(messageItem._params->GetName(),"CursorMoved") && stricmp(messageItem._params->GetName(),"KeyFocusTicked")) { g_pIVgui->DPrintf2( "posting( %s -- %i )\n", messageItem._params->GetName(), messageItem._messageID ); } */ // add the message to the correct message queue if (delay > 0.0f) { messageItem._arrivalTime = g_pSystem->GetTimeMillis() + (delay * 1000); m_DelayedMessageQueue.Insert(messageItem); } else if (m_InDispatcher) { m_SecondaryQueue.AddToTail(messageItem); } else { m_MessageQueue.AddToTail(messageItem); } }
//----------------------------------------------------------------------------- // Inserts the command into the list, sorted by time //----------------------------------------------------------------------------- void CSoundControllerImp::CommandInsert( SoundCommand_t *pCommand ) { m_commandList.Insert( pCommand ); }