示例#1
0
文件: of_forti.cpp 项目: mecirt/7k2
//--------- Begin of function FirmCamp::disp_camp_info ---------//
//
void FirmFort::disp_camp_info(int dispY1, int refreshFlag)
{
	FirmCamp::disp_camp_info(dispY1, refreshFlag);

	// ----- display train button -------//

	int x2 = INFO_X1 +13;
	int y2 = INFO_Y1 +281;
	if (!is_monster())
		button_train.create( INFO_X1+13, INFO_Y1+281, 'A', "TRAIN" );
	else
		button_train.create( INFO_X1+13, INFO_Y1+281, 'A', "F_TRAIN" );

	// scan any available population to train

	// ##### begin Gilbert 23/12 #######//
	if( (button_train.visible_flag = is_own()) )
	{
		button_train.enable_flag = can_recruit(active_link_town_recno);
		button_train.paint();
	}
	// ##### end Gilbert 23/12 #######//

	// ------- display tower count -----//

	button_tower_count.create( INFO_X1+13+3*BUTTON_DISTANCE+6, INFO_Y1+235+6,
		INFO_X1+13+3*BUTTON_DISTANCE+6+TOWER_COUNT_BUTTON_WIDTH-1,
		INFO_Y1+235+6+TOWER_COUNT_BUTTON_HEIGHT-1,
		disp_tower_count, ButtonCustomPara( NULL, 0 ) );

//#ifdef DEBUG
	// BUGHERE : ARM_TOWERS is longer than 8 characters
	// button_tower_count.set_help_code("ARM_TOWERS");
	button_tower_count.set_help_code("ARM_TOWE");
//#endif

	button_tower_count.enable_flag = is_own();
	button_tower_count.custom_para = ButtonCustomPara( NULL, target_archer_count );
	button_tower_count.paint();

	// ------- display towers ----------//

	err_when( !image_spict.read_all );			// must read_all
	char *towerFull = image_spict.read("TOWER-F");
	char *towerEmpty = image_spict.read("TOWER-E");
	char *towerBuilding = image_spict.read("TOWER-D");
	int towerHeight = ((Bitmap *)towerFull)->get_height();
	err_when( ((Bitmap *)towerEmpty)->get_height() != towerHeight );
	err_when( ((Bitmap *)towerBuilding)->get_height() != towerHeight );
	int towerWidth = ((Bitmap *)towerFull)->get_width();

//	static int towerXTable[MAX_FORT_ARCHER] = { 180, 202, 191, 180, 202 };
//	static int towerYTable[MAX_FORT_ARCHER] = { 280, 280, 292, 304, 304 };
	static int towerXTable[MAX_FORT_ARCHER] = { 180, 202, 191, 180, 202 };
	static int towerYTable[MAX_FORT_ARCHER] = { 304, 304, 292, 280, 280 };

	for( int i = 0; i < MAX_FORT_ARCHER; ++i )
	{
		int towerX = INFO_X1 + towerXTable[i];
		int towerY = INFO_Y1 + towerYTable[i];

		if( i < current_archer_count )
		{
			// display full tower
			vga.active_buf->put_bitmap( towerX, towerY, towerFull );
		}
		else if( i == current_archer_count )
		{
			// display building tower
			vga.active_buf->put_bitmap( towerX, towerY, towerEmpty );

			// display portion of towerFull at bottom
			int subTowerHeight = train_archer_progress * towerHeight / MAX_TRAIN_ARCHER_PROGRESS;
			if( subTowerHeight > 0 )
			{
				vga.active_buf->put_bitmap_area( towerX, towerY, towerBuilding, 
					0, towerHeight-subTowerHeight, towerWidth-1, towerHeight-1 );
			}
		}
		else
		{
			// display disabled tower	
			vga.active_buf->put_bitmap( towerX, towerY, towerEmpty );
		}
	}

	help.set_help( INFO_X1+176, INFO_Y1+278, INFO_X1+176+39, INFO_Y1+278+48, "TOWERS" );
}
示例#2
0
文件: of_inni.cpp 项目: mecirt/7k2
//--------- 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;
	}
}