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

Function json_array_to_bitfield

plugins/orders.cpp:221–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219
220template<typename B>
221static void json_array_to_bitfield(B & bits, Json::Value & arr)
222{
223 if (arr.size() == 0)
224 {
225 return;
226 }
227
228 for (Json::ArrayIndex i = arr.size(); i != 0; i--)
229 {
230 if (!arr[i - 1].isString())
231 {
232 continue;
233 }
234
235 std::string str(arr[i - 1].asString());
236
237 int current;
238 if (get_bitfield_field(&current, bits, str))
239 {
240 if (!current && set_bitfield_field(&bits, str, 1))
241 {
242 Json::Value removed;
243 arr.removeIndex(i - 1, &removed);
244 }
245 }
246 }
247}
248
249template<typename D>
250static df::itemdef *get_itemdef(int16_t subtype)

Callers 1

orders_importFunction · 0.85

Calls 3

get_bitfield_fieldFunction · 0.85
set_bitfield_fieldFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected