|
|
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 e
Length: 3043 (0xbe3)
Types: TextFile
Names: »enter.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/X/Xtrek/enter.c«
static char sccsid[] = "@(#)enter.c 1.1";
/*
Copyright (c) 1986 Chris Guthrie
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation. No representations are made about the
suitability of this software for any purpose. It is
provided "as is" without express or implied warranty.
*/
#include <X11/Xlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <pwd.h>
#include <string.h>
#include <ctype.h>
#include "defs.h"
#include "data.h"
/* Enter the game */
long random();
enter(tno, disp, pno)
int tno;
char *disp;
int pno;
{
register struct player *p;
char *pseudo, buf[80];
pseudo = (char *) NULL;
p = &players[pno];
if (strcmp(disp, "Nowhere"))
pseudo = XGetDefault(p->display, PROGRAM_NAME, "name");
if (pseudo == NULL)
(void) strncpy(p->p_name, p->p_login, sizeof (p->p_name));
else
(void) strncpy(p->p_name, pseudo, sizeof (p->p_name));
p->p_name[12] = '\0';
p->p_login[12] = '\0';
p->p_no = pno;
p->p_updates = 0;
p->p_flags = PFSHIELD | (p->p_flags & PFCOPILOT);
if (strcmp(disp, "Nowhere") && booleanDefault(p, PROGRAM_NAME, "showstats"))
p->p_flags |= PFSHOWSTATS;
else
p->p_flags &= ~PFSHOWSTATS;
p->p_dir = 0;
p->p_desdir = 0;
p->p_speed = 0;
p->p_desspeed = 0;
p->p_subspeed = 0;
p->p_team = (1 << tno);
p->p_x = planets[tno * 10].pl_x + (random() % 10000) - 5000;
p->p_y = planets[tno * 10].pl_y + (random() % 10000) - 5000;
p->p_ntorp = 0;
p->p_damage = 0;
p->p_subdamage = 0;
p->p_etemp = 0;
p->p_etime = 0;
p->p_wtemp = 0;
p->p_wtime = 0;
p->p_shield = 100;
p->p_subshield = 0;
p->p_swar = 0;
p->p_hostile = (FED|ROM|KLI|ORI);
p->p_hostile &= ~p->p_team;
p->p_kills = 0.0;
p->p_armies = 0;
sprintf(buf, "%c%x", teamlet[p->p_team], p->p_no);
strncpy(p->p_mapchars, buf, 2);
getship(&p->p_ship);
p->p_stats.st_entries++;
p->p_fuel = p->p_ship.s_maxfuel;
p->p_umsg.m_pending = 0;
p->lastm = mctl->mc_current;
p->p_status = PALIVE;
p->delay = 0;
p->oldalert = PFGREEN;
p->mapmode = 1;
p->namemode = 1;
p->statmode = 1;
p->warncount = 0;
p->warntimer = -1;
p->infomapped = 0;
p->mustexit = 0;
p->redrawall = 1;
time(&p->start_time);
}
/*ARGSUSED*/
enter_copilot(p, pno)
register struct player *p;
int pno;
{
p->lastm = mctl->mc_current;
}
openmem()
{
subdaemon();
}
findslot()
{
register int i;
for (i = 0; i < MAXPLAYER; i++) {
if (players[i].p_status == PFREE) { /* We have a free slot */
players[i].p_status = PSETUP; /* possible race code */
break;
}
}
if (i < MAXPLAYER)
bzero(&players[i].p_stats, sizeof(struct stats)); /* Slight problem for
copilot */
return(i);
}