if (old) {
*state = *old;
- state->strs = array_create(sizeof(char *));
-
- for (size_t i = 0; i < old->strs.siz; i++) {
- char *s = strdup(((char **) old->strs.ptr)[i]);
- array_append(&state->strs, &s);
- }
} else {
state->pos[0] = 0.0f;
state->pos[1] = 0.0f;
state->s = 0.0f;
state->l = 1.0f;
state->life = 0;
-
- state->strs = array_create(sizeof(char *));
- char *s = format_string("glm.mat4()\n");
- array_append(&state->strs, &s);
}
return state;
return ctx;
}
-static void delete_state(VoxelctxState *state)
-{
- for (size_t i = 0; i < state->strs.siz; i++)
- free(((char **) state->strs.ptr)[i]);
-
- free(state->strs.ptr);
-}
-
static void list_delete_state(void *key, unused void *value, unused void *arg)
{
- delete_state(key);
free(key);
}
void voxelctx_pop(Voxelctx *ctx)
{
ListPair *next = ctx->statestack.first->next;
- delete_state(ctx->statestack.first->key);
free(ctx->statestack.first->key);
free(ctx->statestack.first);
ctx->statestack.first = next;
#include <dragontype/number.h>
#include "server/server_map.h"
-
-
-#include <dragontype/array.h>
-
-
typedef struct
{
vec4 pos;
mat4x4 mat;
f32 h, s, l;
s32 life;
- Array strs;
} VoxelctxState;
typedef struct