Fix merge box crash on connect

main
Cameron Murphy Reikes 2 years ago
parent 8d32399034
commit 30f492718a

Binary file not shown.

@ -409,7 +409,7 @@ LauncherTarget missile_launcher_target(GameState *gs, Entity *launcher)
void destroy_constraints(cpBody *body, cpConstraint *constraint, void *data) void destroy_constraints(cpBody *body, cpConstraint *constraint, void *data)
{ {
((Entity*)cpConstraintGetUserData(constraint))->landed_constraint = NULL; ((Entity *)cpConstraintGetUserData(constraint))->landed_constraint = NULL;
cpSpaceRemoveConstraint(cpBodyGetSpace(body), constraint); cpSpaceRemoveConstraint(cpBodyGetSpace(body), constraint);
cpConstraintFree(constraint); cpConstraintFree(constraint);
} }
@ -534,7 +534,7 @@ void create_body(GameState *gs, Entity *e)
} }
// must always call this after creating a constraint // must always call this after creating a constraint
void on_create_constraint(Entity *e, cpConstraint* c) void on_create_constraint(Entity *e, cpConstraint *c)
{ {
cpConstraintSetUserData(c, (cpDataPointer)e); cpConstraintSetUserData(c, (cpDataPointer)e);
} }
@ -2729,7 +2729,7 @@ void process(struct GameState *gs, double dt)
#if 1 #if 1
cpVect world_hand_pos = get_world_hand_pos(gs, &player->input, p); cpVect world_hand_pos = get_world_hand_pos(gs, &player->input, p);
if(player->input.interact_action) if (player->input.interact_action)
{ {
player->input.interact_action = false; player->input.interact_action = false;
cpPointQueryInfo query_info = {0}; cpPointQueryInfo query_info = {0};
@ -2945,6 +2945,7 @@ void process(struct GameState *gs, double dt)
PROFILE_SCOPE("process entities") PROFILE_SCOPE("process entities")
{ {
ENTITIES_ITER(gs, e) ENTITIES_ITER(gs, e)
if (!e->flag_for_destruction)
{ {
if (e->body != NULL && cpvlengthsq((entity_pos(e))) > (INSTANT_DEATH_DISTANCE_FROM_CENTER * INSTANT_DEATH_DISTANCE_FROM_CENTER)) if (e->body != NULL && cpvlengthsq((entity_pos(e))) > (INSTANT_DEATH_DISTANCE_FROM_CENTER * INSTANT_DEATH_DISTANCE_FROM_CENTER))
{ {

Loading…
Cancel
Save