Fix hyperspace bug

This commit is contained in:
Neale Pickett 2010-07-22 15:19:52 -06:00
parent adfc19fc4c
commit fb78cd6561
4 changed files with 16 additions and 12 deletions

2
BUGS
View File

@ -1,2 +0,0 @@
* 90° angle bug
* results list isn't sorted

View File

@ -305,9 +305,15 @@ tanks_move_tank(struct tanks_game *game,
v[1] = tank->speed.current[1] * (1 - friction) * (TANK_TOP_SPEED / 100.0);
/* Outside and inside speeds */
So = max(v[0], v[1]);
Si = min(v[0], v[1]);
dir = (v[0] > v[1]) ? 1 : -1;
if (fabsf(v[0]) > abs(v[1])) {
Si = v[1];
So = v[0];
dir = 1;
} else {
Si = v[0];
So = v[1];
dir = -1;
}
/* Radius of circle to outside tread (use similar triangles) */
r = So * (TANK_RADIUS * 2) / (So - Si);

View File

@ -130,7 +130,7 @@ get-turret 12 + set-turret! ( Rotate turret )
<dd>
Turret angle can be set between -359° and 359°, with 0° directly
in front of the tank. Be aware that it takes time for the
turret to swing around: the turret can swing about 60° per turn.
turret to swing around: the turret can swing about 18° per turn.
</dd>
<dt>Cannon range and recharging</dt>

View File

@ -421,12 +421,12 @@ print_rounds(FILE *f,
flags |= 2;
}
fprintf(f, " [%d,%d,%.2f,%.2f,%d,%d],\n",
(int)(t->position[0]),
(int)(t->position[1]),
t->angle,
t->turret.current,
flags,
sensors);
(int)t->position[0],
(int)(t->position[1]),
t->angle,
t->turret.current,
flags,
sensors);
}
}
fprintf(f, "],\n");