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