Home » Stars! Clones, Extensions, Modding » FreeStars » some questions about coding
Re: some questions about coding |
Fri, 11 March 2005 05:18 |
|
ConstB | | Crewman 1st Class | Messages: 27
Registered: March 2005 Location: Tomsk, Russia | |
|
fixed
DWORD planetValueCalc(BYTE* planetHabData)
{
DWORD planetValuePoints=0,redValue=0,ideality=10000;
WORD i=0,
planetHab,habCenter,habUpper,habLower,
vE,habRadius,v12,v14,tmp;
for (i=0; i<3; i++)
{
planetHab = planetHabData[i];
habCenter = player.centerHab[i];
habLower = player.lowerHab[i];
habUpper = player.upperHab[i];
if (IMMUNE(habUpper))
planetValuePoints += 10000;
else
{
if (habLower <= planetHab && habUpper >= planetHab)
{
/* green planet */
vE = abs(planetHab-habCenter)*100;
if (habCenter > planetHab)
{
habRadius = habCenter-habLower;
vE /= habRadius;
tmp = habCenter-planetHab;
}
else
{
habRadius = habUpper-habCenter;
vE /= habRadius;
tmp = planetHab-habCenter;
}
v12 = ((tmp)*2)-habRadius;
vE = 100 - vE;
planetValuePoints += vE*vE;
if (v12>0)
{
ideality *= habRadius*2 - v12;
ideality /= habRadius*2;
}
}
else
{
/* red planet */
if (habLower <= planetHab) v14=planetHab-habUpper;
else v14=habLower-planetHab;
if (v14>15) v14=15;
redValue+=v14;
}
}
}
if (redValue!=0) return -redValue;
planetValuePoints = sqrt((double)planetValuePoints/3)+0.9;
planetValuePoints = planetValuePoints * ideality/10000;
return planetValuePoints;
}
this one works fine :-)
Report message to a moderator
|
|
|
|
|
some questions about coding
By: ConstB on Wed, 09 March 2005 03:33
|
|
|
Re: some questions about coding
By: LEit on Wed, 09 March 2005 10:51
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: LEit on Wed, 09 March 2005 11:01
|
|
|
Re: some questions about coding
By: ConstB on Wed, 09 March 2005 12:08
|
|
|
Re: some questions about coding
By: LEit on Wed, 09 March 2005 13:01
|
|
|
Re: some questions about coding
By: ConstB on Wed, 09 March 2005 13:39
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: LEit on Wed, 09 March 2005 21:42
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: ConstB on Fri, 11 March 2005 05:04
|
|
|
Re: some questions about coding
By: mazda on Fri, 11 March 2005 05:48
|
|
|
Re: some questions about coding
By: Madman on Mon, 14 March 2005 02:52
|
|
|
Re: some questions about coding
By: ConstB on Wed, 09 March 2005 14:35
|
|
|
Re: some questions about coding
By: ConstB on Wed, 09 March 2005 14:51
|
|
|
Re: some questions about coding
By: ConstB on Wed, 09 March 2005 15:05
|
|
|
Re: some questions about coding
By: ConstB on Thu, 10 March 2005 12:40
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: ConstB on Fri, 11 March 2005 05:18
|
|
|
Re: some questions about coding
By: mazda on Fri, 11 March 2005 05:58
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: ConstB on Fri, 11 March 2005 08:24
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: ConstB on Fri, 11 March 2005 12:02
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: Marduk on Thu, 17 March 2005 18:30
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: Marduk on Sat, 19 March 2005 20:50
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: ConstB on Fri, 11 March 2005 07:52
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: ConstB on Sat, 12 March 2005 08:19
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: ConstB on Thu, 17 March 2005 12:48
|
|
|
Re: some questions about coding
By: LEit on Sun, 19 February 2006 22:12
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: Kotk on Mon, 20 February 2006 06:03
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: Kotk on Mon, 20 February 2006 10:49
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: Kotk on Mon, 20 February 2006 15:58
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: LEit on Tue, 21 February 2006 13:31
|
|
|
Re: some questions about coding
By: Kotk on Tue, 21 February 2006 14:04
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: Kotk on Mon, 20 February 2006 16:31
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: Kotk on Sat, 21 October 2006 04:06
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
By: Kotk on Sat, 21 October 2006 17:00
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
|
|
|
Re: some questions about coding
|
Goto Forum:
Current Time: Mon May 20 07:58:54 EDT 2024
|