void magic_free_env(dumb_ptr<env_t> env) { for (int i = 0; i < env->base_env->varv.size(); i++) magic_clear_var(&env->varu[i]); // handled by std::unique_ptr now. Was a memory leak before. // delete[] env->vars; env.delete_(); }
static void intify (val_t * v) { if (v->ty == TY_INT) return; magic_clear_var (v); v->ty = TY_INT; v->v.v_int = 1; }
static void spell_set_location(dumb_ptr<invocation> invocation, dumb_ptr<block_list> entity) { magic_clear_var(&invocation->env->varu[VAR_LOCATION]); invocation->env->varu[VAR_LOCATION].ty = TYPE::LOCATION; invocation->env->varu[VAR_LOCATION].v.v_location.m = entity->bl_m; invocation->env->varu[VAR_LOCATION].v.v_location.x = entity->bl_x; invocation->env->varu[VAR_LOCATION].v.v_location.y = entity->bl_y; }