1
0
mirror of https://github.com/p2r3/bareiron.git synced 2025-10-01 23:25:09 +02:00
Files
bareiron/src/globals.c
2025-08-21 16:37:37 +03:00

40 lines
847 B
C

#include <stdio.h>
#include <stdint.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "globals.h"
#ifdef ESP_PLATFORM
#include "esp_task_wdt.h"
#include "esp_timer.h"
// Time between vTaskDelay calls in microseconds
#define TASK_YIELD_INTERVAL 1000 * 1000
// How many ticks to delay for on each yield
#define TASK_YIELD_TICKS 1
int64_t last_yield = 0;
void task_yield () {
int64_t time_now = esp_timer_get_time();
if (time_now - last_yield < TASK_YIELD_INTERVAL) return;
vTaskDelay(TASK_YIELD_TICKS);
last_yield = time_now;
}
#endif
ssize_t recv_count;
uint8_t recv_buffer[256] = {0};
uint32_t world_seed = 0xA103DE6C;
uint32_t rng_seed = 0xE2B9419;
uint64_t world_time = 0;
uint16_t client_count;
BlockChange block_changes[20000];
int block_changes_count = 0;
PlayerData player_data[MAX_PLAYERS];