| 159 | } |
| 160 | |
| 161 | string ItemTypeInfo::toString() |
| 162 | { using namespace df::enums::item_type; |
| 163 | switch (type) |
| 164 | { |
| 165 | #define ITEM(type,vec,tclass) \ |
| 166 | case type: \ |
| 167 | if (VIRTUAL_CAST_VAR(cv, df::tclass, custom)) \ |
| 168 | return cv->name; |
| 169 | ITEMDEF_VECTORS |
| 170 | #undef ITEM |
| 171 | |
| 172 | default: |
| 173 | break; |
| 174 | } |
| 175 | |
| 176 | if (const char *name = ENUM_ATTR(item_type, caption, type)) |
| 177 | return name; |
| 178 | return toLower_cp437(ENUM_KEY_STR(item_type, type)); |
| 179 | } |
| 180 | |
| 181 | bool ItemTypeInfo::find(const string &token) |
| 182 | { using namespace df::enums::item_type; |
no test coverage detected