|
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 t
Length: 1810 (0x712) Types: TextFile Names: »torp.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/X/Xtrek/torp.c«
static char sccsid[] = "@(#)torp.c 1.1"; #ifndef lint static char *rcsid_torp_c = "$Header: /uraid2/riedl/src/xceltrek/RCS/torp.c,v 1.1 88/04/18 16:10:50 riedl Exp Locker: riedl $"; #endif lint /* Copyright (c) 1986 Chris Guthrie */ #include <X11/Xlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include "defs.h" #include "data.h" extern long isin[], icos[]; /* Launch torp */ ntorp(p, course, type) register struct player *p; unsigned char course; int type; { register int i, x, y; register struct torp *k; char buf[50]; double sqrt(); if (p->p_ntorp >= MAXTORP) { sprintf(buf, "Torps limited to %d", MAXTORP); warning(p, buf); return; } if (p->p_fuel < p->p_ship.s_torpcost) { warning(p, "Not enough fuel for torp"); return; } if (p->p_flags & PFREPAIR) { warning(p, "Can't fire while repairing"); return; } if (p->p_flags & PFWEP) { warning(p, "Weapons overheated"); return; } if (p->p_flags & PFCLOAK) { warning(p, "Cannot fire while cloaked"); return; } p->p_ntorp++; p->p_fuel -= p->p_ship.s_torpcost; p->p_wtemp += p->p_ship.s_torpcost / 10; for (i = MAXTORP, k = &torps[p->p_no * MAXTORP]; i > 0; i--, k++) { if (k->t_status == TFREE) break; } if (i == 0) { fprintf(stderr, "ntorp: sanity check failed - no torp to fire\n"); p->p_ntorp--; return; } k->t_no = MAXTORP - i; k->t_status = type; k->t_owner = p->p_no; k->t_team = p->p_team; k->t_x = p->p_x; k->t_y = p->p_y; k->t_dir = course; k->t_damage = p->p_ship.s_torpdamage; k->t_speed = p->p_ship.s_torpspeed; k->t_war = p->p_hostile | p->p_swar; k->t_fuse = (random() % TFIREVAR) + TFIREMIN; p->p_stats.st_torps++; }