当前位置: 首页>>代码示例>>C++>>正文


C++ HousePtr::hasServiceAccess方法代码示例

本文整理汇总了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 );
}
开发者ID:Ecordonnier,项目名称:caesaria-game,代码行数:34,代码来源:layerreligion.cpp

示例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();
}
开发者ID:KSLcom,项目名称:caesaria-game,代码行数:59,代码来源:layertax.cpp

示例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 );
}
开发者ID:KSLcom,项目名称:caesaria-game,代码行数:41,代码来源:layertax.cpp


注:本文中的HousePtr::hasServiceAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。