Пример #1
0
//-------- Begin of static function put_town_rec --------//
//
static void put_town_rec(int recNo, int x, int y, int refreshFlag)
{
	int   townRecno = town_filter(recNo);
	Town* townPtr   = town_array[townRecno];

	//---------- display info ----------//

	x+=3;
	y+=3;

	font_san.put( x    , y, townPtr->town_name() );
	font_san.put( x+175, y, townPtr->population );
	font_san.put( x+241, y, townPtr->jobless_population );
	font_san.put( x+309, y, townPtr->average_loyalty() );

	//------- display race icons -------//

	x += 350;

	int i;
	int iconSpacing = RACE_ICON_WIDTH+2;
#if(MAX_RACE > 7)
	int raceCount = 0;
	for( i=0 ; i<MAX_RACE ; i++ )
	{
		if( townPtr->race_pop_array[i] > 0 )
		{
			++raceCount;
		}
	}
	if( raceCount > 7 )
	{
		iconSpacing = 7 * iconSpacing / raceCount;
	}
#endif
	for( i=0 ; i<MAX_RACE ; i++ )
	{
		if( townPtr->race_pop_array[i] > 0 )
		{
			vga_back.put_bitmap( x, y-2, race_res[i+1]->icon_bitmap_ptr );
			x += iconSpacing;
		}
	}
}
Пример #2
0
//--------- Begin of function Firm::disp_worker_info ---------//
//
void Firm::disp_worker_info(int dispY1, int refreshFlag)
{
	static int lastSelected;

	if( selected_worker_id > worker_count )
		selected_worker_id = worker_count;

	if( lastSelected != selected_worker_id > 0 )
	{
		lastSelected = selected_worker_id > 0;
		info.disp();			// redisplay the interface
		return;
	}

	//------ if selected_worker_id==0, display overseer info -----//

	if( selected_worker_id==0 )		// display overseer info
	{
		disp_overseer_info(dispY1, refreshFlag);
		return;
	}

	//---------------- paint the panel --------------//

	if( refreshFlag == INFO_REPAINT )
	{
		if( firm_id == FIRM_CAMP )		// the command base has one more field
			vga_util.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+71 );
		else
			vga_util.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+55 );
	}

	if( selected_worker_id > 0 )
	{
		int x=INFO_X1+4, y=dispY1+4;

		Worker* workerPtr = worker_array + selected_worker_id - 1;

		if( workerPtr->town_recno )		// FirmInfo::live_in_town is 1
		{
			Town* townPtr = town_array[workerPtr->town_recno];
			font_san.field( x, y, _("Residence"), x+100, townPtr->town_name(), INFO_X2-2, refreshFlag);
			y+=16;

			if( town_array[workerPtr->town_recno]->nation_recno == nation_recno &&
				 workerPtr->race_id )
			{
				info.disp_loyalty( x, y, x+100, workerPtr->loyalty(), workerPtr->target_loyalty(firm_recno), nation_recno, refreshFlag );
			}
			else
				font_san.field( x, y, _("Loyalty"), x+100, _("N/A"), INFO_X2-2, refreshFlag );		// no loyalty because it does not belong to your empire
		}
		else										// FirmInfo::live_in_town is 0
		{
			if( workerPtr->race_id )
				info.disp_loyalty( x, y, x+100, workerPtr->loyalty(), workerPtr->target_loyalty(firm_recno), nation_recno, refreshFlag );
			else
				font_san.field( x, y, _("Loyalty"), x+100, _("N/A"), INFO_X2-2, refreshFlag );		// no loyalty because it does not belong to your empire
		}

		y+=16;

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

		String str;

		if( workerPtr->race_id )
			str = misc.format(workerPtr->skill_level, 1);
		else
			str = _("N/A");

		font_san.field( x, y, _(Skill::skill_str_array[workerPtr->skill_id-1]),
			x+100, str, INFO_X2-2, refreshFlag);

		y+=16;

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

		if( firm_id == FIRM_CAMP )
		{
			if( workerPtr->race_id )
				str = misc.format(workerPtr->combat_level, 1);
			else
				str = _("N/A");

			font_san.field( x, y, _("Combat"), x+100, str, INFO_X2-2, refreshFlag);
			y+=16;

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

			str  = workerPtr->hit_points;
			str += "/";
			str += workerPtr->max_hit_points();

			font_san.field( x, y, _("Hit Points"), x+100, str, INFO_X2-2, refreshFlag);
		}
	}
}