本文整理汇总了C++中PlayerCityPtr::population方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCityPtr::population方法的具体用法?C++ PlayerCityPtr::population怎么用?C++ PlayerCityPtr::population使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCityPtr
的用法示例。
在下文中一共展示了PlayerCityPtr::population方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateRelation
void RomeDivinity::updateRelation(float income, PlayerCityPtr city)
{
if( income == -101.f )
{
_doWrath( city );
return;
}
else if( income == -102.f )
{
_doSmallCurse( city );
return;
}
else if( income == -103.f )
{
_doBlessing( city );
return;
}
unsigned int minMood = 50 - math::clamp( city->population() / 10, 0u, 50u );
int festivalFactor = 12 - std::min( 40, _lastFestival.monthsTo( game::Date::current() ) );
_needRelation = math::clamp<int>( income + festivalFactor + _effectPoints, minMood, 100 );
_relation += math::signnum( _needRelation - _relation );
if( _relation <= 50 )
{
_blessingDone = false;
int wrathDelta = 0;
if( _relation > 0 && _relation < 10 ) { wrathDelta = 5; }
else if( _relation >= 10 && _relation < 20 ) { wrathDelta = 2; }
else if( _relation >= 20 && _relation < 40 ) { wrathDelta = 1; }
_wrathPoints = math::clamp<int>( _wrathPoints + wrathDelta, 0, 50 );
}
if( _relation >= 50 )
{
_smallCurseDone = false;
_wrathPoints = 0;
}
}