summaryrefslogtreecommitdiffstats
path: root/trek
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2009-03-31 18:48:16 +0000
committerchristos <christos@NetBSD.org>2009-03-31 18:48:16 +0000
commitb8dce3698624f02a90d3120a57c399d141e00fc2 (patch)
treeca2bac30b0aa045143b1ed99a8e5e7ca5645b9b5 /trek
parentdf25e08ef3bbcd6e7f205249eaaaf44635eb266e (diff)
downloadbsdgames-darwin-b8dce3698624f02a90d3120a57c399d141e00fc2.tar.gz
bsdgames-darwin-b8dce3698624f02a90d3120a57c399d141e00fc2.tar.zst
bsdgames-darwin-b8dce3698624f02a90d3120a57c399d141e00fc2.zip
Avoid hardcoded "too large" constant that caused FPE on the vax.
XXX: Should pullup to 5.0
Diffstat (limited to 'trek')
-rw-r--r--trek/help.c7
-rw-r--r--trek/kill.c7
-rw-r--r--trek/schedule.c7
-rw-r--r--trek/setup.c7
-rw-r--r--trek/trek.h4
5 files changed, 19 insertions, 13 deletions
diff --git a/trek/help.c b/trek/help.c
index b1150e3a..5cf90d5b 100644
--- a/trek/help.c
+++ b/trek/help.c
@@ -1,4 +1,4 @@
-/* $NetBSD: help.c,v 1.8 2007/12/15 19:44:44 perry Exp $ */
+/* $NetBSD: help.c,v 1.9 2009/03/31 18:48:16 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,13 +34,14 @@
#if 0
static char sccsid[] = "@(#)help.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: help.c,v 1.8 2007/12/15 19:44:44 perry Exp $");
+__RCSID("$NetBSD: help.c,v 1.9 2009/03/31 18:48:16 christos Exp $");
#endif
#endif /* not lint */
#include <stdio.h>
#include <math.h>
#include <unistd.h>
+#include <limits.h>
#include "trek.h"
/*
@@ -96,7 +97,7 @@ help(v)
Game.helps += 1;
/* find the closest base */
- dist = 1e50;
+ dist = TOOLARGE;
if (Quad[Ship.quadx][Ship.quady].bases <= 0)
{
/* there isn't one in this quadrant */
diff --git a/trek/kill.c b/trek/kill.c
index 053f1dbb..1d8f6130 100644
--- a/trek/kill.c
+++ b/trek/kill.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kill.c,v 1.7 2003/08/07 09:37:52 agc Exp $ */
+/* $NetBSD: kill.c,v 1.8 2009/03/31 18:48:16 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,11 +34,12 @@
#if 0
static char sccsid[] = "@(#)kill.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: kill.c,v 1.7 2003/08/07 09:37:52 agc Exp $");
+__RCSID("$NetBSD: kill.c,v 1.8 2009/03/31 18:48:16 christos Exp $");
#endif
#endif /* not lint */
#include <stdio.h>
+#include <limits.h>
#include "trek.h"
/*
@@ -138,7 +139,7 @@ int qx, qy;
printf(" quadrant %d,%d has been destroyed\n", qx, qy);
}
else
- schedule(E_KATSB | E_GHOST, 1e50, qx, qy, 0);
+ schedule(E_KATSB | E_GHOST, TOOLARGE, qx, qy, 0);
}
}
diff --git a/trek/schedule.c b/trek/schedule.c
index d3c0c286..455c5e06 100644
--- a/trek/schedule.c
+++ b/trek/schedule.c
@@ -1,4 +1,4 @@
-/* $NetBSD: schedule.c,v 1.6 2006/03/19 00:56:12 christos Exp $ */
+/* $NetBSD: schedule.c,v 1.7 2009/03/31 18:48:16 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,13 +34,14 @@
#if 0
static char sccsid[] = "@(#)schedule.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: schedule.c,v 1.6 2006/03/19 00:56:12 christos Exp $");
+__RCSID("$NetBSD: schedule.c,v 1.7 2009/03/31 18:48:16 christos Exp $");
#endif
#endif /* not lint */
#include <stdio.h>
#include <math.h>
#include <err.h>
+#include <limits.h>
#include "trek.h"
/*
@@ -135,7 +136,7 @@ struct event *e1;
e->evcode, e->date, e->x, e->y, e->systemname);
# endif
Now.eventptr[e->evcode & E_EVENT] = 0;
- e->date = 1e50;
+ e->date = TOOLARGE;
e->evcode = 0;
return;
}
diff --git a/trek/setup.c b/trek/setup.c
index cd43ebbe..3a9f93f2 100644
--- a/trek/setup.c
+++ b/trek/setup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.9 2008/11/14 21:10:44 christos Exp $ */
+/* $NetBSD: setup.c,v 1.10 2009/03/31 18:48:16 christos 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.9 2008/11/14 21:10:44 christos Exp $");
+__RCSID("$NetBSD: setup.c,v 1.10 2009/03/31 18:48:16 christos Exp $");
#endif
#endif /* not lint */
@@ -44,6 +44,7 @@ __RCSID("$NetBSD: setup.c,v 1.9 2008/11/14 21:10:44 christos Exp $");
#include <unistd.h>
#include <stdlib.h>
#include <err.h>
+#include <limits.h>
#include "trek.h"
#include "getpar.h"
@@ -211,7 +212,7 @@ setup()
for (i = 0; i < MAXEVENTS; i++)
{
e = &Event[i];
- e->date = 1e50;
+ e->date = TOOLARGE;
e->evcode = 0;
}
xsched(E_SNOVA, 1, 0, 0, 0);
diff --git a/trek/trek.h b/trek/trek.h
index 62ac1df8..92e7912b 100644
--- a/trek/trek.h
+++ b/trek/trek.h
@@ -1,4 +1,4 @@
-/* $NetBSD: trek.h,v 1.11 2005/02/15 12:54:50 jsm Exp $ */
+/* $NetBSD: trek.h,v 1.12 2009/03/31 18:48:16 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -370,6 +370,8 @@ extern struct Etc_struct Etc;
# define xTRACE 1
extern int Trace;
+# define TOOLARGE (DBL_MAX / 2) /* < DOUBLE_MAX for everyone */
+
/* abandon.c */
void abandon(int);