mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
Optimize parameter passing to avoid unnecessary copying
This commit is contained in:
parent
46ca1bb04a
commit
f25a425cb9
123 changed files with 578 additions and 522 deletions
|
|
@ -31,7 +31,7 @@ std::shared_ptr<Inventory> Inventories::createVirtual(size_t size) {
|
|||
});
|
||||
}
|
||||
|
||||
void Inventories::store(std::shared_ptr<Inventory> inv) {
|
||||
void Inventories::store(const std::shared_ptr<Inventory>& inv) {
|
||||
map[inv->getId()] = inv;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
std::shared_ptr<Inventory> createVirtual(size_t size);
|
||||
|
||||
/* Store inventory */
|
||||
void store(std::shared_ptr<Inventory> inv);
|
||||
void store(const std::shared_ptr<Inventory>& inv);
|
||||
|
||||
/* Remove inventory from map */
|
||||
void remove(int64_t id);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "ItemDef.hpp"
|
||||
#include "../util/stringutil.hpp"
|
||||
|
||||
ItemDef::ItemDef(std::string name) : name(name) {
|
||||
ItemDef::ItemDef(const std::string& name) : name(name) {
|
||||
caption = util::id_to_caption(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
bool emissive = false;
|
||||
} rt;
|
||||
|
||||
ItemDef(std::string name);
|
||||
ItemDef(const std::string& name);
|
||||
ItemDef(const ItemDef&) = delete;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue