icfp11/src/control.c

44 lines
950 B
C

#include "control.h"
static void telemetry_free(gpointer _te, gpointer x) {
telemetry *te = (telemetry*) _te;
UNUSED(x);
g_array_free(te->objects, TRUE);
g_slice_free(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->telemetry);
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->telemetry);
g_array_free(t->map.solid_objects, TRUE);
g_slice_free(trial, t);
}