Ejemplo n.º 1
0
//--------- Begin of function Firm::disp_spy_button --------//
//
void Firm::disp_spy_button(int x, int y, int refreshFlag)
{
	if( !own_firm() )		// if not own firm, there is not other button other than the spy button, so always display it left-aligned
		x = INFO_X1;		// if own firm, the x passed will be space position on the interface already, taking into account of the other buttons on interface

	//-------------------------------------//

	if( player_spy_count > 0 )
	{
		//------------ spy menu -----------//

		if( refreshFlag == INFO_REPAINT )
			button_spy_menu.paint( x, y, 'A', "SPYMENU" );

		x += BUTTON_ACTION_WIDTH;

		//---------- bribe button -----------//

		if( nation_recno != nation_array.player_recno ) 	// only display the bribe button for non-player owned towns
		{
			int canBribe=0;

			if( selected_worker_id )
				canBribe = can_spy_bribe(selected_worker_id, nation_array.player_recno );

			else if( overseer_recno )
				canBribe = can_spy_bribe(0, nation_array.player_recno );

			//-------- display the bribe button -------//

			if( refreshFlag == INFO_REPAINT )
				button_bribe.paint( x, y, 'A', "SELBRIBE" );

			if( canBribe )
				button_bribe.enable();
			else
				button_bribe.disable();

			x += BUTTON_ACTION_WIDTH;
		}
	}

	//--------- capture button ----------//

	int canCapture = can_worker_capture(nation_array.player_recno);

	if( canCapture )
	{
		if( !button_capture.enable_flag || refreshFlag==INFO_REPAINT )
			button_capture.paint( x, y, 'A', "CAPTURE" );
	}
	else
	{
		if( refreshFlag==INFO_REPAINT )
			button_capture.reset();

		else if( button_capture.enable_flag )
			button_capture.hide();
	}
}
Ejemplo n.º 2
0
//--------- Begin of function Firm::disp_basic_info ---------//
//
void Firm::disp_basic_info(int dispY1, int refreshFlag)
{
	//------- display the name of the firm --------//

	if( refreshFlag == INFO_REPAINT )
	{
		vga_util.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+21 );

		if( nation_recno )
		{
			font_san.center_put( INFO_X1+21, dispY1, INFO_X2-2, dispY1+21, firm_name() );

			char *nationPict = image_button.get_ptr("V_COLCOD");

			vga_front.put_bitmap_remap(INFO_X1+3, dispY1+2, nationPict, game.get_color_remap_table(nation_recno, 0) );
		}
		else
		{
			font_san.center_put( INFO_X1, dispY1, INFO_X2-2, dispY1+21, firm_name() );
		}
	}

	dispY1+=23;

	//------- display hit points and buttons -------//

	int sliderX1, sliderX2;

	if( under_construction )
		sliderX1 = INFO_X1+34;		// there is only one button in the contruction mode, so the slider is longer
	else
		sliderX1 = INFO_X1+64;

	sliderX2 = INFO_X2-64;

	int showRepairIcon = builder_recno && !under_construction && should_show_info();

	if( refreshFlag == INFO_REPAINT )
	{
		button_sell.reset();
		button_destruct.reset();

		vga_util.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+26 );

		if( nation_array.player_recno &&
			 nation_recno == nation_array.player_recno )
		{
			if( under_construction || !can_sell() )
			{
				button_destruct.paint( INFO_X1+4, dispY1+1, "V_DEM-U", "V_DEM-D" );	// Destruct

				if( under_construction )
					button_destruct.set_help_code( "CANCELBLD" );
				else
					button_destruct.set_help_code( "DESTFIRM" );
			}

			if( !under_construction && can_sell() )
			{
				button_sell.paint( INFO_X1+4, dispY1+1, "V_SEL-U", "V_SEL-D" );	// Sell
				button_sell.set_help_code( "SELLFIRM" );
			}
		}

		if( showRepairIcon )
		{
			button_builder.paint( INFO_X1+30, dispY1+1, "REPAIRU", "REPAIRD" );	// Builder
			button_builder.set_help_code( "REPAIR" );
		}
	}
	else	//--------- INFO_UPDATE --------//
	{
		if( showRepairIcon != button_builder.enable_flag )
		{
			if( showRepairIcon )
			{
				button_builder.paint( INFO_X1+30, dispY1+1, "REPAIRU", "REPAIRD" );	// Builder
				button_builder.set_help_code( "REPAIR" );
			}
			else
				button_builder.hide();
		}
	}

	disp_hit_point(dispY1);
}