1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 00:25:19 +02:00

Reserve vectors before pushing and other code quality changes (#11161)

This commit is contained in:
sfan5
2021-04-05 13:38:31 +02:00
committed by GitHub
parent 3e1904fa8c
commit f0bad0e2ba
20 changed files with 106 additions and 108 deletions

View File

@@ -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];
}