Exemplo n.º 1
0
//--------- Begin of function Info::init_player_reply ---------//
//
// This function is called by TalkRes::player_reply() when the
// player is going to reply to a diplomatic message from another
// nation.
//
// <int> talkToNationRecno - recno of the nation the player is
//									  going to talk to.
//
void Info::init_player_reply(int talkToNationRecno)
{
	nation_report_mode = NATION_REPORT_TALK;

	info.player_reply_mode = 1;

	//--- go to the nation in the browser which the player is going to talk to ---//

	int nationCount = nation_filter();

	int i;
	for( i=1 ; i<=nationCount ; i++ )
	{
		if( nation_filter(i) == talkToNationRecno )
		{
			browse_nation_recno = i;
			break;
		}
	}

	err_when( i>nationCount );

	//----- if currently it's in nation report mode -----//

	if( sys.view_mode == MODE_NATION )
		browse_nation.refresh(browse_nation_recno);
}
Exemplo n.º 2
0
//--------- Begin of function FirmInn::put_info ---------//
//
void FirmInn::put_info(int refreshFlag)
{
	firm_inn_ptr = this;

	disp_basic_info(INFO_Y1, refreshFlag);

	if( !should_show_info() )
		return;

	//----------- display browser -----------//

	if( refreshFlag == INFO_REPAINT )
	{
		browse_hire.init( HIRE_BROWSE_X1, HIRE_BROWSE_Y1, HIRE_BROWSE_X2, HIRE_BROWSE_Y2,
								0, 25, inn_unit_count, put_hire_rec );

		browse_hire.open(1);
	}
	else
	{
		if( last_hire_count != inn_unit_count )
		{
			if( last_hire_count==0 || inn_unit_count==0 )		// repaint the whole area as the detail area needs to disappear
			{
				last_hire_count = inn_unit_count;
				info.disp();
				return;
			}

			last_hire_count = inn_unit_count;

			browse_hire.refresh(-1, inn_unit_count);

			if( last_hire_count==0 || inn_unit_count==0 )
				refreshFlag = INFO_REPAINT;
		}
		else
			browse_hire.update();          // update only
	}

	last_hire_count = inn_unit_count;

	put_det(refreshFlag);

	//---------- display spy button ----------//

	disp_spy_button(INFO_X1+BUTTON_ACTION_WIDTH, HIRE_DET_Y2+4, refreshFlag);
}
Exemplo n.º 3
0
//--------- Begin of function FirmInn::update_del_hire_list --------//
//
void FirmInn::update_del_hire_list()
{
	//------- existing units leave -------//

	for( int i=inn_unit_count ; i>0 && inn_unit_count>0 ; i-- )
	{
		if( !inn_unit_array[i-1].spy_recno && --inn_unit_array[i-1].stay_count==0 )
		{
			del_inn_unit(i);

			if( firm_recno == firm_array.selected_recno )
			{
				if( browse_hire.recno() > i && browse_hire.recno() > 1 )
					browse_hire.refresh( browse_hire.recno()-1, inn_unit_count );
			}
		}
	}
}
Exemplo n.º 4
0
// ----- begin of function ScenarioEditor::disp_monster_main ------//
//
void ScenarioEditor::disp_monster_main(int refreshFlag)
{
	String str;

	// unit or structure button group

	button_unit_or_struct[0].create_text( INFO_X1+15, INFO_Y1+5, INFO_X1+110, INFO_Y1+25,
		text_editor.str_unit(), 0 ); // "Unit", 0 );
	button_unit_or_struct[1].create_text( INFO_X1+115, INFO_Y1+5, INFO_X1+210, INFO_Y1+25,
		text_editor.str_structure(), 0 ); //"Structure", 0 );

	font_zoom.put( INFO_X1+10, INFO_Y2-28, text_editor.str_double_left_add(), 0, INFO_X2-5);
	font_zoom.put( INFO_X1+10, INFO_Y2-14, text_editor.str_double_right_del(), 0, INFO_X2-5);

	button_unit_or_struct.paint(unit_or_struct);

	{
		// player number button group

		for( int nationRecno = 0; nationRecno <= MAX_NATION; ++nationRecno )
		{
			button_player_recno[nationRecno].create( INFO_X1+16+nationRecno*25, INFO_Y1+30,
				INFO_X1+16+(nationRecno+1)*25-2, INFO_Y1+57, i_disp_nation_button,
				ButtonCustomPara(NULL, nationRecno), 0 );
			button_player_recno[nationRecno].visible_flag = 
				button_player_recno[nationRecno].enable_flag =
				!nationRecno || !nation_array.is_deleted(nationRecno);		// nation 0 always enable
		}
	}

	if( brush_player_recno && nation_array.is_deleted(brush_player_recno) )
	{
		brush_player_recno = 0;			// set to nation 0 if that nation is deleted
	}
	button_player_recno.paint(brush_player_recno);

	// display browser

	collect_monster_unit(monster_race_filter);
	collect_monster_firm(monster_race_filter);

	// display browser 

	if( !unit_or_struct )
	{
		// init unit browser
		vbrowse_unit_id.init( INFO_X1+5, INFO_Y1+80, INFO_X2-5, INFO_Y2-30,
			-1, 20, monster_unit_id_count, disp_monster_unit_id );
		vbrowse_unit_id.open(monster_unit_id_browse_recno);
		browse_unit_width = vbrowse_unit_id.ix2 - vbrowse_unit_id.ix1 + 1;
		vbrowse_unit_id.paint();
		vbrowse_unit_id.refresh();
	}
	else
	{
		// init firm browser
		vbrowse_firm_build.init( INFO_X1+5, INFO_Y1+80, INFO_X2-5, INFO_Y2-30,
			-1, 20, monster_firm_group_count, disp_monster_firm_group );
		vbrowse_firm_build.open(monster_firm_group_browse_recno);
		browse_firm_width = vbrowse_firm_build.ix2 - vbrowse_firm_build.ix1 + 1;
		vbrowse_firm_build.paint();
		vbrowse_firm_build.refresh();
	}

	// init race filter button

//	int raceLength = ((INFO_X2-4) - (INFO_X1+5) + 1) / (1+MAX_MONSTER_TYPE);
//	char raceAbbr[2] = " ";
//	for( int r = 0; r <= MAX_MONSTER_TYPE; ++r )
//	{
//		if( r > 0 ) 
//			raceAbbr[0] = monster_res[r]->name[0];
//		button_race_group[r].create_text( INFO_X1+5+r*raceLength, INFO_Y1+58,
//			INFO_X1+5+(r+1)*raceLength-1, INFO_Y1+78, raceAbbr );
//	}
	spinner_race_group.create( INFO_X1+80, INFO_Y1+58, INFO_X1+210, INFO_Y1+78, 200,//146,
		0, 1+MAX_MONSTER_TYPE, i_disp_race_spinner, -monster_race_filter );
	// button_race_group.paint(-monster_race_filter);
	spinner_race_group.paint(-monster_race_filter);

}
Exemplo n.º 5
0
// ----- begin of function ScenarioEditor::disp_players_main ------//
//
void ScenarioEditor::disp_players_main(int refreshFlag)
{
	// ------- display scroll area ----------//

	browse_nation.init( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+168,
		-1, 32, MAX_NATION, disp_nation_rec );
	browse_nation.open(brush_player_recno);
	browse_nation.paint();
	// ######## begin Gilbert 22/2 #######//
	// browse_nation.refresh(brush_player_recno);
	browse_nation.refresh();
	// ######## end Gilbert 22/2 #######//

	// ------ display king name -------//

	int y = INFO_Y1+170;

//	if( !nation_array.is_deleted(brush_player_recno) )
//		font_whbl.put( font_whbl.put( INFO_X1+20, y, text_editor.str_king_name()) // "King Name" )
//		+10, y, nation_array[brush_player_recno]->king_name() ) ;

	if( !nation_array.is_deleted(brush_player_recno) )
	{
		vga_buffer.d3_panel_up( INFO_X1+5, y, INFO_X2-5, y+8+font_cara_w.max_font_height );
		font_cara_w.center_put( INFO_X1+5, y, INFO_X2-5, y+8+font_cara_w.max_font_height,
			nation_array[brush_player_recno]->nation_name() );
	}

	y+=30;

	// ------- treasure, food, reputation --------//
	button_cash_up.create_text(    INFO_X1+140, y,    INFO_X1+150, y+9,  "+" );
	button_cash_down.create_text(  INFO_X1+140, y+10, INFO_X1+150, y+19, "-" );
	button_food_up.create_text(    INFO_X1+140, y+22, INFO_X1+150, y+31, "+" );
	button_food_down.create_text(  INFO_X1+140, y+32, INFO_X1+150, y+41, "-" );
	button_reput_up.create_text(   INFO_X1+140, y+44, INFO_X1+150, y+53, "+" );
	button_reput_down.create_text( INFO_X1+140, y+54, INFO_X1+150, y+63, "-" );
	button_live_up.create_text(    INFO_X1+140, y+66, INFO_X1+150, y+75, "+" );
	button_live_down.create_text(  INFO_X1+140, y+76, INFO_X1+150, y+85, "-" );

//	button_adjustment[0].create_text( INFO_X1+152, y, INFO_X1+214, y+18, text_editor.str_fine_coarse(0) ); // "Fine" );
//	button_adjustment[1].create_text( INFO_X1+152, y+20, INFO_X1+214, y+38, text_editor.str_fine_coarse(1) ); // "Medium" );
//	button_adjustment[2].create_text( INFO_X1+152, y+40, INFO_X1+214, y+58, text_editor.str_fine_coarse(2) ); // "Coarse" );

	if( !nation_array.is_deleted(brush_player_recno) )
	{
		vga_buffer.bar( INFO_X1+15, y, INFO_X2-10, y+66, V_BLACK );

		Nation *nationPtr = nation_array[brush_player_recno];

		// -------- treasure --------//

		font_whbl.put( INFO_X1+15, y, text_editor.str_player_treasure() ); //"Treasure" );
		font_whbl.right_put( INFO_X1+140-4, y, m.format( (int)nationPtr->cash, 2) );
		button_cash_up.paint();
		button_cash_down.paint();

		// --------- food ----------//

		font_whbl.put( INFO_X1+15, y+22, text_editor.str_player_food() ); // "Food" );
		font_whbl.right_put( INFO_X1+140-4, y+22, m.format((int)nationPtr->food) );
		button_food_up.paint();
		button_food_down.paint();

		// --------- reputation -------//

		font_whbl.put( INFO_X1+15, y+44, text_editor.str_player_reputation() ); // "Reputation" );
		font_whbl.right_put( INFO_X1+140-4, y+44, m.format( (int)nationPtr->reputation) );
		button_reput_up.paint();
		button_reput_down.paint();

		// --------- live points ---------//

		font_whbl.put( INFO_X1+15, y+66, text_editor.str_player_live_points() ); // "Life Points" );
		font_whbl.right_put( INFO_X1+140-4, y+66, m.format( (int)nationPtr->live_points) );
		button_live_up.paint();
		button_live_down.paint();
	}

	y += 87;
	button_adjustment[0].create_text( INFO_X1+147, y+18, INFO_X1+216, y+38, text_editor.str_fine_coarse(0) ); // "Fine" );
	button_adjustment[1].create_text( INFO_X1+76, y+18, INFO_X1+145, y+38, text_editor.str_fine_coarse(1) ); // "Medium" );
	button_adjustment[2].create_text( INFO_X1+5, y+18, INFO_X1+74, y+38, text_editor.str_fine_coarse(2) ); // "Coarse" );
	font_whbl.put( INFO_X1+15, y, text_editor.str_adjustment() );
	button_adjustment.paint();

	// ------- player type --------//

//	button_player_type[0].create_text( INFO_X1+50, y, INFO_X1+100, y+18, "Either" );
//	button_player_type[1].create_text( INFO_X1+50, y, INFO_X1+100, y+18, "Computer" );
	if( !nation_array.is_deleted(brush_player_recno) )
	{
//		button_player_type.paint( nation_array[brush_player_recno]->is_ai() );
	}
}