print some useful info if hog not found, allow -help to work if no text available
authorBradley Bell <btb@icculus.org>
Mon, 7 Apr 2003 23:29:28 +0000 (23:29 +0000)
committerBradley Bell <btb@icculus.org>
Mon, 7 Apr 2003 23:29:28 +0000 (23:29 +0000)
ChangeLog
main/inferno.c

index 9e854ae..706f842 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-04-07  Bradley Bell  <btb@icculus.org>
+
+       * main/inferno.c: print some useful info if hog not found, allow
+       -help to work if no text available
+
 2003-04-07  Steffen Pohle <stpohle@gmx.net>
 
        * arch/linux/Makefile.am: revert to previous version, so linux
index aec8d1c..a51a0ef 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: inferno.c,v 1.59 2003-03-31 19:52:02 btb Exp $ */
+/* $Id: inferno.c,v 1.60 2003-04-07 23:29:28 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -870,29 +870,34 @@ void print_commandline_help()
        if (!ifile) {
                ifile = cfopen("help.txb","rb");
                if (!ifile)
-                       Error("Cannot load help text file.");
+                       Warning("Cannot load help text file.");
                have_binary = 1;
        }
 
-       while (cfgets(line,LINE_LEN,ifile)) {
+       if (ifile)
+       {
+
+               while (cfgets(line,LINE_LEN,ifile)) {
 
-               if (have_binary) {
-                       int i;
-                       for (i = 0; i < strlen(line) - 1; i++) {
-                               encode_rotate_left(&(line[i]));
-                               line[i] = line[i] ^ BITMAP_TBL_XOR;
-                               encode_rotate_left(&(line[i]));
+                       if (have_binary) {
+                               int i;
+                               for (i = 0; i < strlen(line) - 1; i++) {
+                                       encode_rotate_left(&(line[i]));
+                                       line[i] = line[i] ^ BITMAP_TBL_XOR;
+                                       encode_rotate_left(&(line[i]));
+                               }
                        }
-               }
 
-               if (line[0] == ';')
-                       continue;               //don't show comments
+                       if (line[0] == ';')
+                               continue;               //don't show comments
 
-               printf("%s",line);
+                       printf("%s",line);
 
-       }
+               }
 
-       cfclose(ifile);
+               cfclose(ifile);
+
+       }
 
 //     printf( " Diagnostic:\n\n");
 //     printf( "  -emul           %s\n", "Certain video cards need this option in order to run game");
@@ -1219,7 +1224,14 @@ int main(int argc,char **argv)
 
        if (! cfile_init("descent2.hog"))
                if (! cfile_init("d2demo.hog"))
-                       Error("Could not find a valid hog file (descent2.hog or d2demo.hog)");
+                       Warning("Could not find a valid hog file (descent2.hog or d2demo.hog)\nPossible locations are:\n"
+#ifdef __unix__
+                             "\t$HOME/.d2x\n"
+                             "\t" SHAREPATH "\n"
+#else
+                                 "\tCurrent directory\n"
+#endif
+                                 "Or use the -hogdir option to specify an alternate location.");
        load_text();
 
        //print out the banner title