示例#1
0
//--------- Begin of function FirmFactory::detect_info ---------//
//
void FirmFactory::detect_info()
{
	//-------- detect basic info -----------//

	if( detect_basic_info() )
		return;

	//-------- detect workers ----------//

	if( detect_worker_list() )		// detect this when: it's the player's firm or the player has spies in this firm
	{
		disp_worker_list(INFO_Y1+126, INFO_UPDATE);
		disp_worker_info(INFO_Y1+190, INFO_UPDATE);
	}

	//-------- detect spy button ----------//

	detect_spy_button();

	if( !own_firm() )
		return;

	//---- detect change production button -----//

	if( button_change_production.detect() )
	{	
		change_production();
		disp_factory_info(INFO_Y1+54, INFO_UPDATE);
		// ##### begin Gilbert 25/9 ######//
		se_ctrl.immediate_sound("TURN_ON");
		// ##### end Gilbert 25/9 ######//
	}

	//-------- detect mobilize button ----------//

	if (button_vacate_firm.detect())
	{		
		mobilize_all_workers(COMMAND_PLAYER);
	}
}
示例#2
0
//--------- Begin of function FirmBase::detect_info ---------//
//
void FirmBase::detect_info()
{
	if( detect_basic_info() )
		return;

	if( !should_show_info() )
		return;

	//------ detect the overseer button -----//

	int rc = mouse.any_click(INFO_X1+6, INFO_Y1+58, INFO_X1+5+UNIT_LARGE_ICON_WIDTH, INFO_Y1+57+UNIT_LARGE_ICON_HEIGHT, LEFT_BUTTON) ? 1 
		: mouse.any_click(INFO_X1+6, INFO_Y1+58, INFO_X1+5+UNIT_LARGE_ICON_WIDTH, INFO_Y1+57+UNIT_LARGE_ICON_HEIGHT, RIGHT_BUTTON) ? 2 : 0;

	if( rc==1 )		// display this overseer's info
	{
		selected_worker_id = 0;
		disp_base_info(INFO_Y1+54, INFO_UPDATE);
		disp_worker_list(INFO_Y1+104, INFO_UPDATE);
		disp_worker_info(INFO_Y1+168, INFO_UPDATE);
	}

	//--------- detect soldier info ---------//

	if( detect_worker_list() )
	{
		disp_base_info(INFO_Y1+54, INFO_UPDATE);
		disp_worker_list(INFO_Y1+104, INFO_UPDATE);
		disp_worker_info(INFO_Y1+168, INFO_UPDATE);
	}

	//---------- detect spy button ----------//

	detect_spy_button();

	if( !own_firm() )
		return;

	//------ detect the overseer button -----//

	if( rc==2 )
	{
		if(remote.is_enable())
		{
			// packet structure : <firm recno>
			short *shortPtr=(short *)remote.new_send_queue_msg(MSG_FIRM_MOBL_OVERSEER, sizeof(short));
			shortPtr[0] = firm_recno;
		}
		else
		{
			assign_overseer(0);		// the overseer quits the camp
		}
	}

	//----------- detect invoke -----------//

	if( button_invoke.detect() )
	{
		if(remote.is_enable())
		{
			// ##### begin Gilbert 14/10 #######//
			// packet structure : <firm recno>
			short *shortPtr=(short *)remote.new_send_queue_msg(MSG_F_BASE_INVOKE_GOD, sizeof(short));
			shortPtr[0] = firm_recno;
			// ##### end Gilbert 14/10 #######//
		}
		else
		{
			invoke_god();
		}
	}

	//----------- detect reward -----------//

	if( button_reward.detect() )
	{
		reward(selected_worker_id, COMMAND_PLAYER);
		// ##### begin Gilbert 26/9 ########//
		se_ctrl.immediate_sound("TURN_ON");
		// ##### end Gilbert 26/9 ########//
	}

	//-------- detect mobilize button ----------//

	if( button_vacate_firm.detect() )
	{
		mobilize_all_workers(COMMAND_PLAYER);
	}
}