本文整理汇总了C++中Town::is_pay_tribute_to_monster方法的典型用法代码示例。如果您正苦于以下问题:C++ Town::is_pay_tribute_to_monster方法的具体用法?C++ Town::is_pay_tribute_to_monster怎么用?C++ Town::is_pay_tribute_to_monster使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Town
的用法示例。
在下文中一共展示了Town::is_pay_tribute_to_monster方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CampaignEastWest::plot_a2_create_game()
{
Nation *monsterNation = nation_array[plot_enemy_nation_recno];
// give money
monsterNation->cash += 20000.0f;
monsterNation->food += 20000.0f;
monsterNation->live_points += 20000.0f;
// give tech
for( int techClassId = FIRST_TECH_CLASS_FRYHTAN; techClassId <= LAST_TECH_CLASS_FRYHTAN; ++techClassId )
{
tech_res.inc_tech_class_level( plot_enemy_nation_recno, techClassId );
}
/*
// create military building
int lairAddCount = 6 + misc.random(3); // add 6 to 8 Fryhtan Lairs
int independentTownAddCount = 6 + misc.random(3); // 6 to 8 independent towns
int specialFirmCount= lairAddCount - misc.random(3);
create_lair( 0, plot_enemy_nation_recno, lairAddCount, independentTownAddCount, specialFirmCount);
*/
// --- build military building around non-slave independent town of player but badly damage ----//
long limitBestWeight = 0x7fffffff;
for( int fortCount = 3; fortCount > 0; --fortCount )
{
int bestTownRecno = 0;
int bestWeight = 0;
for( int townRecno = town_array.size(); townRecno > 0; --townRecno )
{
if( town_array.is_deleted(townRecno) )
continue;
Town *townPtr = town_array[townRecno];
if( townPtr->nation_recno == 0
&& !townPtr->is_pay_tribute_to_monster() )
{
int weight = 1000 - unit_array[(~nation_array)->king_unit_recno]->area_distance(townPtr) / 8
+ townPtr->population + (townPtr->race_id==(~nation_array)->race_id ? 20 : 0);
if( weight > bestWeight && weight < limitBestWeight )
{
bestWeight = weight;
bestTownRecno = townRecno;
}
}
}
if( !bestTownRecno )
break; // no need to find another town again
else
{
// a suitable town is found
// ---- create fort -------//
int firmRecno = create_firm_next_to_place( town_array[bestTownRecno],
(~nation_array)->is_human() ? FIRM_FORT : FIRM_LAIR,
(~nation_array)->race_id, nation_array.player_recno );
// --- weaken building of human ---------//
if( firmRecno )
{
Firm *firmPtr = firm_array[firmRecno];
firmPtr->hit_points = misc.random((int)firmPtr->hit_points) / 2.0f + 1.0f;
}
limitBestWeight = bestWeight;
// no matter we can create a fort or not, set maxBestWeight
// so next fortCount will not select the same town
// if another having the same bestWeight, we may miss it
}
}
}