Example #1
0
//--------- Begin of function Unit::disp_main_menu ---------//
//
void Unit::disp_main_menu(int refreshFlag)
{
	disp_basic_info(INFO_Y1, refreshFlag);
	disp_unit_profile( INFO_Y1+52, refreshFlag );

	if( !should_show_info() )
		return;

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

	int y=INFO_Y1+98;

	if( race_id )
	{
		disp_unit_info( y, refreshFlag );
		y += 89;
	}

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

	if( is_own_spy() )
	{
		disp_spy_menu(y, refreshFlag);
		y+=spy_menu_height()+3;
	}

	if( is_own() )
	{
		if( refreshFlag == INFO_REPAINT )
			disp_button(y);

		y+=BUTTON_ACTION_HEIGHT;
	}

	#ifdef DEBUG
		if( sys.debug_session || sys.testing_session )
			disp_debug_info(this, INFO_Y2-68, refreshFlag);
	#endif
}
Example #2
0
//--------- Begin of function FirmInn::put_det ---------//
//
void FirmInn::put_det(int refreshFlag)
{
	if( browse_hire.none_record )
	{
		button_hire.reset();
		return;
	}

	//--------- display details ----------//

	InnUnit* innUnit = inn_unit_array+browse_hire.recno()-1;

	disp_unit_info(HIRE_DET_Y1, innUnit, refreshFlag );

	//------- paint buttons --------//

	if( own_firm() )
	{
		if( refreshFlag == INFO_REPAINT )
		{
			button_hire.paint( HIRE_DET_X1, HIRE_DET_Y2+4, 'A', "HIREUNIT" );
		}
		else
		{
			if( inn_unit_count > 0 &&
				 (~nation_array)->cash >= inn_unit_array[browse_hire.recno()-1].hire_cost )
			{
				button_hire.enable();
			}
			else
			{
				button_hire.disable();
			}
		}
	}
}
Example #3
0
//--------- Begin of function FirmInn::put_info ---------//
//
void FirmInn::put_info(int refreshFlag)
{
	if( selected_unit_id < 0 )
		selected_unit_id = 0;
	if( selected_unit_id > inn_unit_count )
		selected_unit_id = inn_unit_count;

	Firm::put_info(refreshFlag);

	button_hire.create(INFO_X1+13, INFO_Y1+235, 'A', "HIREUNIT" );
	button_hire.enable_flag = 0;
	button_spy_mobilize.create(INFO_X1+13, INFO_Y1+235, 'A', "MOBILSPY" );
	button_spy_mobilize.enable_flag = 0;
	button_buy_item.create( INFO_X1+13+BUTTON_DISTANCE, INFO_Y1+235, 
		INFO_X1+13+BUTTON_DISTANCE+ITEM_ICON_WIDTH, INFO_Y1+235+ITEM_ICON_HEIGHT,
		disp_item_button, ButtonCustomPara(NULL, 0) );
	button_buy_item.visible_flag = 0;

	button_hire_visible = button_spy_mobilize_visible = 0;

	if( !should_show_info() )
		return;

	vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("INN_BASE") );

	disp_unit_list( INFO_Y1, refreshFlag );

	disp_unit_info( INFO_Y1 + 165, refreshFlag );

	// ------ main interface --------//

	// ------ display hire button -------//

	button_hire.enable_flag = 0;
	button_spy_mobilize.enable_flag = 0;

	if( selected_unit_id > 0 && selected_unit_id <= inn_unit_count )
	{
		InnUnit *innUnit = inn_unit_array + selected_unit_id - 1;

		if( innUnit->is_own_spy() )
		{
			button_spy_mobilize.enable_flag = 1;
			button_spy_mobilize.paint();
			button_spy_mobilize_visible = 1;
		}
		else if( is_own() )
		{
			button_hire.enable_flag = (~nation_array)->cash >= innUnit->hire_cost;
			button_hire.paint();
			button_hire_visible = 1;
		}
		else
		{
			button_spy_mobilize.paint();
			button_spy_mobilize_visible = 1;
		}

		if( (button_buy_item.visible_flag = innUnit->item.id != 0) )
		{
			button_buy_item.enable_flag = is_own() && buy_item( selected_unit_id, 1 );		// checking only
			button_buy_item.custom_para.value = innUnit->item.id;
			button_buy_item.paint();
		}
	}
	else
	{
		if( is_own() )
		{
			button_hire.paint();
			button_hire_visible = 1;
		}
		else
		{
			button_spy_mobilize.paint();
			button_spy_mobilize_visible = 0;
		}

		button_buy_item.visible_flag = 0;
	}
}