コード例 #1
0
ファイル: trainee.cpp プロジェクト: binakot/caesaria-game
void TraineeWalker::_cancelPath()
{
  BuildingPtr destination = receiver();
  Logger::warningIf( destination.isNull(), "!!! WARNING: Trainee _cancelPath destination is null" );

  if( destination.isValid() )
  {
    destination->cancelTrainee( type() );
  }
}
コード例 #2
0
ファイル: layertax.cpp プロジェクト: KSLcom/caesaria-game
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 );
}