Stop it from crashing
This commit is contained in:
parent
d54ff0f18c
commit
e1afbdac3e
@ -5,6 +5,7 @@
|
||||
#include "util/tree.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static inline double dabs(double x) {
|
||||
@ -35,10 +36,12 @@ void _physics_MoveX(System_Physics *sys, Entity *e, Duration deltaTime) {
|
||||
call_hithandler(e, tohit_comp->super, vec2(delta, 0), e->hitbox->onHitData);
|
||||
if (delta > 0) {
|
||||
// Moves right, hits left edge
|
||||
fprintf(stderr, "hit left edge");
|
||||
double maxdelta = tohit.lefttop.x - mybox.lefttop.x - mybox.size.x;
|
||||
delta = maxdelta - EPS;
|
||||
} else {
|
||||
// Moves left, hits right edge
|
||||
fprintf(stderr, "hit right edge");
|
||||
double maxdelta = tohit.lefttop.x - mybox.lefttop.x + tohit.size.x;
|
||||
delta = maxdelta + EPS;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ static inline double dabs(double x) {
|
||||
System_Player *player_NewSystem(App *super) {
|
||||
System_Player *sys = malloc(sizeof(System_Player));
|
||||
sys->super = super;
|
||||
sys->player = NULL;
|
||||
return sys;
|
||||
}
|
||||
void player_DeleteSystem(System_Player *sys) {
|
||||
|
@ -131,7 +131,7 @@ tree_Node *tree_FirstNode(tree_Tree *tree) {
|
||||
tree_Node *result = tree->root;
|
||||
if (!result)
|
||||
return 0;
|
||||
while (result->right)
|
||||
while (result->left)
|
||||
result = result->left;
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user