aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <weiss@jade.(none)>2008-08-11 13:07:43 +0100
committerThomas White <weiss@jade.(none)>2008-08-11 13:07:43 +0100
commita4f631336e4f8816d4a58edd2c962cccee94c3a6 (patch)
tree9a2e085b7926ec61ba023cf867965ba5425e13f4
parentefe08407f3083ca55916cc91cd5a2b9d743ff754 (diff)
Subdivision fixes
-rw-r--r--src/model.c2
-rw-r--r--src/physics.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/model.c b/src/model.c
index f98d4bc..8abbc42 100644
--- a/src/model.c
+++ b/src/model.c
@@ -326,7 +326,7 @@ static int model_load(ModelContext *ctx, const char *name, RenderContext *render
/* Subdivide the previous face if requested */
if ( !coll && subdiv && (sscanf(line, "subdivide %f %f", &x, &y) == 2) ) {
if ( type == PRIMITIVE_QUADS ) {
- if ( (num_vertices % 4)==0 ) {
+ if ( (num_vertices > 0) && ((num_vertices % 4)==0) ) {
GLfloat u, v;
GLfloat v1x, v1y, v1z;
GLfloat v2x, v2y, v2z;
diff --git a/src/physics.c b/src/physics.c
index 7b6b2b7..08295a9 100644
--- a/src/physics.c
+++ b/src/physics.c
@@ -238,8 +238,10 @@ static int physics_collision_room(ModelInstance *obj, Game *game, double dt, Col
if ( room != NULL ) {
int j;
for ( j=0; j<room->num_objects; j++ ) {
- if ( physics_check_collide(obj, room->objects[j], dt, coll, room, game) ) {
- found = 1;
+ if ( room->objects[j] != NULL ) {
+ if ( physics_check_collide(obj, room->objects[j], dt, coll, room, game) ) {
+ found = 1;
+ }
}
}
}