void mission::load_info(std::istream &data) { int type_id, rewtype, reward_id, rew_skill, tmpfollow, item_num, target_npc_id; std::string rew_item, itemid; data >> type_id; type = mission_type::get( mission_type::from_legacy( type_id ) ); std::string tmpdesc; do { data >> tmpdesc; if (tmpdesc != "<>") { description += tmpdesc + " "; } } while (tmpdesc != "<>"); description = description.substr( 0, description.size() - 1 ); // Ending ' ' bool failed; // Dummy, no one has saves this old data >> failed >> value >> rewtype >> reward_id >> rew_item >> rew_skill >> uid >> target.x >> target.y >> itemid >> item_num >> deadline >> npc_id >> good_fac_id >> bad_fac_id >> step >> tmpfollow >> target_npc_id; target.z = 0; follow_up = mission_type::from_legacy(tmpfollow); reward.type = npc_favor_type(reward_id); reward.item_id = itype_id( rew_item ); reward.skill = Skill::from_legacy_int( rew_skill ); item_id = itype_id(itemid); item_count = int(item_num); }
void npc_favor::deserialize(JsonIn &jsin) { JsonObject jo = jsin.get_object(); type = npc_favor_type(jo.get_int("type")); jo.read("value", value); jo.read("itype_id", item_id); skill = NULL; if (jo.has_int("skill_id")) { skill = Skill::skill(jo.get_int("skill_id")); } else if (jo.has_string("skill_id")) { skill = Skill::skill(jo.get_string("skill_id")); } }