本文整理汇总了C++中Town::town_name方法的典型用法代码示例。如果您正苦于以下问题:C++ Town::town_name方法的具体用法?C++ Town::town_name怎么用?C++ Town::town_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Town
的用法示例。
在下文中一共展示了Town::town_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: put_town_rec
//-------- 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: disp_worker_info
//--------- 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);
}
}
}