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


C++ JsonObject::get_bool方法代码示例

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


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

示例1: load_mutation_category

void load_mutation_category(JsonObject &jsobj)
{
    mutation_category_trait new_category;
    std::string id = jsobj.get_string("id");
    new_category.id=id;
    new_category.name =_(jsobj.get_string("name").c_str());
    new_category.category =jsobj.get_string("category").c_str();
    new_category.mutagen_message = _(jsobj.get_string("mutagen_message", "You drink your mutagen").c_str());
    new_category.mutagen_hunger  = jsobj.get_int("mutagen_hunger", 10);
    new_category.mutagen_thirst  = jsobj.get_int("mutagen_thirst", 10);
    new_category.mutagen_pain    = jsobj.get_int("mutagen_pain", 2);
    new_category.mutagen_fatigue = jsobj.get_int("mutagen_fatigue", 5);
    new_category.mutagen_morale  = jsobj.get_int("mutagen_morale", 0);
    new_category.iv_message = _(jsobj.get_string("iv_message", "You inject yourself").c_str());
    new_category.iv_min_mutations    = jsobj.get_int("iv_min_mutations", 1);
    new_category.iv_additional_mutations = jsobj.get_int("iv_additional_mutations", 2);
    new_category.iv_additional_mutations_chance = jsobj.get_int("iv_additional_mutations_chance", 3);
    new_category.iv_hunger   = jsobj.get_int("iv_hunger", 10);
    new_category.iv_thirst   = jsobj.get_int("iv_thirst", 10);
    new_category.iv_pain     = jsobj.get_int("iv_pain", 2);
    new_category.iv_fatigue  = jsobj.get_int("iv_fatigue", 5);
    new_category.iv_morale   = jsobj.get_int("iv_morale", 0);
    new_category.iv_morale_max   = jsobj.get_int("iv_morale_max", 0);
    new_category.iv_sound = jsobj.get_bool("iv_sound", false);
    new_category.iv_sound_message = _(jsobj.get_string("iv_sound_message", "You inject yoursel-arRGH!").c_str());
    new_category.iv_noise = jsobj.get_int("iv_noise", 0);
    new_category.iv_sleep = jsobj.get_bool("iv_sleep", false);
    new_category.iv_sleep_message =_(jsobj.get_string("iv_sleep_message", "Fell asleep").c_str());
    new_category.iv_sleep_dur = jsobj.get_int("iv_sleep_dur", 0);
    new_category.memorial_message = _(jsobj.get_string("memorial_message", "Crossed a threshold").c_str());
    new_category.junkie_message = _(jsobj.get_string("junkie_message", "Oh, yeah! That's the stuff!").c_str());

    mutation_category_traits[id] = new_category;
}
开发者ID:Camkitsune,项目名称:Cataclysm-DDA,代码行数:34,代码来源:mutation_data.cpp

示例2: LoadMonsterGroup

void MonsterGroupManager::LoadMonsterGroup(JsonObject &jo)
{
    MonsterGroup g;

    g.name = mongroup_id( jo.get_string("name") );
    g.defaultMonster = mtype_id( jo.get_string("default") );
    if (jo.has_array("monsters")) {
        JsonArray monarr = jo.get_array("monsters");

        while (monarr.has_more()) {
            JsonObject mon = monarr.next_object();
            const mtype_id name = mtype_id( mon.get_string("monster") );
            int freq = mon.get_int("freq");
            int cost = mon.get_int("cost_multiplier");
            int pack_min = 1;
            int pack_max = 1;
            if(mon.has_member("pack_size")) {
                JsonArray packarr = mon.get_array("pack_size");
                pack_min = packarr.next_int();
                pack_max = packarr.next_int();
            }
            int starts = 0;
            int ends = 0;
            if(mon.has_member("starts")) {
                if (ACTIVE_WORLD_OPTIONS["MONSTER_UPGRADE_FACTOR"] > 0) {
                    starts = mon.get_int("starts") * ACTIVE_WORLD_OPTIONS["MONSTER_UPGRADE_FACTOR"];
                } else {
                    // Default value if the monster upgrade factor is set to 0.0 - off
                    starts = mon.get_int("starts");
                }
            }
            if(mon.has_member("ends")) {
                if (ACTIVE_WORLD_OPTIONS["MONSTER_UPGRADE_FACTOR"] > 0) {
                    ends = mon.get_int("ends") * ACTIVE_WORLD_OPTIONS["MONSTER_UPGRADE_FACTOR"];
                } else {
                    // Default value if the monster upgrade factor is set to 0.0 - off
                    ends = mon.get_int("ends");
                }
            }
            MonsterGroupEntry new_mon_group = MonsterGroupEntry(name, freq, cost, pack_min, pack_max, starts,
                                              ends);
            if(mon.has_member("conditions")) {
                JsonArray conditions_arr = mon.get_array("conditions");
                while(conditions_arr.has_more()) {
                    new_mon_group.conditions.push_back(conditions_arr.next_string());
                }
            }



            g.monsters.push_back(new_mon_group);
        }
    }
    g.replace_monster_group = jo.get_bool("replace_monster_group", false);
    g.new_monster_group = mongroup_id( jo.get_string("new_monster_group_id", mongroup_id::NULL_ID.str() ) );
    g.monster_group_time = jo.get_int("replacement_time", 0);
    g.is_safe = jo.get_bool( "is_safe", false );

    monsterGroupMap[g.name] = g;
}
开发者ID:FunnyMan3595,项目名称:Cataclysm-DDA,代码行数:60,代码来源:mongroup.cpp

示例3: load_mon_effect_data

mon_effect_data load_mon_effect_data( JsonObject &e )
{
    return mon_effect_data( efftype_id( e.get_string( "id" ) ), e.get_int( "duration", 0 ),
                            e.get_bool( "affect_hit_bp", false ),
                            get_body_part_token( e.get_string( "bp", "NUM_BP" ) ),
                            e.get_bool( "permanent", false ),
                            e.get_int( "chance", 100 ) );
}
开发者ID:Rivet-the-Zombie,项目名称:Cataclysm-DDA,代码行数:8,代码来源:monstergenerator.cpp

示例4: load_technique

void load_technique(JsonObject &jo)
{
    ma_technique tec;

    tec.id = jo.get_string("id");
    tec.name = jo.get_string("name", "");
	if (!tec.name.empty()) {
		tec.name = _(tec.name.c_str());
	}

    JsonArray jsarr = jo.get_array("messages");
    while (jsarr.has_more()) {
        tec.messages.push_back(_(jsarr.next_string().c_str()));
    }

    tec.reqs.unarmed_allowed = jo.get_bool("unarmed_allowed", false);
    tec.reqs.melee_allowed = jo.get_bool("melee_allowed", false);
    tec.reqs.min_melee = jo.get_int("min_melee", 0);
    tec.reqs.min_unarmed = jo.get_int("min_unarmed", 0);

    tec.reqs.min_bashing = jo.get_int("min_bashing", 0);
    tec.reqs.min_cutting = jo.get_int("min_cutting", 0);
    tec.reqs.min_stabbing = jo.get_int("min_stabbing", 0);

    tec.reqs.min_bashing_damage = jo.get_int("min_bashing_damage", 0);
    tec.reqs.min_cutting_damage = jo.get_int("min_cutting_damage", 0);

    tec.reqs.req_buffs = jo.get_tags("req_buffs");
    tec.reqs.req_flags = jo.get_tags("req_flags");

    tec.crit_tec = jo.get_bool("crit_tec", false);
    tec.defensive = jo.get_bool("defensive", false);
    tec.disarms = jo.get_bool("disarms", false);
    tec.dodge_counter = jo.get_bool("dodge_counter", false);
    tec.block_counter = jo.get_bool("block_counter", false);
    tec.miss_recovery = jo.get_bool("miss_recovery", false);
    tec.grab_break = jo.get_bool("grab_break", false);
    tec.flaming = jo.get_bool("flaming", false);    

    tec.hit = jo.get_int("pain", 0);
    tec.bash = jo.get_int("bash", 0);
    tec.cut = jo.get_int("cut", 0);
    tec.pain = jo.get_int("pain", 0);

    tec.weighting = jo.get_int("weighting", 1);

    tec.bash_mult = jo.get_float("bash_mult", 1.0);
    tec.cut_mult = jo.get_float("cut_mult", 1.0);
    tec.speed_mult = jo.get_float("speed_mult", 1.0);

    tec.down_dur = jo.get_int("down_dur", 0);
    tec.stun_dur = jo.get_int("stun_dur", 0);
    tec.knockback_dist = jo.get_int("knockback_dist", 0);
    tec.knockback_spread = jo.get_int("knockback_spread", 0);

    tec.aoe = jo.get_string("aoe", "");
    tec.flags = jo.get_tags("flags");
    
    ma_techniques[tec.id] = tec;
}
开发者ID:Dogeturtle,项目名称:Cataclysm-DDA,代码行数:60,代码来源:martialarts.cpp

示例5: load

void mutation_branch::load( JsonObject &jsobj )
{
    const std::string id = jsobj.get_string( "id" );
    mutation_branch &new_mut = mutation_data[id];

    JsonArray jsarr;
    new_mut.name = _(jsobj.get_string("name").c_str());
    new_mut.description = _(jsobj.get_string("description").c_str());
    new_mut.points = jsobj.get_int("points");
    new_mut.visibility = jsobj.get_int("visibility", 0);
    new_mut.ugliness = jsobj.get_int("ugliness", 0);
    new_mut.startingtrait = jsobj.get_bool("starting_trait", false);
    new_mut.mixed_effect = jsobj.get_bool("mixed_effect", false);
    new_mut.activated = jsobj.get_bool("active", false);
    new_mut.cost = jsobj.get_int("cost", 0);
    new_mut.cooldown = jsobj.get_int("time",0);
    new_mut.hunger = jsobj.get_bool("hunger",false);
    new_mut.thirst = jsobj.get_bool("thirst",false);
    new_mut.fatigue = jsobj.get_bool("fatigue",false);
    new_mut.valid = jsobj.get_bool("valid", true);
    new_mut.purifiable = jsobj.get_bool("purifiable", true);
    new_mut.initial_ma_styles = jsobj.get_string_array( "initial_ma_styles" );
    new_mut.threshold = jsobj.get_bool("threshold", false);
    new_mut.profession = jsobj.get_bool("profession", false);

    load_mutation_mods(jsobj, "passive_mods", new_mut.mods);
    /* Not currently supported due to inability to save active mutation state
    load_mutation_mods(jsobj, "active_mods", new_mut.mods); */

    new_mut.prereqs = jsobj.get_string_array( "prereqs" );
    // Helps to be able to have a trait require more than one other trait
    // (Individual prereq-lists are "OR", not "AND".)
    // Traits shoud NOT appear in both lists for a given mutation, unless
    // you want that trait to satisfy both requirements.
    // These are additional to the first list.
    new_mut.prereqs2 = jsobj.get_string_array( "prereqs2" );
    // Dedicated-purpose prereq slot for Threshold mutations
    // Stuff like Huge might fit in more than one mutcat post-threshold, so yeah
    new_mut.threshreq = jsobj.get_string_array( "threshreq" );
    new_mut.cancels = jsobj.get_string_array( "cancels" );
    new_mut.replacements = jsobj.get_string_array( "changes_to" );
    new_mut.additions = jsobj.get_string_array( "leads_to" );
    jsarr = jsobj.get_array("category");
    while (jsarr.has_more()) {
        std::string s = jsarr.next_string();
        new_mut.category.push_back(s);
        mutations_category[s].push_back(id);
    }
    jsarr = jsobj.get_array("wet_protection");
    while (jsarr.has_more()) {
        JsonObject jo = jsarr.next_object();
        std::string part_id = jo.get_string("part");
        int ignored = jo.get_int("ignored", 0);
        int neutral = jo.get_int("neutral", 0);
        int good = jo.get_int("good", 0);
        tripoint protect = tripoint(ignored, neutral, good);
        new_mut.protection[part_id] = mutation_wet(body_parts[part_id], protect);
    }
}
开发者ID:Camkitsune,项目名称:Cataclysm-DDA,代码行数:59,代码来源:mutation_data.cpp

示例6: load

bool map_bash_info::load(JsonObject &jsobj, std::string member, bool isfurniture) {
    if( !jsobj.has_object(member) ) {
        return false;
    }

    JsonObject j = jsobj.get_object(member);
    str_min = j.get_int("str_min", 0);
    str_max = j.get_int("str_max", 0);

    str_min_blocked = j.get_int("str_min_blocked", -1);
    str_max_blocked = j.get_int("str_max_blocked", -1);

    str_min_supported = j.get_int("str_min_supported", -1);
    str_max_supported = j.get_int("str_max_supported", -1);

    str_min_roll = j.get_int("str_min_roll", str_min);
    str_max_roll = j.get_int("str_min_roll", str_max);

    explosive = j.get_int("explosive", -1);

    sound_vol = j.get_int("sound_vol", -1);
    sound_fail_vol = j.get_int("sound_fail_vol", -1);

    collapse_radius = j.get_int( "collapse_radius", 1 );

    destroy_only = j.get_bool("destroy_only", false);

    bash_below = j.get_bool("bash_below", false);

    sound = j.get_string("sound", _("smash!"));
    sound_fail = j.get_string("sound_fail", _("thump!"));

    if( isfurniture ) {
        furn_set = j.get_string("furn_set", "f_null");
    } else {
        ter_set = j.get_string( "ter_set" );
    }

    if( j.has_member( "items" ) ) {
        JsonIn& stream = *j.get_raw( "items" );
        drop_group = item_group::load_item_group( stream, "collection" );
    } else {
        drop_group = "EMPTY_GROUP";
    }

    if( j.has_array("tent_centers") ) {
        load_map_bash_tent_centers( j.get_array("tent_centers"), tent_centers );
    }

    return true;
}
开发者ID:CliffsDover,项目名称:Cataclysm-DDA,代码行数:51,代码来源:mapdata.cpp

示例7: deserialize

void auto_pickup::deserialize(JsonIn &jsin)
{
    vRules[(bChar) ? CHARACTER : GLOBAL].clear();

    jsin.start_array();
    while (!jsin.end_array()) {
        JsonObject jo = jsin.get_object();

        const std::string sRule = jo.get_string("rule");
        const bool bActive = jo.get_bool("active");
        const bool bExclude = jo.get_bool("exclude");

        vRules[(bChar) ? CHARACTER : GLOBAL].push_back(cRules(sRule, bActive, bExclude));
    }
}
开发者ID:DearVarun,项目名称:Cataclysm-DDA,代码行数:15,代码来源:auto_pickup.cpp

示例8: load

void trap::load( JsonObject &jo )
{
    std::unique_ptr<trap> trap_ptr( new trap() );
    trap &t = *trap_ptr;

    if( jo.has_member( "drops" ) ) {
        JsonArray drops_list = jo.get_array( "drops" );
        while( drops_list.has_more() ) {
            t.components.push_back( drops_list.next_string() );
        }
    }
    t.name = jo.get_string( "name" );
    if( !t.name.empty() ) {
        t.name = _( t.name.c_str() );
    }
    t.id = trap_str_id( jo.get_string( "id" ) );
    t.loadid = trap_id( traplist.size() );
    t.color = color_from_string( jo.get_string( "color" ) );
    t.sym = jo.get_string( "symbol" ).at( 0 );
    t.visibility = jo.get_int( "visibility" );
    t.avoidance = jo.get_int( "avoidance" );
    t.difficulty = jo.get_int( "difficulty" );
    t.act = trap_function_from_string( jo.get_string( "action" ) );
    t.benign = jo.get_bool( "benign", false );
    t.funnel_radius_mm = jo.get_int( "funnel_radius", 0 );
    t.trigger_weight = jo.get_int( "trigger_weight", -1 );

    trapmap[t.id] = t.loadid;
    traplist.push_back( &t );
    trap_ptr.release();
    if( t.is_funnel() ) {
        funnel_traps.push_back( &t );
    }
}
开发者ID:CliffsDover,项目名称:Cataclysm-DDA,代码行数:34,代码来源:trap.cpp

示例9: load_trap

void game::load_trap(JsonObject &jo)
{
    std::vector<std::string> drops;
    if(jo.has_member("drops")) {
        JsonArray drops_list = jo.get_array("drops");
        while(drops_list.has_more()) {
            drops.push_back(drops_list.next_string());
        }
    }

    trap *new_trap = new trap(
            jo.get_string("id"), // "tr_beartrap"
            g->traps.size(),     // tr_beartrap
            jo.get_string("name"), // "bear trap"
            color_from_string(jo.get_string("color")),
            jo.get_string("symbol").at(0),
            jo.get_int("visibility"),
            jo.get_int("avoidance"),
            jo.get_int("difficulty"),
            trap_function_from_string(jo.get_string("player_action")),
            trap_function_mon_from_string(jo.get_string("monster_action")),
            drops
    );
    
    new_trap->benign = jo.get_bool("benign", false);
    new_trap->funnel_radius_mm = jo.get_int("funnel_radius", 0);
    trapmap[new_trap->id] = new_trap->loadid;
    traps.push_back(new_trap);
}
开发者ID:Doffeh,项目名称:Cataclysm-DDA,代码行数:29,代码来源:trapdef.cpp

示例10: deserialize

void it_artifact_armor::deserialize(JsonObject &jo)
{
    id = jo.get_string("id");
    name = jo.get_string("name");
    description = jo.get_string("description");
    sym = jo.get_int("sym");
    color = int_to_color(jo.get_int("color"));
    price = jo.get_int("price");
    m1 = jo.get_string("m1");
    m2 = jo.get_string("m2");
    volume = jo.get_int("volume");
    weight = jo.get_int("weight");
    melee_dam = jo.get_int("melee_dam");
    melee_cut = jo.get_int("melee_cut");
    m_to_hit = jo.get_int("m_to_hit");
    item_tags = jo.get_tags("item_flags");

    covers = jo.get_int("covers");
    encumber = jo.get_int("encumber");
    coverage = jo.get_int("coverage");
    thickness = jo.get_int("material_thickness");
    env_resist = jo.get_int("env_resist");
    warmth = jo.get_int("warmth");
    storage = jo.get_int("storage");
    power_armor = jo.get_bool("power_armor");

    JsonArray ja = jo.get_array("effects_worn");
    while (ja.has_more()) {
        effects_worn.push_back((art_effect_passive)ja.next_int());
    }
}
开发者ID:Hadesfire27,项目名称:Cataclysm-DDA,代码行数:31,代码来源:artifact.cpp

示例11: load_trap

void load_trap(JsonObject &jo)
{
    std::vector<std::string> drops;
    if(jo.has_member("drops")) {
        JsonArray drops_list = jo.get_array("drops");
        while(drops_list.has_more()) {
            drops.push_back(drops_list.next_string());
        }
    }

    std::string name = jo.get_string("name");
    if (!name.empty()) {
        name = _(name.c_str());
    }
    trap *new_trap = new trap(
            jo.get_string("id"), // "tr_beartrap"
            traplist.size(),     // tr_beartrap
            name, // "bear trap"
            color_from_string(jo.get_string("color")),
            jo.get_string("symbol").at(0),
            jo.get_int("visibility"),
            jo.get_int("avoidance"),
            jo.get_int("difficulty"),
            trap_function_from_string(jo.get_string("action")),
            drops
    );

    new_trap->benign = jo.get_bool("benign", false);
    new_trap->funnel_radius_mm = jo.get_int("funnel_radius", 0);
    new_trap->trigger_weight = jo.get_int("trigger_weight", -1);
    trapmap[new_trap->id] = new_trap->loadid;
    traplist.push_back(new_trap);
}
开发者ID:Krutchen,项目名称:Cataclysm-DDA,代码行数:33,代码来源:trapdef.cpp

示例12: load_item_group

// Load an item group from JSON
void Item_factory::load_item_group(JsonObject &jsobj)
{
    Item_tag group_id = jsobj.get_string("id");
    Item_group *current_group;
    if (m_template_groups.count(group_id) > 0) {
        current_group = m_template_groups[group_id];
    } else {
        current_group = new Item_group(group_id);
        m_template_groups[group_id] = current_group;
    }

    current_group->m_guns_have_ammo = jsobj.get_bool("guns_have_ammo", current_group->m_guns_have_ammo);

    JsonArray items = jsobj.get_array("items");
    while (items.has_more()) {
        JsonArray pair = items.next_array();
        current_group->add_entry(pair.get_string(0), pair.get_int(1));
    }

    JsonArray groups = jsobj.get_array("groups");
    while (groups.has_more()) {
        JsonArray pair = groups.next_array();
        std::string name = pair.get_string(0);
        int frequency = pair.get_int(1);
        if (m_template_groups.count(name) == 0) {
            m_template_groups[name] = new Item_group(name);
        }
        current_group->add_group(m_template_groups[name], frequency);
    }
}
开发者ID:Liberthas,项目名称:Cataclysm-DDA,代码行数:31,代码来源:item_factory.cpp

示例13: load

bool map_bash_info::load(JsonObject &jsobj, std::string member, bool isfurniture) {
    if( jsobj.has_object(member) ) {
        JsonObject j = jsobj.get_object(member);
        str_min = j.get_int("str_min", 0);
        str_max = j.get_int("str_max", 0);

        str_min_blocked = j.get_int("str_min_blocked", -1);
        str_max_blocked = j.get_int("str_max_blocked", -1);

        str_min_roll = j.get_int("str_min_roll", str_min);
        str_max_roll = j.get_int("str_min_roll", str_max);

        explosive = j.get_int("explosive", -1);

        destroy_only = j.get_bool("destroy_only", false);

        sound = j.get_string("sound", _("smash!"));
        sound_fail = j.get_string("sound_fail", _("thump!"));

        if (isfurniture) {
            furn_set = j.get_string("furn_set", "f_null");
        } else {
            ter_set = j.get_string("ter_set");
        }

        if ( j.has_array("items") ) {
            load_map_bash_item_drop_list(j.get_array("items"), items);
        }

        return true;
    } else {
        return false;
    }
}
开发者ID:3721assistant,项目名称:Cataclysm-DDA,代码行数:34,代码来源:mapdata.cpp

示例14: load

void gun_actor::load( JsonObject &obj )
{
    // Mandatory
    gun_type = obj.get_string( "gun_type" );
    ammo_type = obj.get_string( "ammo_type" );

    JsonArray jarr = obj.get_array( "fake_skills" );
    while( jarr.has_more() ) {
        JsonArray cur = jarr.next_array();
        fake_skills[skill_id( cur.get_string( 0 ) )] = cur.get_int( 1 );
    }

    range = obj.get_float( "range" );
    description = obj.get_string( "description" );
    move_cost = obj.get_int( "move_cost" );
    targeting_cost = obj.get_int( "targeting_cost" );

    // Optional:
    max_ammo = obj.get_int( "max_ammo", INT_MAX );

    fake_str = obj.get_int( "fake_str", 8 );
    fake_dex = obj.get_int( "fake_dex", 8 );
    fake_int = obj.get_int( "fake_int", 8 );
    fake_per = obj.get_int( "fake_per", 8 );

    require_targeting_player = obj.get_bool( "require_targeting_player", true );
    require_targeting_npc = obj.get_bool( "require_targeting_npc", false );
    require_targeting_monster = obj.get_bool( "require_targeting_monster", false );
    targeting_timeout = obj.get_int( "targeting_timeout", 8 );
    targeting_timeout_extend = obj.get_int( "targeting_timeout_extend", 3 );

    burst_limit = obj.get_int( "burst_limit", INT_MAX );

    laser_lock = obj.get_bool( "laser_lock", false );

    range_no_burst = obj.get_float( "range_no_burst", range + 1 );

    if( obj.has_member( "targeting_sound" ) || obj.has_member( "targeting_volume" ) ) {
        // Both or neither, but not just one
        targeting_sound = obj.get_string( "targeting_sound" );
        targeting_volume = obj.get_int( "targeting_volume" );
    }

    // Sound of no ammo
    no_ammo_sound = obj.get_string( "no_ammo_sound", "" );
}
开发者ID:Maeyanie,项目名称:Cataclysm-DDA,代码行数:46,代码来源:mattack_actors.cpp

示例15: load

void mutation_category_trait::load( JsonObject &jsobj )
{
    mutation_category_trait new_category;
    new_category.id = jsobj.get_string( "id" );
    new_category.raw_name = jsobj.get_string( "name" );
    new_category.threshold_mut = trait_id( jsobj.get_string( "threshold_mut" ) );

    new_category.raw_mutagen_message = jsobj.get_string( "mutagen_message" );
    new_category.mutagen_hunger  = jsobj.get_int( "mutagen_hunger", 10 );
    new_category.mutagen_thirst  = jsobj.get_int( "mutagen_thirst", 10 );
    new_category.mutagen_pain    = jsobj.get_int( "mutagen_pain", 2 );
    new_category.mutagen_fatigue = jsobj.get_int( "mutagen_fatigue", 5 );
    new_category.mutagen_morale  = jsobj.get_int( "mutagen_morale", 0 );
    new_category.raw_iv_message = jsobj.get_string( "iv_message" );
    new_category.iv_min_mutations    = jsobj.get_int( "iv_min_mutations", 1 );
    new_category.iv_additional_mutations = jsobj.get_int( "iv_additional_mutations", 2 );
    new_category.iv_additional_mutations_chance = jsobj.get_int( "iv_additional_mutations_chance", 3 );
    new_category.iv_hunger   = jsobj.get_int( "iv_hunger", 10 );
    new_category.iv_thirst   = jsobj.get_int( "iv_thirst", 10 );
    new_category.iv_pain     = jsobj.get_int( "iv_pain", 2 );
    new_category.iv_fatigue  = jsobj.get_int( "iv_fatigue", 5 );
    new_category.iv_morale   = jsobj.get_int( "iv_morale", 0 );
    new_category.iv_morale_max   = jsobj.get_int( "iv_morale_max", 0 );
    new_category.iv_sound = jsobj.get_bool( "iv_sound", false );
    new_category.raw_iv_sound_message = jsobj.get_string( "iv_sound_message",
                                        translate_marker( "You inject yoursel-arRGH!" ) );
    new_category.raw_iv_sound_id = jsobj.get_string( "iv_sound_id", "shout" );
    new_category.raw_iv_sound_variant = jsobj.get_string( "iv_sound_variant", "default" );
    new_category.iv_noise = jsobj.get_int( "iv_noise", 0 );
    new_category.iv_sleep = jsobj.get_bool( "iv_sleep", false );
    new_category.raw_iv_sleep_message = jsobj.get_string( "iv_sleep_message",
                                        translate_marker( "You fall asleep." ) );
    new_category.iv_sleep_dur = jsobj.get_int( "iv_sleep_dur", 0 );
    static_cast<void>( translate_marker_context( "memorial_male", "Crossed a threshold" ) );
    static_cast<void>( translate_marker_context( "memorial_female", "Crossed a threshold" ) );
    new_category.raw_memorial_message = jsobj.get_string( "memorial_message",
                                        "Crossed a threshold" );
    new_category.raw_junkie_message = jsobj.get_string( "junkie_message",
                                      translate_marker( "Oh, yeah! That's the stuff!" ) );

    mutation_category_traits[new_category.id] = new_category;
}
开发者ID:ymber,项目名称:Cataclysm-DDA,代码行数:42,代码来源:mutation_data.cpp


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