DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T a

⟦1a9e6b25b⟧ TextFile

    Length: 2512 (0x9d0)
    Types: TextFile
    Names: »autoshoot.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Gb/autoshoot.c« 

TextFile

/*
 * Galactic Bloodshed (Robert Chansky, smq@b)
 * autoshoot() -- shoot <-> retaliate routine
 * Bombard() -- ship bombards planet
 */


#include "vars.h"
#include "ships.h"
#include "races.h"
extern int Shipdata[NUMSTYPES][NUMABILS];
extern bool Nuked[MAXPLAYERS];	/* who was nuked on the planet/ship */
extern char telegram_buf[];
extern racetype *races[];


/* ship #shipno bombards planet, then sends telegrams alerting whom it
 *	may concern.
 */
Bombard(ship,shipno,planet)
shiptype *ship;
planettype *planet;
{
int x,y,oldown,radius,found=0;
char buf[200];

 /* look for someone to bombard-check for war */
  Getxysect(planet,0,0,1);	/* reset */
  while (Getxysect(planet,&x,&y,0) && !found)
	if (isset(races[ship->owner]->atwar, Sector(*planet,x,y).owner))
		found=1;
  if (!found) {
   /* no one we are at war with. find someone neutral
      (owner 0 will work, too, but not already bombed)*/
    Getxysect(planet,0,0,1);	/* reset */
    while (Getxysect(planet,&x,&y,0) && !found)
	if (isclr(races[ship->owner]->allied, Sector(*planet,x,y).owner) && Sector(*planet,x,y).owner!=ship->owner && Sector(*planet,x,y).popn>0)
		found=1;
  }
  if (found) {
    oldown = Sector(*planet,x,y).owner;
	/* do some bombarding here... */
    teleg_add("",telegram_buf);
    sprintf(buf,"REPORT: ship #%d\n",shipno);
    teleg_add(buf,telegram_buf);
    sprintf(buf,"%s #%d reports bombing of planet /%s/%s,\n",Shipnames[ship->type],x,Stars[ship->storbits]->name,Stars[ship->storbits]->pnames[ship->pnumorbits]);
    teleg_add(buf,telegram_buf);
    sprintf(buf,"sector %d,%d (owner %d) for a blast radius of %d.\n",x,y,oldown,radius);
    teleg_add(buf,telegram_buf);
    teleg_send(TELEG_PLAYER_AUTO, ship->owner, telegram_buf);
    teleg_add("",telegram_buf);
    sprintf(buf,"ALERT from planet /%s/%s\n",Stars[ship->storbits]->name,Stars[ship->storbits]->pnames[ship->pnumorbits]);
    teleg_add(buf,telegram_buf);
    sprintf(buf,"%s #%d Bombarded sector %d,%d for a blast radius of %d.\n",Shipnames[ship->type],shipno,x,y,radius);
    teleg_add(buf,telegram_buf);
    teleg_send(TELEG_PLAYER_AUTO, oldown, telegram_buf);
  } else {
    teleg_add("",telegram_buf);
    sprintf(buf,"Report from %s #%d\n",Shipnames[ship->type],shipno);
    teleg_add(buf,telegram_buf);
    sprintf(buf,"Planet /%s/%s has been saturation bombed.\n",Stars[ship->storbits]->name,Stars[ship->storbits]->pnames[ship->pnumorbits]);
    teleg_add(buf,telegram_buf);
    teleg_send(TELEG_PLAYER_AUTO, ship->owner, telegram_buf);
  }

}