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


C++ npc::get_hunger方法代码示例

本文整理汇总了C++中npc::get_hunger方法的典型用法代码示例。如果您正苦于以下问题:C++ npc::get_hunger方法的具体用法?C++ npc::get_hunger怎么用?C++ npc::get_hunger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在npc的用法示例。


在下文中一共展示了npc::get_hunger方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_needs

void test_needs( const npc &who, const numeric_interval<int> &hunger,
                 const numeric_interval<int> &thirst,
                 const numeric_interval<int> &fatigue )
{
    CHECK( who.get_hunger() <= hunger.max );
    CHECK( who.get_hunger() >= hunger.min );
    CHECK( who.get_thirst() <= thirst.max );
    CHECK( who.get_thirst() >= thirst.min );
    CHECK( who.get_fatigue() <= fatigue.max );
    CHECK( who.get_fatigue() >= fatigue.min );
}
开发者ID:BevapDin,项目名称:Cataclysm-DDA,代码行数:11,代码来源:npc_test.cpp

示例2: sane

void sane( const npc &who )
{
    CHECK( who.get_hunger() >= 0 );
    CHECK( who.thirst >= 0 );
    CHECK( who.fatigue >= -25 );
}
开发者ID:ejseto,项目名称:Cataclysm-DDA,代码行数:6,代码来源:npc_test.cpp

示例3: SECTION

    model_npc.set_mutation( "WEB_WEAVER" );
    return model_npc;
}

TEST_CASE("on_load-sane-values")
{

    npc model_npc = create_model();

    SECTION("Awake for 10 minutes, gaining hunger/thirst/fatigue") {
        npc test_npc = model_npc;
        const int five_min_ticks = 2;
        on_load_test( test_npc, 0, MINUTES(5 * five_min_ticks) );

        const int margin = 1;
        CHECK( test_npc.get_hunger() <= five_min_ticks + margin );
        CHECK( test_npc.thirst <= five_min_ticks + margin );
        CHECK( test_npc.fatigue <= five_min_ticks + margin );
        CHECK( test_npc.get_hunger() >= five_min_ticks - margin );
        CHECK( test_npc.thirst >= five_min_ticks - margin );
        CHECK( test_npc.fatigue >= five_min_ticks - margin );
    }

    SECTION("Awake for 2 days, gaining hunger/thirst/fatigue") {
        npc test_npc = model_npc;
        const int five_min_ticks = HOURS(2 * 24) / MINUTES(5);
        on_load_test( test_npc, 0, MINUTES(5 * five_min_ticks) );

        const int margin = 10;
        CHECK( test_npc.get_hunger() <= five_min_ticks + margin );
        CHECK( test_npc.thirst <= five_min_ticks + margin );
开发者ID:ejseto,项目名称:Cataclysm-DDA,代码行数:31,代码来源:npc_test.cpp


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