-/* $NetBSD: setup.c,v 1.11 2009/05/24 19:18:44 dholland Exp $ */
+/* $NetBSD: setup.c,v 1.13 2009/05/25 00:37:27 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: setup.c,v 1.11 2009/05/24 19:18:44 dholland Exp $");
+__RCSID("$NetBSD: setup.c,v 1.13 2009/05/25 00:37:27 dholland Exp $");
#endif
#endif /* not lint */
** Game restart and tournament games are handled here.
*/
-const struct cvntab Lentab[] =
-{
+const struct cvntab Lentab[] = {
{ "s", "hort", (cmdfun)1, 0 },
{ "m", "edium", (cmdfun)2, 0 },
{ "l", "ong", (cmdfun)4, 0 },
{ NULL, NULL, NULL, 0 }
};
-const struct cvntab Skitab[] =
-{
+const struct cvntab Skitab[] = {
{ "n", "ovice", (cmdfun)1, 0 },
{ "f", "air", (cmdfun)2, 0 },
{ "g", "ood", (cmdfun)3, 0 },
struct quad *q;
struct event *e;
- while (1)
- {
+ while (1) {
r = getcodpar("What length game", Lentab);
Game.length = (long) r->value;
- if (Game.length == 0)
- {
+ if (Game.length == 0) {
if (restartgame())
continue;
return;
Game.skill = (long) r->value;
Game.tourn = 0;
getstrpar("Enter a password", Game.passwd, 14, 0);
- if (strcmp(Game.passwd, "tournament") == 0)
- {
+ if (strcmp(Game.passwd, "tournament") == 0) {
getstrpar("Enter tournament code", Game.passwd, 14, 0);
Game.tourn = 1;
d = 0;
for (i = 0; Game.passwd[i]; i++)
d += Game.passwd[i] << i;
- srand(d);
+ srandom(d);
}
Param.bases = Now.bases = ranf(6 - Game.skill) + 2;
if (Game.skill == 6)
Param.navigcrud[1] = 0.75;
Param.cloakenergy = 1000;
Param.energylow = 1000;
- for (i = 0; i < MAXEVENTS; i++)
- {
+ for (i = 0; i < MAXEVENTS; i++) {
e = &Event[i];
e->date = TOOLARGE;
e->evcode = 0;
Move.endgame = 0;
/* setup stars */
- for (i = 0; i < NQUADS; i++)
- for (j = 0; j < NQUADS; j++)
- {
+ for (i = 0; i < NQUADS; i++) {
+ for (j = 0; j < NQUADS; j++) {
short s5;
q = &Quad[i][j];
q->klings = q->bases = 0;
q->holes = q->holes > s5 ? q->holes - s5 : 0;
q->qsystemname = 0;
}
+ }
/* select inhabited starsystems */
- for (d = 1; d < NINHAB; d++)
- {
- do
- {
+ for (d = 1; d < NINHAB; d++) {
+ do {
i = ranf(NQUADS);
j = ranf(NQUADS);
q = &Quad[i][j];
}
/* position starbases */
- for (i = 0; i < Param.bases; i++)
- {
- while (1)
- {
+ for (i = 0; i < Param.bases; i++) {
+ while (1) {
ix = ranf(NQUADS);
iy = ranf(NQUADS);
q = &Quad[ix][iy];
Now.base[i].y = iy;
q->scanned = 1001;
/* start the Enterprise near starbase */
- if (i == 0)
- {
+ if (i == 0) {
Ship.quadx = ix;
Ship.quady = iy;
}
}
/* position klingons */
- for (i = Param.klings; i > 0; )
- {
+ for (i = Param.klings; i > 0; ) {
klump = ranf(4) + 1;
if (klump > i)
klump = i;
- while (1)
- {
+ while (1) {
ix = ranf(NQUADS);
iy = ranf(NQUADS);
q = &Quad[ix][iy];