icfp11/src/control.c

43 lines
917 B
C

#include "control.h"
static void telemetry_free(gpointer te, gpointer x) {
UNUSED(x);
g_array_free(te->objects, TRUE);
g_slice_free(telemetry, (telemetry*) te);
}
static telemetry* telemetry_new() {
telemetry *te = g_slice_new0(telemetry);
te->objects = g_array_new(FALSE, FALSE, sizeof(object));
return te;
}
trial *trial_new() {
trial *t = g_slice_new0(trial);
g_queue_init(t->telemetry);
t->map.solid_objects = g_array_new(FALSE, FALSE, sizeof(object));
return t;
}
void trial_reset_run(trial *t) {
g_queue_foreach(t->telemetry, telemetry_free, NULL);
g_queue_clear(t->telementry);
t->last_ts = 0;
}
void trial_wait_for_start(trial *t) {
}
void trial_check_input(trial *t) {
}
void trial_wait_for_input(trial *t) {
}
void trial_free(trial *t) {
g_queue_foreach(t->telemetry, telemetry_free, NULL);
g_queue_clear(t->telementry);
g_array_free(t->map.solid_objects, TRUE);
g_slice_free(t);
}