made items affect stats
This commit is contained in:
24
types.h
24
types.h
@@ -57,23 +57,37 @@ enum ItemType {
|
||||
|
||||
template <>
|
||||
struct std::formatter<ItemType> : std::formatter<string_view> {
|
||||
bool title_case = false;
|
||||
|
||||
constexpr auto parse(std::format_parse_context& ctx) {
|
||||
auto it = ctx.begin();
|
||||
if (it == ctx.end()) return it;
|
||||
|
||||
if (*it == 't') {
|
||||
title_case = true;
|
||||
++it;
|
||||
}
|
||||
|
||||
return it;
|
||||
}
|
||||
|
||||
auto format(const ItemType& item_type, std::format_context& ctx) const {
|
||||
std::string_view item_type_str;
|
||||
switch (item_type) {
|
||||
case TEARS_UP:
|
||||
item_type_str = "TEARS_UP";
|
||||
item_type_str = title_case ? "Tears Up" : "TEARS_UP";
|
||||
break;
|
||||
case TEARS_DOWN:
|
||||
item_type_str = "TEARS_DOWN";
|
||||
item_type_str = title_case ? "Tears Down" : "TEARS_DOWN";
|
||||
break;
|
||||
case RANGE_UP:
|
||||
item_type_str = "RANGE_UP";
|
||||
item_type_str = title_case ? "Range Up" : "RANGE_UP";
|
||||
break;
|
||||
case RANGE_DOWN:
|
||||
item_type_str = "RANGE_DOWN";
|
||||
item_type_str = title_case ? "Range Down" : "RANGE_DOWN";
|
||||
break;
|
||||
case ITEM_TYPE_COUNT:
|
||||
item_type_str = "ITEM_TYPE_COUNT";
|
||||
item_type_str = title_case ? "Item Type Count" : "ITEM_TYPE_COUNT";
|
||||
break;
|
||||
}
|
||||
return std::formatter<string_view>::format(item_type_str, ctx);;
|
||||
|
||||
Reference in New Issue
Block a user