home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
games
/
volume6
/
gb
/
patch1
/
max.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-07-06
|
2KB
|
78 lines
/*
* Galactic Bloodshed (Robert Chansky, smq@b)
* max() -- return how many people one sector can support
* Distmap() -- map-oriented distance that does not look square
* compatibility() -- return how much race is compatible with planet
* gravity() -- return gravity for planet
* prin_ship_orbits() -- prints place ship orbits
*/
#include "vars.h"
#include "races.h"
#include "ships.h"
#include <math.h>
int maxsupport(p)
reg sectortype *p;
{
return(
(int)(powscale(p->eff)*FACTOR_FERT_SUPPORT*p->fert+p->fert + 1)
);
}
int Distmap(x,y,x2,y2)
reg int x,y,x2,y2;
{
return( round_rand(fabs((double)x-x2) + fabs( (double)y-y2)*(RATIOXY*0.5) ) );
}
float compatibility(planet, race)
reg planettype *planet;
reg racetype *race;
{
reg int i,add;
reg float sum=1.0;
/* step through and report compatibility of each planetary gas */
for (i=TEMP; i<=OTHER; i++) {
add = ((float)planet->conditions[i] - race->conditions[i]);
sum *= 1.0 - (abs(add)/100.0);
}
return sum * 100.0; /** planet->conditions[TOXIC]*/
}
float gravity(p)
planettype *p;
{
return (float)p->Maxx * p->Maxy * GRAV_FACTOR;
}
char Dispshiporbits_buf[PLACENAMESIZE+13];
char *prin_ship_orbits(s)
shiptype *s;
{
switch (s->whatorbits) {
case LEVEL_UNIV:
sprintf(Dispshiporbits_buf,"-");
break;
case LEVEL_STAR:
sprintf(Dispshiporbits_buf,"/%s", Stars[s->storbits]->name);
break;
case LEVEL_PLAN:
sprintf(Dispshiporbits_buf,"/%s/%s",
Stars[s->storbits]->name,
Stars[s->storbits]->pnames[s->pnumorbits]);
break;
}
return Dispshiporbits_buf;
}