Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/include/df/custom/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.h
16 changes: 16 additions & 0 deletions library/include/df/custom/hash/labor_kitchen_interface_food_key.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
template<>
struct std::hash<labor_kitchen_interface_food_key> {
auto operator()(const labor_kitchen_interface_food_key &a) const -> size_t {
struct thing {
int16_t t;
int16_t st;
int32_t x;
} thing{
.t = a.type;
.st = a.subtype,
.x = static_cast<int32_t>(a.mat) ^ (static_cast<int32_t>(a.matg))
};

return hash<int64_t>()(bit_cast<int64_t>(thing));
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bool operator<(const labor_kitchen_interface_food_key &b) const {
if (type<b.type) return true;
if (subtype<b.subtype) return true;
if (mat<b.mat) return true;
if (matg<b.matg) return true;
return false;
}

bool operator==(const labor_kitchen_interface_food_key &b) const {
return type==b.type&&subtype==b.subtype&&mat==b.mat&&matg==b.matg;
}