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 e

⟦0a90c7c1a⟧ TextFile

    Length: 1452 (0x5ac)
    Types: TextFile
    Names: »examine.c«

Derivation

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

TextFile



/*
 * Galactic Bloodshed (Robert Chansky, smq@b)
 *  examine -- check out an object
 */

#include "vars.h"
#include "ships.h"
extern int Shipdata[NUMSTYPES][NUMABILS];
extern char *Shipnames[];

examine(APcount, argn,args)
int APcount;
int argn;
char args[MAXARGS][COMMANDSIZE];
{
 shiptype *ship;
 int c,t,shdata,shipno;
 FILE *fd;

  if (argn==1) {
      printf("ship #");
      scanf("%d",&shipno);
      getchr();
  } else 
    	sscanf(args[1] + ((*args[1]=='#') ? 1 : 0),"%d",&shipno);

    openshdata(&shdata);
    if (!getship(shdata,&ship,shipno))
	return;

    if (ship->owner!=Playernum || ship->is_dead) {
	DontOwnErr(shipno);
	free(ship);
	return;
    }

    if ((fd=fopen(EXAM_FL, "r"))==NULL) {
	perror(EXAM_FL);
	exit(-1);
    }

   /* look through ship data file */
    for (t=0; t<=ship->type; t++)
       while (fgetc(fd) != '~') ;
    
	/* give report */
    while ((c=fgetc(fd)) != '~')
	putchr(c);

    fclose(fd);

    if (!ship->is_examined) {
     if (ship->whatorbits==LEVEL_UNIV)
     	deductAPs(APcount, 0, 1);	/* ded from sdata */
     else
     	deductAPs(APcount, ship->storbits, 0);

     ship->is_examined = 1;
     putship(shdata,ship,shipno);

    }
    close(shdata);

    if (has_switch(ship))
	printf("This device has an on/off switch that can be set with order.\n");
    if (ship->rad)
	printf("This device has been irradiated;\nit's crew is dying and it cannot move for the time being.\n");

    free(ship);

}