|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 1570 (0x622)
Types: TextFile
Names: »max.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Gb/max.c«
/*
* 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;
}