| 219 | |
| 220 | template<typename B> |
| 221 | static 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(¤t, 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 | |
| 249 | template<typename D> |
| 250 | static df::itemdef *get_itemdef(int16_t subtype) |
no test coverage detected