Update of /cvsroot/timewarp/source/melee
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32436/source/melee
Modified Files:
mframe.cpp
Log Message:
bug-hunt changes
Index: mframe.cpp
===================================================================
RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** mframe.cpp 27 Sep 2005 22:03:55 -0000 1.49
--- mframe.cpp 5 Oct 2005 20:21:27 -0000 1.50
***************
*** 644,648 ****
}
! inline void check_vector_sanity(Vector2 &v)
{
#ifdef _DEBUG
--- 644,648 ----
}
! static void check_vector_sanity(Vector2 &v)
{
#ifdef _DEBUG
***************
*** 1075,1089 ****
}
- #ifdef _DEBUG
- SpaceObject *c1 = this;
- SpaceObject *c2 = other;
- if (fabs(c1->vel.x) > 1E6 || fabs(c1->vel.y) > 1E6 || fabs(c2->vel.x) > 1E6 || fabs(c2->vel.y) > 1E6 )
- {
- int a1 = c1->canCollide(c2);
- int a2 = c2->canCollide(c1);
- bool b = ((c1->canCollide(c2) & c2->canCollide(c1)) == 0 );
- tw_error("velocity error in collision involving objects [%s] and [%s]", c1->get_identity(), c2->get_identity());
- }
- #endif
Vector2 nd;
--- 1075,1078 ----
***************
*** 1107,1110 ****
--- 1096,1110 ----
}
+ #ifdef _DEBUG
+ SpaceObject *c1 = this;
+ SpaceObject *c2 = other;
+ if (fabs(c1->vel.x) > 1E6 || fabs(c1->vel.y) > 1E6 || fabs(c2->vel.x) > 1E6 || fabs(c2->vel.y) > 1E6 )
+ {
+ int a1 = c1->canCollide(c2);
+ int a2 = c2->canCollide(c1);
+ bool b = ((c1->canCollide(c2) & c2->canCollide(c1)) == 0 );
+ tw_error("velocity error in collision involving objects [%s] and [%s]", c1->get_identity(), c2->get_identity());
+ }
+ #endif
return;
***************
*** 1585,1588 ****
--- 1585,1589 ----
continue;
+ #ifdef _DEBUG
//if (i == 1 && game_time == 100) tw_error("debug me!");
if (fabs(item[i]->vel.x) > 1E6 || fabs(item[i]->vel.y) > 1E6)
***************
*** 1590,1593 ****
--- 1591,1596 ----
tw_error("velocity error in %s", item[i]->get_identity());
}
+ #endif
+
item[i]->pos = normalize(item[i]->pos + item[i]->vel * frame_time, map_size);
}
***************
*** 1649,1652 ****
--- 1652,1672 ----
tw_error("This item [%s] is not in-game", item[i]->get_identity());
}
+
+ //xxx this is an expensive test !!
+ #ifdef _DEBUG
+ int k;
+ for (k = 0; k < num_items; k += 1)
+ {
+ if (!item[k]->exists())
+ continue;
+
+ //if (i == 1 && game_time == 100) tw_error("debug me!");
+ if (fabs(item[k]->vel.x) > 1E6 || fabs(item[k]->vel.y) > 1E6)
+ {
+ tw_error("velocity error involving %s and %s", item[k]->get_identity(), item[i]->get_identity());
+ }
+ }
+ #endif
+
}
***************
*** 1725,1728 ****
--- 1745,1756 ----
if (dead_presences[i]->state == -DEATH_FRAMES)
{
+ #ifdef _DEBUG
+ Presence *p = dead_presences[i];
+ const char *name = p->get_identity();
+ SpaceLocation *l = 0;
+ SpaceObject *o = 0;
+ if (p->isLocation()) l = (SpaceLocation*) p;
+ if (p->isObject()) o = (SpaceObject*) p;
+ #endif
delete dead_presences[i];
***************
*** 1875,1878 ****
--- 1903,1908 ----
j = 0;
+ physics_allowed = true;
+
for ( i = 0; i < num_presences; ++i )
{
***************
*** 2097,2100 ****
--- 2127,2143 ----
for (i = 0; i < nc; i += 1)
{
+ #ifdef _DEBUG
+ SpaceObject *c1 = col[i*2];
+ SpaceObject *c2 = col[i*2+1];
+ if (fabs(c1->vel.x) > 1E6 || fabs(c1->vel.y) > 1E6 || fabs(c2->vel.x) > 1E6 || fabs(c2->vel.y) > 1E6 )
+ {
+ tw_error("velocity error prior to collision involving objects [%s] and [%s]", c1->get_identity(), c2->get_identity());
+ }
+ #endif
+ }
+
+ for (i = 0; i < nc; i += 1)
+ {
+
col[i*2]->collide(col[i*2+1]);
***************
*** 2107,2111 ****
int a2 = c2->canCollide(c1);
bool b = ((c1->canCollide(c2) & c2->canCollide(c1)) == 0 );
! tw_error("velocity error in collision involving objects [%s] and [%s]", c1->get_identity(), c2->get_identity());
}
#endif
--- 2150,2154 ----
int a2 = c2->canCollide(c1);
bool b = ((c1->canCollide(c2) & c2->canCollide(c1)) == 0 );
! tw_error("velocity error after collision involving objects [%s] and [%s]", c1->get_identity(), c2->get_identity());
}
#endif
|