MCPcopy Create free account
hub / github.com/DFHack/dfhack / deserialize_vector_ids

Function deserialize_vector_ids

plugins/buildingplan/plannedbuilding.cpp:37–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37static vector<vector<df::job_item_vector_id>> deserialize_vector_ids(color_ostream &out, PersistentDataItem &bld_config) {
38 vector<vector<df::job_item_vector_id>> ret;
39
40 vector<string> rawstrs;
41 split_string(&rawstrs, bld_config.get_str(), "|");
42 const string &serialized = rawstrs[0];
43
44 DEBUG(control,out).print("deserializing vector ids for building {}: {}\n",
45 bld_config.get_int(BLD_CONFIG_ID), serialized);
46
47 vector<string> joined;
48 split_string(&joined, serialized, ";");
49 for (auto &str : joined) {
50 vector<string> lst;
51 split_string(&lst, str, ",");
52 vector<df::job_item_vector_id> ids;
53 for (auto &s : lst)
54 ids.emplace_back(df::job_item_vector_id(string_to_int(s)));
55 ret.emplace_back(ids);
56 }
57
58 if (!ret.size())
59 ret = get_vector_ids(out, bld_config.get_int(BLD_CONFIG_ID));
60
61 return ret;
62}
63
64static vector<ItemFilter> get_item_filters(color_ostream &out, PersistentDataItem &bld_config) {
65 vector<string> rawstrs;

Callers 1

PlannedBuildingMethod · 0.85

Calls 5

split_stringFunction · 0.85
string_to_intFunction · 0.85
get_vector_idsFunction · 0.85
printMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected