X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=setup.c;h=58f45f175b8d12593d592c00f8f0a3ead10edf4a;hb=80aa958a55a62baa32586414ac671ee450369d25;hp=3a5a794b105b228ccc2f06ea0d3f5bec2ff2d517;hpb=ba71f219a8543b5510a53c59ce793339b84903a7;p=super-star-trek.git diff --git a/setup.c b/setup.c index 3a5a794..58f45f1 100644 --- a/setup.c +++ b/setup.c @@ -1,11 +1,8 @@ #include -#ifdef SERGEEV #include -#include -#endif /* SERGEEV */ +#include "conio.h" #include "sst.h" -#ifdef SERGEEV #ifdef __linux__ static long filelength(int fd) { struct stat buf; @@ -13,16 +10,15 @@ struct stat buf; return buf.st_size; } #endif -#endif /* SERGEEV */ void prelim(void) { skip(2); prout("-SUPER- STAR TREK"); skip(1); -#ifndef SERGEEV +#ifndef __HISTORICAL__ prout("Latest update-21 Sept 78"); skip(1); -#endif /* SERGEEV */ +#endif /* __HISTORICAL__ */ } void freeze(int boss) { @@ -84,7 +80,7 @@ int thaw(void) { return 1; } fread(&game, sizeof(game), 1, fp); - if (strcmp(game.magic, SSTMAGIC)) { + if (feof(fp) || ftell(fp) != filelength(fileno(fp)) || strcmp(game.magic, SSTMAGIC)) { prout("Game file format is bad, should begin with " SSTMAGIC); skip(1); fclose(fp); @@ -402,13 +398,13 @@ void randomize(void) { } int choose(int needprompt) { + while (TRUE) { tourn = 0; thawed = 0; skill = 0; length = 0; - while (TRUE) { if (needprompt) /* Can start with command line options */ - proutn("Would you like a regular, tournament, or frozen game?"); + proutn("Would you like a regular, tournament, or saved game? "); scan(); if (strlen(citem)==0) continue; // Try again if (isit("tournament")) { @@ -424,22 +420,22 @@ int choose(int needprompt) { srand((unsigned int)(int)aaitem); break; } - if (isit("frozen")) { - thaw(); + if (isit("frozen") || isit("frozen")) { + if (thaw()) continue; chew(); +#ifndef SERGEEV if (*game.passwd==0) continue; randomize(); Rand(); Rand(); Rand(); Rand(); +#endif if (!alldone) thawed = 1; // No plaque if not finished - report(1); + report(); +#ifdef SERGEEV + getche(); +#endif /* SERGEEV */ return TRUE; } - if (isit("regular")) { - skip(2); - randomize(); - Rand(); Rand(); Rand(); Rand(); - break; - } + if (isit("regular")) break; proutn("What is \""); proutn(citem); prout("\"?"); @@ -599,7 +595,6 @@ void newqad(int shutup) { game.kdist[i] = game.kavgd[i] = sqrt(square(sectx-ix) + square(secty-iy)); game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*skill; } - sortkl(); // If quadrant needs a starbase, put it in if (quadnum >= 10) { quadnum -= 10;