本文整理汇总了C++中HousePtr::hasServiceAccess方法的典型用法代码示例。如果您正苦于以下问题:C++ HousePtr::hasServiceAccess方法的具体用法?C++ HousePtr::hasServiceAccess怎么用?C++ HousePtr::hasServiceAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HousePtr
的用法示例。
在下文中一共展示了HousePtr::hasServiceAccess方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleEvent
void Religion::handleEvent(NEvent& event)
{
if( event.EventType == sEventMouse )
{
switch( event.mouse.type )
{
case mouseMoved:
{
Tile* tile = _camera()->at( event.mouse.pos(), false ); // tile under the cursor (or NULL)
std::string text = "";
if( tile != 0 )
{
HousePtr house = ptr_cast<House>( tile->overlay() );
if( house.isValid() )
{
int templeAccess = house->spec().computeReligionLevel( house );
bool oracleAccess = house->hasServiceAccess( Service::oracle );
text = (templeAccess == 5 && oracleAccess )
? "##religion_access_full##"
: utils::format( 0xff, "##religion_access_%d_temple##", templeAccess );
}
}
_setTooltipText( _(text) );
}
break;
default: break;
}
}
Layer::handleEvent( event );
}
示例2: drawTile
void Tax::drawTile(Engine& engine, Tile& tile, const Point& offset)
{
Point screenPos = tile.mappos() + offset;
if( tile.overlay().isNull() )
{
//draw background
engine.draw( tile.picture(), screenPos );
}
else
{
bool needDrawAnimations = false;
TileOverlayPtr overlay = tile.overlay();
int taxLevel = -1;
if( _isVisibleObject( overlay->type() ) )
{
// Base set of visible objects
needDrawAnimations = true;
}
else if( overlay->type() == objects::house )
{
HousePtr house = ptr_cast<House>( overlay );
//taxLevel = house->getServiceValue( Service::forum );
taxLevel = math::clamp<int>( house->taxesThisYear(), 0, 100 );
needDrawAnimations = (house->spec().level() == 1) && (house->habitants().empty());
if( needDrawAnimations )
{
int taxAccess = house->hasServiceAccess( Service::forum );
needDrawAnimations = (taxAccess < 25);
}
if( !needDrawAnimations )
{
city::Helper helper( _city() );
drawArea( engine, helper.getArea( overlay ), offset, ResourceGroup::foodOverlay, OverlayPic::inHouseBase );
}
}
else
{
city::Helper helper( _city() );
drawArea( engine, helper.getArea( overlay ), offset, ResourceGroup::foodOverlay, OverlayPic::base );
}
if( needDrawAnimations )
{
Layer::drawTile( engine, tile, offset );
registerTileForRendering( tile );
}
else if( taxLevel > 0 )
{
_addColumn( screenPos, taxLevel );
//drawColumn( engine, screenPos, taxLevel );
}
}
tile.setWasDrawn();
}
示例3: handleEvent
void Tax::handleEvent(NEvent& event)
{
if( event.EventType == sEventMouse )
{
switch( event.mouse.type )
{
case mouseMoved:
{
Tile* tile = _camera()->at( event.mouse.pos(), false ); // tile under the cursor (or NULL)
std::string text = "";
if( tile != 0 )
{
BuildingPtr bld = ptr_cast<Building>( tile->overlay() );
if( bld.isNull() )
{
text = "##no_people_in_this_locality##";
}
else
{
HousePtr house = ptr_cast<House>( tile->overlay() );
if( house.isValid() )
{
int taxAccess = house->hasServiceAccess( Service::forum );
if( taxAccess < 25 )
text = "##house_not_registered_for_taxes##";
}
}
}
_setTooltipText( _(text) );
}
break;
default:
break;
}
}
Layer::handleEvent( event );
}