Пример #1
0
    std::string get_denial( const item_location &loc ) const override {
        if( !p.has_item( *loc ) ) {
            if( loc->made_of( LIQUID ) ) {
                return _( "Can't pick up liquids" );
            } else if( !p.can_pickVolume( *loc ) ) {
                return _( "Too big to pick up" );
            } else if( !p.can_pickWeight( *loc ) ) {
                return _( "Too heavy to pick up" );
            }
        }

        return std::string();
    }
        std::string get_denial( const item_location &loc ) const override {
            if( loc->made_of( LIQUID ) ) {
                return _( "Can't drink spilt liquids" );
            }

            const auto &it = get_comestible_item( loc );
            const auto res = p.can_eat( it );
            const auto cbm = p.get_cbm_rechargeable_with( it );

            if( !res.success() && cbm == rechargeable_cbm::none ) {
                return res.str();
            } else if( cbm == rechargeable_cbm::battery && p.power_level >= p.max_power_level ) {
                return _( "You're fully charged" );
            }

            return inventory_selector_preset::get_denial( loc );
        }