summaryrefslogtreecommitdiffstats
path: root/trek/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'trek/setup.c')
-rw-r--r--trek/setup.c49
1 files changed, 18 insertions, 31 deletions
diff --git a/trek/setup.c b/trek/setup.c
index 715a3889..249f1497 100644
--- a/trek/setup.c
+++ b/trek/setup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.11 2009/05/24 19:18:44 dholland Exp $ */
+/* $NetBSD: setup.c,v 1.12 2009/05/24 21:44:56 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#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.12 2009/05/24 21:44:56 dholland Exp $");
#endif
#endif /* not lint */
@@ -59,8 +59,7 @@ __RCSID("$NetBSD: setup.c,v 1.11 2009/05/24 19:18:44 dholland Exp $");
** 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 },
@@ -68,8 +67,7 @@ const struct cvntab Lentab[] =
{ 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 },
@@ -91,12 +89,10 @@ setup(void)
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;
@@ -107,8 +103,7 @@ setup(void)
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;
@@ -209,8 +204,7 @@ setup(void)
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;
@@ -232,9 +226,8 @@ setup(void)
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;
@@ -245,12 +238,11 @@ setup(void)
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];
@@ -259,10 +251,8 @@ setup(void)
}
/* 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];
@@ -275,21 +265,18 @@ setup(void)
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];