summaryrefslogtreecommitdiffstats
path: root/games/battlestar/com5.c
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1997-02-20 03:04:54 +0000
committereivind <eivind@FreeBSD.org>1997-02-20 03:04:54 +0000
commit27eb6d09a03b6d51d025fafa9e46e0f64544d722 (patch)
treec09c18b60a67afd2e34d5a6138c86fe56288b8e3 /games/battlestar/com5.c
parent1a5d9e17d08eb1b79c5918e8596ba8f18ea36461 (diff)
downloadFreeBSD-src-27eb6d09a03b6d51d025fafa9e46e0f64544d722.zip
FreeBSD-src-27eb6d09a03b6d51d025fafa9e46e0f64544d722.tar.gz
Remove buffer overflow and tempfile race, remove <sys/time.h> hack (and
need for it), change definition of setbit() macro and friends to be compatible with <sys/param.h>. The bugs were discovered and fixed as a result of the FreeBSD code audit. Submitted by: Aaron Bornstein <aaronb@j51.com>, Mark Huizer <xaa@stack.nl>
Diffstat (limited to 'games/battlestar/com5.c')
-rw-r--r--games/battlestar/com5.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/games/battlestar/com5.c b/games/battlestar/com5.c
index 04e9cfe..5bdea6a 100644
--- a/games/battlestar/com5.c
+++ b/games/battlestar/com5.c
@@ -100,7 +100,7 @@ love()
if (!loved)
setbit(location[position].objects,MEDALION);
loved = 1;
- time += 10;
+ gtime += 10;
zzz();
}
else {
@@ -112,7 +112,7 @@ love()
power++;
pleasure += 5;
printf("Girl:\n");
- time += 10;
+ gtime += 10;
zzz();
}
printf("Loved.\n");
@@ -125,16 +125,16 @@ zzz()
int oldtime;
register int n;
- oldtime = time;
- if ((snooze - time) < (0.75 * CYCLE)){
- time += 0.75 * CYCLE - (snooze - time);
+ oldtime = gtime;
+ if ((snooze - gtime) < (0.75 * CYCLE)){
+ gtime += 0.75 * CYCLE - (snooze - gtime);
printf("<zzz>");
- for (n = 0; n < time - oldtime; n++)
+ for (n = 0; n < gtime - oldtime; n++)
printf(".");
printf("\n");
- snooze += 3 * (time - oldtime);
+ snooze += 3 * (gtime - oldtime);
if (notes[LAUNCHED]){
- fuel -= (time - oldtime);
+ fuel -= (gtime - oldtime);
if (location[position].down){
position = location[position].down;
crash();
@@ -177,8 +177,8 @@ zzz()
chime()
{
- if ((time / CYCLE + 1) % 2 && OUTSIDE)
- switch((time % CYCLE)/(CYCLE / 7)){
+ if ((gtime / CYCLE + 1) % 2 && OUTSIDE)
+ switch((gtime % CYCLE)/(CYCLE / 7)){
case 0:
puts("It is just after sunrise.");
break;
@@ -202,7 +202,7 @@ chime()
break;
}
else if (OUTSIDE)
- switch((time % CYCLE)/(CYCLE / 7)){
+ switch((gtime % CYCLE)/(CYCLE / 7)){
case 0:
puts("It is just after sunset.");
break;
@@ -259,7 +259,7 @@ give()
}
if (result != -1 && (testbit(location[position].objects,obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)){
clearbit(location[position].objects,obj);
- time++;
+ gtime++;
ego++;
switch(person){
case NATIVE:
@@ -288,7 +288,7 @@ give()
puts("after having been out drinking with the girls, she kicks the throne particulary");
puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)");
clearbit(location[position].objects,MEDALION);
- wintime = time;
+ wintime = gtime;
}
}
break;
OpenPOWER on IntegriCloud