示例#1
0
void Bombing::SendNormalMessages() 
{
	// Check if there was a bomb
	if(mNormalBombingPlayers.size() == 0)
		return;
		
	// First to Planet Owner
	Message * mess = mTargetPlanet->AddMessageOwner("PlanetBombed");
	mess->AddItem("Target", this);
	mess->AddLong("Population lost", mPopulationLoss);
	mess->AddFloat("Defense effectiveness", mNormalPercentageStopped);
	mess->AddLong("Factories lost", mFactoriesLoss);
	mess->AddLong("Mines lost", mMinesLoss);
	mess->AddLong("Defenses lost", mDefensesLoss);
	
	// Other Players
	for (deque<Player*>::iterator i = mNormalBombingPlayers.begin(); i != mNormalBombingPlayers.end(); ++i)
	{
		Message * mess = (*i)->AddMessage("FleetBombed");
		mess->AddItem("Target", this);
		mess->AddLong("Population lost", mPopulationLoss);
		mess->AddFloat("Defense effectiveness", mNormalPercentageStopped);
		mess->AddLong("Installations lost", mFactoriesLoss + mMinesLoss + mDefensesLoss);
	}
}
示例#2
0
void CameraPrefsWin::HandleMessage(Message* pcMessage)
{
	switch (pcMessage->GetCode())
	{
		case M_PREFS_APPLY:
			{
				int nKeyInstant = m_pcInstantDrop->GetSelection();
				int nKeyDelay = m_pcDelayDrop->GetSelection();
				int nClickPreform = m_pcSingleClickDrop->GetSelection();

				pcPassToWindow = new Message(M_PREFS_SEND_TO_PARENT);
				pcPassToWindow->AddFloat("delay",(float)m_pcKeySecondDrop->GetSelection()+1);
				pcPassToWindow->AddFloat("key/instant",(float)nKeyInstant);
				pcPassToWindow->AddFloat("key/delay",(float)nKeyDelay);
				pcPassToWindow->AddFloat("click",(float)nClickPreform);
				m_pcParent->GetLooper()->PostMessage(pcPassToWindow,m_pcParent);
				delete( pcPassToWindow );
				break;
			}
			
		case M_PREFS_UNDO:
			LoadSettings();
			break;
		
		case M_PREFS_DEFAULT:
			LoadDefaults();
			break;
	}
}
示例#3
0
void AppserverConfig::GetConfig( Message * pcConfig )
{
	const char *pzKeymap = strrchr( m_cKeymapPath.c_str(), '/' );

	if( pzKeymap == NULL )
	{
		pzKeymap = m_cKeymapPath.c_str();
	}
	else
	{
		pzKeymap++;
	}
	pcConfig->AddString( "keymap", pzKeymap );
	pcConfig->AddString( "window_decorator", m_cWindowDecoratorPath );
	pcConfig->AddBool( "popoup_sel_win", m_bPopupSelectedWindows );
	pcConfig->AddInt64( "doubleclick_delay", m_nDoubleClickDelay );
	pcConfig->AddInt64( "key_delay", m_nKeyDelay );
	pcConfig->AddInt64( "key_repeat", m_nKeyRepeat );
	pcConfig->AddFloat( "mouse_speed", m_nMouseSpeed );
	pcConfig->AddFloat( "mouse_acceleration", m_nMouseAcceleration );
	pcConfig->AddBool(  "mouse_swap_buttons", m_bMouseSwapButtons );

	Message cColorConfig;

	cColorConfig.AddFloat( "shine_tint", 0.9f );
	cColorConfig.AddFloat( "shadow_tint", 0.9f );
	for( int i = 0; i < COL_COUNT; ++i )
	{
		cColorConfig.AddColor32( "color_table", get_default_color( static_cast < default_color_t > ( i ) ) );
	}
	pcConfig->AddMessage( "color_config", &cColorConfig );

}
示例#4
0
void DockCamera::ShowPrefs(Path cPath)
{
	if (!pcPrefsWin)
	{
		m_pcPassedToPrefsMessage = new Message(M_PARENT_SEND_TO_PREFS);
		m_pcPassedToPrefsMessage->AddFloat("delay",vDelayTime-1);
		m_pcPassedToPrefsMessage->AddFloat("key/instant",vInstant);
		m_pcPassedToPrefsMessage->AddFloat("key/delay",vDelay);
		m_pcPassedToPrefsMessage->AddFloat("click",vClick);
		
		pcPrefsWin = new CameraPrefsWin(cPath,m_pcPassedToPrefsMessage,this);
		pcPrefsWin->Show();
		pcPrefsWin->MakeFocus();
	}
	
	else
		pcPrefsWin->MakeFocus();
}