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
|
|
@ -1,5 +1,7 @@
|
|||
#include "Chunk.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "voxel.hpp"
|
||||
|
||||
#include "../items/Inventory.hpp"
|
||||
|
|
@ -41,7 +43,7 @@ void Chunk::updateHeights() {
|
|||
|
||||
void Chunk::addBlockInventory(std::shared_ptr<Inventory> inventory,
|
||||
uint x, uint y, uint z) {
|
||||
inventories[vox_index(x, y, z)] = inventory;
|
||||
inventories[vox_index(x, y, z)] = std::move(inventory);
|
||||
flags.unsaved = true;
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +54,7 @@ void Chunk::removeBlockInventory(uint x, uint y, uint z) {
|
|||
}
|
||||
|
||||
void Chunk::setBlockInventories(chunk_inventories_map map) {
|
||||
inventories = map;
|
||||
inventories = std::move(map);
|
||||
}
|
||||
|
||||
std::shared_ptr<Inventory> Chunk::getBlockInventory(uint x, uint y, uint z) const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue