本文整理汇总了C++中Firm::pull_town_people方法的典型用法代码示例。如果您正苦于以下问题:C++ Firm::pull_town_people方法的具体用法?C++ Firm::pull_town_people怎么用?C++ Firm::pull_town_people使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Firm
的用法示例。
在下文中一共展示了Firm::pull_town_people方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_detect_link_line
//------- Begin of function Town::draw_detect_link_line ---------//
//
// [int] actionDetect - 0 - this is a draw action
// 1 - this is a detect action
// (default: 0)
//
// return: <int> 1 - detected
// 0 - not detected
//
int Town::draw_detect_link_line(int actionDetect)
{
//-------- set source points ----------//
int srcX = ( ZOOM_X1 + (loc_x1-world.zoom_matrix->top_x_loc) * ZOOM_LOC_WIDTH
+ ZOOM_X1 + (loc_x2-world.zoom_matrix->top_x_loc+1) * ZOOM_LOC_WIDTH ) / 2;
int srcY = ( ZOOM_Y1 + (loc_y1-world.zoom_matrix->top_y_loc) * ZOOM_LOC_HEIGHT
+ ZOOM_Y1 + (loc_y2-world.zoom_matrix->top_y_loc+1) * ZOOM_LOC_HEIGHT ) / 2;
//------ draw lines to linked firms ---------//
char* bitmapPtr;
for(int i=0 ; i<linked_firm_count ; i++ )
{
int firmX, firmY;
Firm *firmPtr = firm_array[linked_firm_array[i]];
firmX = ( ZOOM_X1 + (firmPtr->loc_x1-world.zoom_matrix->top_x_loc) * ZOOM_LOC_WIDTH
+ ZOOM_X1 + (firmPtr->loc_x2-world.zoom_matrix->top_x_loc+1) * ZOOM_LOC_WIDTH ) / 2;
firmY = ( ZOOM_Y1 + (firmPtr->loc_y1-world.zoom_matrix->top_y_loc) * ZOOM_LOC_HEIGHT
+ ZOOM_Y1 + (firmPtr->loc_y2-world.zoom_matrix->top_y_loc+1) * ZOOM_LOC_HEIGHT ) / 2;
anim_line.draw_line(&vga_back, srcX, srcY, firmX, firmY, linked_firm_enable_array[i]==LINK_EE );
if( !can_toggle_firm_link(linked_firm_array[i]) )
continue;
//------ draw the link icon and detect mouse action -----//
bitmapPtr = power.get_link_icon( linked_firm_enable_array[i], nation_recno==firmPtr->nation_recno );
if( actionDetect )
{
int rc = world.zoom_matrix->detect_bitmap_clip( firmX-11, firmY-11, bitmapPtr );
if( rc )
mouse.reset_click(); // reset queued mouse click for fast single clicking
//------ left clicking to toggle link -------//
if( rc==1 && nation_recno==nation_array.player_recno )
{
if( linked_firm_enable_array[i] & LINK_ED )
{
toggle_firm_link( i+1, 0, COMMAND_PLAYER );
// ###### begin Gilbert 25/9 #######//
se_ctrl.immediate_sound("TURN_OFF");
// ###### end Gilbert 25/9 #######//
}
else
{
toggle_firm_link( i+1, 1, COMMAND_PLAYER );
// ###### begin Gilbert 25/9 #######//
se_ctrl.immediate_sound("TURN_ON");
// ###### end Gilbert 25/9 #######//
}
// ######## begin Gilbert 23/9 ##########//
if( firmPtr->firm_id == FIRM_CAMP && !remote.is_enable())
// ######## end Gilbert 23/9 ##########//
{
if( nation_recno )
update_target_loyalty();
else
update_target_resistance();
update_camp_link();
}
return 1;
}
//------ right clicking to recruit soldiers ------//
else if( rc==2 )
{
if( firmPtr->nation_recno == nation_recno && !firmPtr->under_construction &&
firmPtr->worker_array && firmPtr->worker_count < MAX_WORKER )
{
firmPtr->pull_town_people(town_recno, COMMAND_PLAYER, browse_selected_race_id(), 1); // last 1-force pulling people from the town to the firm
// ###### begin Gilbert 25/9 #######//
se_ctrl.immediate_sound("PULL_MAN");
// ###### end Gilbert 25/9 #######//
}
}
}
else
//.........这里部分代码省略.........
示例2: draw_detect_link_line
//------- Begin of function Town::draw_detect_link_line ---------//
//
// [int] actionDetect - 0 - this is a draw action
// 1 - this is a detect action
// (default: 0)
//
// return: <int> 1 - detected
// 0 - not detected
//
int Town::draw_detect_link_line(int actionDetect)
{
int i, firmX, firmY, townX, townY;
Firm* firmPtr;
Town* townPtr;
//-------- set source points ----------//
int srcX = ( ZOOM_X1 + (loc_x1-world.zoom_matrix->top_x_loc) * ZOOM_LOC_WIDTH
+ ZOOM_X1 + (loc_x2-world.zoom_matrix->top_x_loc+1) * ZOOM_LOC_WIDTH ) / 2;
int srcY = ( ZOOM_Y1 + (loc_y1-world.zoom_matrix->top_y_loc) * ZOOM_LOC_HEIGHT
+ ZOOM_Y1 + (loc_y2-world.zoom_matrix->top_y_loc+1) * ZOOM_LOC_HEIGHT ) / 2;
//------ draw lines to linked firms ---------//
char* bitmapPtr;
char goodLinkName[9] = "GOODLINK";
goodLinkName[7] = '1'+(char)(sys.frame_count%3);
for( i=0 ; i<linked_firm_count ; i++ )
{
firmPtr = firm_array[linked_firm_array[i]];
firmX = ( ZOOM_X1 + (firmPtr->loc_x1-world.zoom_matrix->top_x_loc) * ZOOM_LOC_WIDTH
+ ZOOM_X1 + (firmPtr->loc_x2-world.zoom_matrix->top_x_loc+1) * ZOOM_LOC_WIDTH ) / 2;
firmY = ( ZOOM_Y1 + (firmPtr->loc_y1-world.zoom_matrix->top_y_loc) * ZOOM_LOC_HEIGHT
+ ZOOM_Y1 + (firmPtr->loc_y2-world.zoom_matrix->top_y_loc+1) * ZOOM_LOC_HEIGHT ) / 2;
anim_line.draw_line(&vga_back, srcX, srcY, firmX, firmY, linked_firm_enable_array[i]==LINK_EE );
if( !can_toggle_firm_link(linked_firm_array[i]) )
continue;
//------ draw the link icon and detect mouse action -----//
bitmapPtr = power.get_link_icon( linked_firm_enable_array[i], nation_recno==firmPtr->nation_recno );
if( actionDetect )
{
int rc = world.zoom_matrix->detect_bitmap_clip( firmX-11, firmY-11, bitmapPtr );
if( rc )
mouse.reset_click(); // reset queued mouse click for fast single clicking
//------ left clicking to toggle link -------//
if( rc==1 && nation_recno==nation_array.player_recno )
{
if( linked_firm_enable_array[i] & LINK_ED )
{
toggle_firm_link( i+1, 0, COMMAND_PLAYER );
// ###### begin Gilbert 25/9 #######//
se_ctrl.immediate_sound("TURN_OFF");
// ###### end Gilbert 25/9 #######//
}
else
{
toggle_firm_link( i+1, 1, COMMAND_PLAYER );
// ###### begin Gilbert 25/9 #######//
se_ctrl.immediate_sound("TURN_ON");
// ###### end Gilbert 25/9 #######//
}
// ######## begin Gilbert 23/9 ##########//
if( firmPtr->firm_id == FIRM_CAMP && !remote.is_enable())
// ######## end Gilbert 23/9 ##########//
{
if( nation_recno )
update_target_loyalty();
else
update_target_resistance();
update_camp_link();
}
return 1;
}
//------ right clicking to recruit soldiers ------//
else if( rc==2 )
{
if( firmPtr->nation_recno == nation_recno && !firmPtr->under_construction &&
firmPtr->worker_array && firmPtr->worker_count < MAX_WORKER )
{
firmPtr->pull_town_people(town_recno, COMMAND_PLAYER, browse_selected_race_id(), 1); // last 1-force pulling people from the town to the firm
// ###### begin Gilbert 25/9 #######//
//.........这里部分代码省略.........