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; } }
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; } } }