eco2d/code/apps/server/source/utils/options.c

24 lines
603 B
C
Raw Normal View History

2021-01-11 21:23:43 +00:00
#include <stdio.h>
2021-01-11 13:47:14 +00:00
#include "world/world.h"
#include "world/blocks.h"
#include "utils/options.h"
2021-01-17 11:05:29 +00:00
void generate_minimap(int32_t seed, uint16_t chunk_size, uint16_t chunk_amount) {
world_init(seed, chunk_size, chunk_size, chunk_amount, chunk_amount);
2021-01-11 20:25:09 +00:00
uint8_t const *world;
2021-01-17 11:05:29 +00:00
uint32_t world_size = chunk_size * chunk_amount;
2021-01-11 16:20:12 +00:00
uint32_t len = world_buf(&world, NULL);
2021-01-17 11:05:29 +00:00
2021-01-11 16:20:12 +00:00
for (int i=0; i<len; i++) {
2021-01-11 20:25:09 +00:00
if (i > 0 && i % world_size == 0) {
2021-01-11 21:23:43 +00:00
putc('\n', stdout);
2021-01-11 13:47:14 +00:00
}
2021-01-11 21:23:43 +00:00
putc(blocks_get_symbol(world[i]), stdout);
2021-01-11 13:47:14 +00:00
}
2021-01-17 11:05:29 +00:00
2021-01-11 21:23:43 +00:00
putc('\n', stdout);
2021-01-11 16:20:12 +00:00
world_destroy();
2021-01-11 13:47:14 +00:00
}