mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Reserve vectors before pushing and other code quality changes (#11161)
This commit is contained in:
parent
3e1904fa8c
commit
f0bad0e2ba
20 changed files with 106 additions and 108 deletions
|
@ -965,13 +965,14 @@ InventoryList * Inventory::getList(const std::string &name)
|
|||
{
|
||||
s32 i = getListIndex(name);
|
||||
if(i == -1)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return m_lists[i];
|
||||
}
|
||||
|
||||
std::vector<const InventoryList*> Inventory::getLists()
|
||||
{
|
||||
std::vector<const InventoryList*> lists;
|
||||
lists.reserve(m_lists.size());
|
||||
for (auto list : m_lists) {
|
||||
lists.push_back(list);
|
||||
}
|
||||
|
@ -990,11 +991,11 @@ bool Inventory::deleteList(const std::string &name)
|
|||
return true;
|
||||
}
|
||||
|
||||
const InventoryList * Inventory::getList(const std::string &name) const
|
||||
const InventoryList *Inventory::getList(const std::string &name) const
|
||||
{
|
||||
s32 i = getListIndex(name);
|
||||
if(i == -1)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return m_lists[i];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue