Change sfrotz over to using common/defines.h for version and build date info.
authorDavid Griffith <dave@661.org>
Tue, 27 Mar 2018 10:51:08 +0000 (03:51 -0700)
committerDavid Griffith <dave@661.org>
Tue, 27 Mar 2018 10:51:08 +0000 (03:51 -0700)
Makefile
src/sdl/sf_frotz.h
src/sdl/sf_util.c
src/sdl/sf_video.c

index 973ed82b99fb6c2483ee80e2cc3ccf25514a5806..80ffb923beba65d2a4e3557ae91c083f13672cc4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -214,6 +214,8 @@ $(SRCDIR)/blorblib.a: $(BLORB_OBJECT)
 $(COMMON_DIR)/defines.h:
        @echo "Generating $@"
        @echo "#define VERSION \"$(VERSION)\"" > $@
+       @echo "#define VERSION_MAJOR \"$(MAJOR)\"" >> $@
+       @echo "#define VERSION_MINOR \"$(MINOR)\"" >> $@
        @echo "#define BUILD_DATE_TIME \"$(BUILD_DATE_TIME)\"" >> $@
 
 $(CURSES_DIR)/defines.h:
index b6da1d4d5efd9ef9b071edb0c28e743bfabd50b1..dc404b5733e5342115f5a0519f942177e44fdc0a 100644 (file)
@@ -4,10 +4,6 @@
 #include "../common/frotz.h"
 #include "../blorb/blorb.h"
 
-// version info
-#define SFROTZ_MAJOR 0
-#define SFROTZ_MINOR 2
-
 // typedef unsigned char byte;
 // typedef unsigned short word;
 // typedef unsigned long ulong;
index 86e83167e028fa3dec8786e6897666a129d53107..017129e5b9e268cb328f96e23ca2887e13e26a75 100644 (file)
@@ -12,6 +12,7 @@
 #include <io.h>
 #endif
 
+#include "../common/defines.h"
 #include "sf_frotz.h"
 
 f_setup_t f_setup;
@@ -106,7 +107,7 @@ extern int option_scrollback_buffer;
 
 static char *info1 =
        "\n"
-       "SDL Frotz V%d.%02d build %s - interpreter for z-code games.\n"
+       "SDL Frotz V%s build %s - interpreter for z-code games.\n"
        "Complies with Standard 1.0; supports Blorb resources and Quetzal save files.\n"
        "Based on Frotz 2.40 by Stefan Jokisch and WindowsFrotz2000 by David Kinder.\n"
        "\n"
@@ -138,17 +139,15 @@ static char *infos[] = {
        "-Z # error checking (see below)",
        NULL};
 
-static char *info2 = 
+static char *info2 =
        "\nError checking: 0 none, 1 first only (default), 2 all, 3 exit after any error.\n"
        "For more options and explanations, please read the HTML manual.\n";
 
-static char * getbuilddatetime( int tf);
-
 #define WIDCOL 40
 static void usage()
   {
   char **p = infos; int i=0,len=0;
-  printf(info1,SFROTZ_MAJOR,SFROTZ_MINOR,getbuilddatetime(1));
+  printf(info1,VERSION,BUILD_DATE_TIME);
   while (*p)
        {
        if (i)
@@ -971,24 +970,3 @@ static char * getexepath( char *buf){
 #define _stat stat
 #endif
 
-static char * getbuilddatetime( int tf){
-  time_t t; struct tm *tm;
-  struct _stat sta;
-  static char buf[263];
-
-  getexepath(buf);
-  _stat(buf,&sta);
-  t = sta.st_mtime;
-  tm = localtime(&t);
-  buf[0] = 0;
-  sprintf(buf,"%04d%02d%02d",
-               tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
-  if (tf){
-    strcat(buf,".");
-    sprintf(buf+strlen(buf),"%02d%02d%02d",
-       tm->tm_hour, tm->tm_min, tm->tm_sec);
-    }
-  return buf;
-  }
-
-
index 75f358e09223cc4795d570e15aee0da283db5192..dd7023bb4b8de4bb0ffb90889447873be119a366 100644 (file)
@@ -9,6 +9,7 @@
 \r
 #include "generic.h"\r
 \r
+#include "../common/defines.h"\r
 #include "sf_frotz.h"\r
 \r
 static SDL_Rect blitrect = {0,0,0,0};\r
@@ -421,8 +422,8 @@ void sf_initvideo( int W, int H, int full)
   Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER |\r
        SDL_INIT_AUDIO;\r
 \r
-  sprintf(banner,"SDL Frotz v%d.%02d - %s (z%d)",SFROTZ_MAJOR,SFROTZ_MINOR,\r
-       stripped_story_name,h_version);\r
+  sprintf(banner,"SDL Frotz v%s - %s (z%d)",VERSION,\r
+       f_setup.story_name,h_version);\r
   desired_bpp = 32;\r
   video_flags = 0;\r
 \r