本文整理汇总了C++中JsonObject::get_long方法的典型用法代码示例。如果您正苦于以下问题:C++ JsonObject::get_long方法的具体用法?C++ JsonObject::get_long怎么用?C++ JsonObject::get_long使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonObject
的用法示例。
在下文中一共展示了JsonObject::get_long方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserialize
void it_artifact_tool::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");
max_charges = jo.get_long("max_charges");
def_charges = jo.get_long("def_charges");
std::vector<int> rand_charges;
JsonArray jarr = jo.get_array("rand_charges");
while (jarr.has_more()){
rand_charges.push_back(jarr.next_long());
}
charges_per_use = jo.get_int("charges_per_use");
turns_per_charge = jo.get_int("turns_per_charge");
ammo = jo.get_string("ammo");
revert_to = jo.get_string("revert_to");
charge_type = (art_charge)jo.get_int("charge_type");
JsonArray ja = jo.get_array("effects_wielded");
while (ja.has_more()) {
effects_wielded.push_back((art_effect_passive)ja.next_int());
}
ja = jo.get_array("effects_activated");
while (ja.has_more()) {
effects_activated.push_back((art_effect_active)ja.next_int());
}
ja = jo.get_array("effects_carried");
while (ja.has_more()) {
effects_carried.push_back((art_effect_passive)ja.next_int());
}
}
示例2: deserialize
void it_artifact_tool::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");
// LEGACY: Since it seems artifacts get serialized out to disk, and they're
// dynamic, we need to allow for them to be read from disk for, oh, I guess
// quite some time. Loading and saving once will write things out as a JSON
// array.
if (jo.has_string("m1")) {
materials.push_back(jo.get_string("m1"));
}
if (jo.has_string("m2")) {
materials.push_back(jo.get_string("m2"));
}
// Assumption, perhaps dangerous, that we won't wind up with m1 and m2 and
// a materials array in our serialized objects at the same time.
if (jo.has_array("materials")) {
JsonArray jarr = jo.get_array("materials");
for (int i = 0; i < jarr.size(); ++i) {
materials.push_back(jarr.get_string(i));
}
}
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");
max_charges = jo.get_long("max_charges");
def_charges = jo.get_long("def_charges");
std::vector<int> rand_charges;
JsonArray jarr = jo.get_array("rand_charges");
while (jarr.has_more()) {
rand_charges.push_back(jarr.next_long());
}
charges_per_use = jo.get_int("charges_per_use");
turns_per_charge = jo.get_int("turns_per_charge");
ammo = jo.get_string("ammo");
revert_to = jo.get_string("revert_to");
charge_type = (art_charge)jo.get_int("charge_type");
JsonArray ja = jo.get_array("effects_wielded");
while (ja.has_more()) {
effects_wielded.push_back((art_effect_passive)ja.next_int());
}
ja = jo.get_array("effects_activated");
while (ja.has_more()) {
effects_activated.push_back((art_effect_active)ja.next_int());
}
ja = jo.get_array("effects_carried");
while (ja.has_more()) {
effects_carried.push_back((art_effect_passive)ja.next_int());
}
if( item_tags.count( "CHOP" ) > 0 ) {
item_tags.insert( "SHEATH_SWORD" );
}
if( item_tags.count( "STAB" ) > 0 ) {
item_tags.insert( "SHEATH_KNIFE" );
}
}