X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/77e3814f0c0e3dea4d0032e25666f77e6f83bfff..9cc9985234faae3faaaf2c5449423fc1245b195e:/trek/setup.c diff --git a/trek/setup.c b/trek/setup.c index 7f35a259..6e381be5 100644 --- a/trek/setup.c +++ b/trek/setup.c @@ -1,6 +1,8 @@ +/* $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 @@ -31,12 +33,22 @@ * SUCH DAMAGE. */ +#include #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 +#include +#include +#include +#include +#include "trek.h" +#include "getpar.h" /* ** INITIALIZE THE GAME @@ -51,40 +63,40 @@ static char sccsid[] = "@(#)setup.c 5.4 (Berkeley) 6/1/90"; 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()) @@ -94,10 +106,10 @@ setup() 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; @@ -159,7 +171,7 @@ setup() 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)