Random minor cleanup.

master
Cyp 2010-03-06 19:16:57 +01:00
parent 382bfad14b
commit afaaf0b6e4
3 changed files with 3 additions and 12 deletions

View File

@ -33,10 +33,6 @@
#define PERCENT(a,b) (((a)*100)/(b))
#define PERNUM(range,a,b) (((a)*range)/(b))
/* conversion macros */
#define RAD_TO_DEG(x) (x * 180.0 / M_PI)
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif

View File

@ -342,7 +342,7 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
if (proj_Direct(psStats) || dist <= psStats->minRange)
{
flightTime = (double)dist / (double)psStats->flightSpeed;
flightTime = dist / psStats->flightSpeed;
}
else
{

View File

@ -50,7 +50,6 @@ uint16_t calcDirection(int32_t x0, int32_t y0, int32_t x1, int32_t y1)
DROID *getNearestDroid(UDWORD x, UDWORD y, BOOL bSelected)
{
DROID *psDroid,*psBestUnit;
UDWORD xDif,yDif,dist;
UDWORD bestSoFar;
/* Go thru' all the droids - how often have we seen this - a MACRO maybe? */
@ -60,13 +59,9 @@ UDWORD bestSoFar;
if (!isVtolDroid(psDroid))
{
/* Clever (?) bit that reads whether we're interested in droids being selected or not */
if( (bSelected ? psDroid->selected : true ) )
if (!bSelected || psDroid->selected)
{
/* Get the differences */
xDif = abs(psDroid->pos.x - x);
yDif = abs(psDroid->pos.y - y);
/* Approximates the distance away - using a sqrt approximation */
dist = MAX(xDif,yDif) + MIN(xDif,yDif)/2; // approximates, but never more than 11% out...
uint32_t dist = iHypot(psDroid->pos.x - x, psDroid->pos.y - y);
/* Is this the nearest one we got so far? */
if(dist<bestSoFar)
{