mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
New world format, fixes
This commit is contained in:
parent
0c65b13f4e
commit
0cf8382e95
21 changed files with 350 additions and 173 deletions
16
src/world/LevelEvents.cpp
Normal file
16
src/world/LevelEvents.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include "LevelEvents.h"
|
||||
#include "../voxels/Chunk.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
void LevelEvents::listen(lvl_event_type type, chunk_event_func func) {
|
||||
auto& callbacks = chunk_callbacks[type];
|
||||
callbacks.push_back(func);
|
||||
}
|
||||
|
||||
void LevelEvents::trigger(lvl_event_type type, Chunk* chunk) {
|
||||
auto& callbacks = chunk_callbacks[type];
|
||||
for (chunk_event_func func : callbacks) {
|
||||
func(type, chunk);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue