Results of today's code review session.
This commit is contained in:
parent
14b3ea7676
commit
f35b74f335
21 changed files with 64 additions and 59 deletions
|
@ -29,4 +29,14 @@ namespace components {
|
|||
dbc::check(at < items.size(), fmt::format("inventory index {} too big", at));
|
||||
items.erase(items.begin() + at);
|
||||
}
|
||||
|
||||
int Inventory::item_index(std::string id) {
|
||||
for(size_t i = 0; i < items.size(); i++) {
|
||||
if(items[i].data["id"] == id) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue