fix out-of-scope stack memory use

This commit is contained in:
jacob 2025-02-14 12:23:26 -06:00
parent be5d10e2b0
commit 440a051dba

View File

@ -425,7 +425,7 @@ void sim_update(struct sim_ctx *ctx, i64 target_dt_ns)
/* Release old snapshots */
{
/* TODO: Something better */
i64 release_tick = (i64)ctx->world->tick - 100; /* Arbitrary tick offset */
i64 release_tick = (i64)ctx->world->tick - 25; /* Arbitrary tick offset */
if (release_tick > 0) {
struct sim_snapshot *old = sim_snapshot_from_tick(ctx->snapshot_store, release_tick);
if (old->valid) {
@ -923,7 +923,8 @@ void sim_update(struct sim_ctx *ctx, i64 target_dt_ns)
bullet->bullet_src = ent->handle;
bullet->bullet_src_pos = rel_pos;
bullet->bullet_src_dir = rel_dir;
bullet->bullet_impulse = 0.75f;
//bullet->bullet_impulse = 0.75f;
bullet->bullet_impulse = 2.0f;
bullet->bullet_knockback = 10;
bullet->mass_unscaled = 0.04f;
bullet->inertia_unscaled = 0.00001f;
@ -1398,10 +1399,10 @@ void sim_update(struct sim_ctx *ctx, i64 target_dt_ns)
ss0_tick = ss0->tick; /* In case ack tick is no longer in store we need to do a full resend */
struct sim_event_list l = ZI;
struct sim_event snapshot_event = ZI;
/* Create & encode snapshot event */
{
struct sim_event snapshot_event = ZI;
snapshot_event.kind = SIM_EVENT_KIND_SNAPSHOT;
snapshot_event.tick = ctx->world->tick;
snapshot_event.snapshot_tick_start = ss0_tick;