本文整理汇总了C++中HousePtr::_update方法的典型用法代码示例。如果您正苦于以下问题:C++ HousePtr::_update方法的具体用法?C++ HousePtr::_update怎么用?C++ HousePtr::_update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HousePtr
的用法示例。
在下文中一共展示了HousePtr::_update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: levelDown
void House::levelDown()
{
_d->houseLevel--;
_d->houseLevelSpec = HouseSpecHelper::getInstance().getHouseLevelSpec(_d->houseLevel);
_d->nextHouseLevelSpec = _d->houseLevelSpec.next();
switch (_d->houseLevel)
{
case 1:
{
_d->houseId = 1;
_d->picIdOffset = ( rand() % 10 > 6 ? 1 : 0 );
CityPtr city = Scenario::instance().getCity();
Tilemap& tmap = city->getTilemap();
if( getSize().getWidth() > 1 )
{
_updateDesirabilityInfluence( Construction::duNegative );
PtrTilesList tiles = tmap.getFilledRectangle( getTile().getIJ(), Size(2) );
PtrTilesList::iterator it=tiles.begin();
int peoplesPerHouse = getNbHabitants() / 4;
_d->currentHabitants = peoplesPerHouse;
it++; //no destroy himself
for( ; it != tiles.end(); it++ )
{
HousePtr house = ConstructionManager::getInstance().create( B_HOUSE ).as<House>();
house->build( (*it)->getIJ() );
house->_d->currentHabitants = peoplesPerHouse;
house->_update();
}
setSize( Size( 1 ) );
_updateDesirabilityInfluence( Construction::duPositive );
}
}
break;
case 2: _tryDegrage_11_to_2_lvl( 1, 5, -3 );
break;
case 3: _tryDegrage_11_to_2_lvl( 3, 6, -3 );
break;
case 4: _tryDegrage_11_to_2_lvl( 7, 11, -2 );
break;
case 5: _tryDegrage_11_to_2_lvl( 9, 12, -2 );
break;
case 6: _tryDegrage_11_to_2_lvl( 13, 17, -2 );
break;
case 7: _tryDegrage_11_to_2_lvl( 15, 18, -2 );
break;
case 8: _tryDegrage_11_to_2_lvl( 19, 23, -1 );
break;
case 9: _tryDegrage_11_to_2_lvl( 21, 23, -1 );
break;
case 10: _tryDegrage_11_to_2_lvl( 25, 29, 0 );
break;
case 11: _tryDegrage_11_to_2_lvl( 27, 30, 0 );
break;
}
_update();
}