+/* $NetBSD: setup.c,v 1.5 1997/10/12 21:25:15 christos Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char sccsid[] = "@(#)setup.c 5.4 (Berkeley) 6/1/90";
+#if 0
+static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: setup.c,v 1.5 1997/10/12 21:25:15 christos Exp $");
+#endif
#endif /* not lint */
-# include "trek.h"
-# include "getpar.h"
+#include <stdio.h>
+#include <math.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <err.h>
+#include "trek.h"
+#include "getpar.h"
/*
** INITIALIZE THE GAME
struct cvntab Lentab[] =
{
- "s", "hort", (int (*)())1, 0,
- "m", "edium", (int (*)())2, 0,
- "l", "ong", (int (*)())4, 0,
- "restart", "", 0, 0,
- 0
+ { "s", "hort", (cmdfun)1, 0 },
+ { "m", "edium", (cmdfun)2, 0 },
+ { "l", "ong", (cmdfun)4, 0 },
+ { "restart", "", (cmdfun)0, 0 },
+ { NULL, NULL, NULL, 0 }
};
struct cvntab Skitab[] =
{
- "n", "ovice", (int (*)())1, 0,
- "f", "air", (int (*)())2, 0,
- "g", "ood", (int (*)())3, 0,
- "e", "xpert", (int (*)())4, 0,
- "c", "ommodore", (int (*)())5, 0,
- "i", "mpossible", (int (*)())6, 0,
- 0
+ { "n", "ovice", (cmdfun)1, 0 },
+ { "f", "air", (cmdfun)2, 0 },
+ { "g", "ood", (cmdfun)3, 0 },
+ { "e", "xpert", (cmdfun)4, 0 },
+ { "c", "ommodore", (cmdfun)5, 0 },
+ { "i", "mpossible", (cmdfun)6, 0 },
+ { NULL, NULL, NULL, 0 }
};
+void
setup()
{
struct cvntab *r;
- register int i, j;
+ int i, j;
double f;
int d;
- int fd;
int klump;
int ix, iy;
- register struct quad *q;
+ struct quad *q;
struct event *e;
while (1)
{
r = getcodpar("What length game", Lentab);
- Game.length = (int) r->value;
+ Game.length = (long) r->value;
if (Game.length == 0)
{
if (restartgame())
break;
}
r = getcodpar("What skill game", Skitab);
- Game.skill = (int) r->value;
+ Game.skill = (long) r->value;
Game.tourn = 0;
getstrpar("Enter a password", Game.passwd, 14, 0);
- if (sequal(Game.passwd, "tournament"))
+ if (strcmp(Game.passwd, "tournament") == 0)
{
getstrpar("Enter tournament code", Game.passwd, 14, 0);
Game.tourn = 1;
for (i = j = 0; i < NDEV; i++)
j += Param.damprob[i];
if (j != 1000)
- syserr("Device probabilities sum to %d", j);
+ errx(1, "Device probabilities sum to %d", j);
Param.dockfac = 0.5;
Param.regenfac = (5 - Game.skill) * 0.05;
if (Param.regenfac < 0.0)