-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
Description
CMakeLists.txt
Line 114 -> components/item.cpp should most likely be components/items/item.cpp
/systems/helpers/inventory_assistant.hpp
template <class ITEM_TYPE>
std::size_t claim_closest_item_by_category(position_t &pos, const int range) {
// We're taking advantage of map being sorted to find the closest here
std::map<float, std::size_t> distance_sorted;
**each**<item_t, ITEM_TYPE>([&distance_sorted, **&category**, &pos, &range](bengine::entity_t &e, item_t &i, ITEM_TYPE &type) {
if (e.component<claimed_t>() == nullptr) {
auto p = get_item_location(e.id);
if (p) {
const float distance = distance3d_squared(pos.x, pos.y, pos.z, p->x, p->y, p->z);
if (range == -1 || distance < range) distance_sorted[distance] = e.id;
}
}
});
if (distance_sorted.empty()) return 0;
std::size_t closest_matching_id = distance_sorted.begin()->second;
systems::**inventory_system**::claim_item(closest_matching_id, true);
return closest_matching_id;
}
each should be most likely bengine::each / or the namespace is missing like in the other template
category isn't defined
inventory_system isn't defined
hope this helps a little