demo: reduce code
parent
0cb52303ae
commit
3e59e59881
|
@ -350,6 +350,7 @@ int64_t world_chunk_from_entity(ecs_entity_t id) {
|
||||||
void world_chunk_replace_block(int64_t id, uint16_t block_idx, uint8_t block_id) {
|
void world_chunk_replace_block(int64_t id, uint16_t block_idx, uint8_t block_id) {
|
||||||
assert(block_idx >= 0 && block_idx < zpl_square(world.chunk_size));
|
assert(block_idx >= 0 && block_idx < zpl_square(world.chunk_size));
|
||||||
world.block_mapping[id][block_idx] = block_id;
|
world.block_mapping[id][block_idx] = block_id;
|
||||||
|
world_chunk_mark_dirty(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *world_chunk_get_blocks(int64_t id) {
|
uint8_t *world_chunk_get_blocks(int64_t id) {
|
||||||
|
|
|
@ -43,7 +43,6 @@ void DemoPlaceIceBlock(ecs_iter_t *it) {
|
||||||
if (in[i].use) {
|
if (in[i].use) {
|
||||||
world_block_lookup l = world_block_from_realpos(p[i].x, p[i].y);
|
world_block_lookup l = world_block_from_realpos(p[i].x, p[i].y);
|
||||||
world_chunk_replace_block(l.chunk_id, l.id, watr_id);
|
world_chunk_replace_block(l.chunk_id, l.id, watr_id);
|
||||||
world_chunk_mark_dirty(l.chunk_e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue