本文整理汇总了C++中HousePtr::collectTaxes方法的典型用法代码示例。如果您正苦于以下问题:C++ HousePtr::collectTaxes方法的具体用法?C++ HousePtr::collectTaxes怎么用?C++ HousePtr::collectTaxes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HousePtr
的用法示例。
在下文中一共展示了HousePtr::collectTaxes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _centerTile
void TaxCollector::_centerTile()
{
Walker::_centerTile();
int difficulty = SETTINGS_VALUE(difficulty);
float multiply = 1.0f;
switch (difficulty)
{
case 0: multiply = 3.0f; break;
case 1: multiply = 2.0f; break;
case 2: multiply = 1.5f; break;
case 3: multiply = 1.0f; break;
case 4: multiply = 0.75f; break;
}
ReachedBuildings buildings = getReachedBuildings( pos() );
foreach( it, buildings )
{
HousePtr house = ptr_cast<House>( *it );
if( house.isValid() )
{
float tax = house->collectTaxes() * multiply;
_d->money += tax;
house->applyService( this );
std::string posStr = utils::format( 0xff, "%02dx%02d", house->pos().i(), house->pos().j() );
_d->history[ posStr ] += tax;
}
}
示例2: onMidTile
void TaxCollector::onMidTile()
{
ServiceWalker::onMidTile();
ReachedBuildings buildings = getReachedBuildings( getIJ() );
for( ReachedBuildings::iterator it=buildings.begin(); it != buildings.end(); it++ )
{
HousePtr house = (*it).as<House>();
if( house.isValid() )
{
int money = house->collectTaxes();
_d->money += money;
_d->peoplesReached += money > 0 ? house->getNbHabitants() : 0;
}
}
}