mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51: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
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
using std::vector;
|
||||
|
||||
void LevelEvents::listen(lvl_event_type type, chunk_event_func func) {
|
||||
void LevelEvents::listen(lvl_event_type type, const chunk_event_func& func) {
|
||||
auto& callbacks = chunk_callbacks[type];
|
||||
callbacks.push_back(func);
|
||||
}
|
||||
|
||||
void LevelEvents::trigger(lvl_event_type type, Chunk* chunk) {
|
||||
const auto& callbacks = chunk_callbacks[type];
|
||||
for (chunk_event_func func : callbacks) {
|
||||
for (const chunk_event_func& func : callbacks) {
|
||||
func(type, chunk);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue