Skip to content

Commit e2885db

Browse files
authored
Merge pull request #5636 from ab9rf/labor_kitchen_interface_food_key
df structure support
2 parents 004b4dd + c673664 commit e2885db

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!*.h
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
template<>
2+
struct std::hash<labor_kitchen_interface_food_key> {
3+
auto operator()(const labor_kitchen_interface_food_key &a) const -> size_t {
4+
struct thing {
5+
int16_t t;
6+
int16_t st;
7+
int32_t x;
8+
} thing{
9+
.t = a.type;
10+
.st = a.subtype,
11+
.x = static_cast<int32_t>(a.mat) ^ (static_cast<int32_t>(a.matg))
12+
};
13+
14+
return hash<int64_t>()(bit_cast<int64_t>(thing));
15+
}
16+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
bool operator<(const labor_kitchen_interface_food_key &b) const {
2+
if (type<b.type) return true;
3+
if (subtype<b.subtype) return true;
4+
if (mat<b.mat) return true;
5+
if (matg<b.matg) return true;
6+
return false;
7+
}
8+
9+
bool operator==(const labor_kitchen_interface_food_key &b) const {
10+
return type==b.type&&subtype==b.subtype&&mat==b.mat&&matg==b.matg;
11+
}

0 commit comments

Comments
 (0)