本文整理汇总了C++中HousePtr::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ HousePtr::getSize方法的具体用法?C++ HousePtr::getSize怎么用?C++ HousePtr::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HousePtr
的用法示例。
在下文中一共展示了HousePtr::getSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: arrivedArea
void Immigrant::_findPath2blankHouse( Tile& startPoint )
{
HousePtr house = _findBlankHouse();
Pathway pathWay;
Tilemap& citymap = _getCity()->getTilemap();
Tile& destTile = house.isValid() ? house->getTile() : citymap.at( _getCity()->getBorderInfo().roadExit );
Size arrivedArea( house.isValid() ? house->getSize() : 1 );
bool pathFound = Pathfinder::getInstance().getPath( startPoint.getIJ(), destTile.getIJ(), pathWay,
false, arrivedArea );
if( pathFound )
{
setPathway( pathWay );
setIJ( startPoint.getIJ() );
go();
}
if( !pathFound )
{
deleteLater();
}
}
示例2: getTile
void House::_tryUpdate_1_to_11_lvl( int level4grow, int startSmallPic, int startBigPic, const char desirability )
{
if( getSize() == 1 )
{
Tilemap& tmap = _getCity()->getTilemap();
TilemapTiles area = tmap.getFilledRectangle( getTile().getIJ(), Size(2) );
bool mayGrow = true;
foreach( Tile* tile, area )
{
if( tile == NULL )
{
mayGrow = false; //some broken, can't grow
break;
}
HousePtr house = tile->getOverlay().as<House>();
if( house != NULL && house->getLevelSpec().getHouseLevel() == level4grow )
{
if( house->getSize().getWidth() > 1 ) //bigger house near, can't grow
{
mayGrow = false;
break;
}
}
else
{
mayGrow = false; //no house near, can't grow
break;
}
}
if( mayGrow )
{
int sumHabitants = getNbHabitants();
int sumFreeWorkers = _d->freeWorkersCount;
TilemapTiles::iterator delIt=area.begin();
HousePtr selfHouse = (*delIt)->getOverlay().as<House>();
delIt++; //don't remove himself
for( ; delIt != area.end(); delIt++ )
{
HousePtr house = (*delIt)->getOverlay().as<House>();
if( house.isValid() )
{
house->deleteLater();
house->_d->currentHabitants = 0;
sumHabitants += house->getNbHabitants();
sumFreeWorkers += house->_d->freeWorkersCount;
selfHouse->getGoodStore().storeAll( house->getGoodStore() );
}
}
_d->currentHabitants = sumHabitants;
_d->freeWorkersCount = sumFreeWorkers;
_d->houseLevelSpec = HouseSpecHelper::getInstance().getHouseLevelSpec(_d->houseLevel);
_d->nextHouseLevelSpec = _d->houseLevelSpec.next();
_update();
_updateDesirabilityInfluence( Construction::duNegative );
setSize( getSize() + Size(1) );
build( _getCity(), getTile().getIJ() );
}
}
示例3: getTile
void House::_tryUpdate_1_to_11_lvl( int level4grow, int startSmallPic, int startBigPic, const char desirability )
{
if( getSize() == 1 )
{
CityPtr city = Scenario::instance().getCity();
Tilemap& tmap = city->getTilemap();
PtrTilesList tiles = tmap.getFilledRectangle( getTile().getIJ(), Size(2) );
bool mayGrow = true;
for( PtrTilesList::iterator it=tiles.begin(); it != tiles.end(); it++ )
{
if( *it == NULL )
{
mayGrow = false; //some broken, can't grow
break;
}
HousePtr house = (*it)->getTerrain().getOverlay().as<House>();
if( house != NULL && house->getLevelSpec().getHouseLevel() == level4grow )
{
if( house->getSize().getWidth() > 1 ) //bigger house near, can't grow
{
mayGrow = false;
break;
}
}
else
{
mayGrow = false; //no house near, can't grow
break;
}
}
if( mayGrow )
{
int sumHabitants = getNbHabitants();
int sumFreeWorkers = _d->freeWorkersCount;
PtrTilesList::iterator delIt=tiles.begin();
delIt++; //don't remove himself
for( ; delIt != tiles.end(); delIt++ )
{
HousePtr house = (*delIt)->getTerrain().getOverlay().as<House>();
if( house.isValid() )
{
house->deleteLater();
house->_d->currentHabitants = 0;
sumHabitants += house->getNbHabitants();
sumFreeWorkers += house->_d->freeWorkersCount;
}
}
_d->currentHabitants = sumHabitants;
_d->freeWorkersCount = sumFreeWorkers;
_d->houseLevelSpec = HouseSpecHelper::getInstance().getHouseLevelSpec(_d->houseLevel);
_d->nextHouseLevelSpec = _d->houseLevelSpec.next();
_update();
_updateDesirabilityInfluence( Construction::duNegative );
setSize( getSize() + Size(1) );
build( getTile().getIJ() );
}
}
_updateDesirabilityInfluence( Construction::duNegative );
_d->desirability = desirability;
_updateDesirabilityInfluence( Construction::duPositive );
bool bigSize = getSize().getWidth() > 1;
_d->houseId = bigSize ? startBigPic : startSmallPic;
_d->picIdOffset = bigSize ? 0 : ( (rand() % 10 > 6) ? 1 : 0 );
}