static void clear_rec(struct kdnode *node, void (*destr)(void*)) { if(!node) return; clear_rec(node->left, destr); clear_rec(node->right, destr); if(destr) { destr(node->data); } free(node->pos); free(node); }
static void clear_rec(struct kdnode *node, void (*destr)(void*)) { if(!node) return; clear_rec(node->left, destr); clear_rec(node->right, destr); if(destr) { destr(node->data); } delete[] node->pos; delete node; }
void kd_clear(struct kdtree *tree) { clear_rec(tree->root, tree->destr); tree->root = 0; if (tree->rect) { hyperrect_free(tree->rect); tree->rect = 0; } }
recorder_t * SVR_AddUser (void (*write)(void *, sizebuf_t *, int), int (*frame)(void *), void (*end_frame)(recorder_t *, void *), void (*finish)(void *, sizebuf_t *), int demo, void *user) { recorder_t *r; int i; if (!free_recorders) return 0; if (!sv.recorders) { clear_rec (); rec.pingtime = sv.time; } r = free_recorders; free_recorders = r->next; memset (r, 0, sizeof (*r)); r->next = sv.recorders; sv.recorders = r; r->delta.type = dt_tp_qtv; r->delta.pvs = dt_pvs_none; if (demo) { r->delta.type = dt_tp_demo; r->delta.pvs = dt_pvs_fat; } for (i = 0; i < UPDATE_BACKUP; i++) { r->delta.frames[i].entities.entities = r->entities[i]; r->delta.frames[i].players.players = r->players[i]; } r->delta.delta_sequence = -1; r->write = write; r->frame = frame; r->end_frame = end_frame; r->finish = finish; r->user = user; return r; }