From 10517756b8c14c8962b0305bd6c34550ce9cea44 Mon Sep 17 00:00:00 2001 From: johns <> Date: Fri, 26 Jul 2002 14:40:26 +0000 Subject: [PATCH] More informative header. --- src/game/savegame.cpp | 1 + src/network/commands.cpp | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/game/savegame.cpp b/src/game/savegame.cpp index bcf059686..d6005fb9d 100644 --- a/src/game/savegame.cpp +++ b/src/game/savegame.cpp @@ -94,6 +94,7 @@ global void SaveGame(const char* filename) fprintf(file,";;;(save-game\n"); fprintf(file,";;; 'comment\t\"Generated by FreeCraft Version " VERSION "\"\n"); fprintf(file,";;; 'comment\t\"Visit http://FreeCraft.Org for more informations\"\n"); + fprintf(file,";;; 'comment\t\"$Id$\"\n"); fprintf(file,";;; 'type\t\"%s\"\n","single-player"); fprintf(file,";;; 'date\t\"%s\"\n",s); fprintf(file,";;; 'map\t\"%s\"\n",TheMap.Description); diff --git a/src/network/commands.cpp b/src/network/commands.cpp index 760821328..e06dd958a 100644 --- a/src/network/commands.cpp +++ b/src/network/commands.cpp @@ -31,6 +31,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #if !defined(_MSC_VER) || !defined(_WIN32_WCE) #include <time.h> #endif @@ -41,6 +42,8 @@ #include "actions.h" #include "player.h" #include "network.h" +#include "netconnect.h" +#include "campaign.h" // for CurrentMapPath //---------------------------------------------------------------------------- // Declaration @@ -89,17 +92,40 @@ local void CommandLog(const char* name,const Unit* unit,int flag, if( !logf ) { time_t now; char buf[256]; + char* s; + char* s1; sprintf(buf,"log_of_freecraft_%d.log",ThisPlayer->Player); logf=fopen(buf,"wb"); if( !logf ) { return; } - fprintf(logf,";;; Log file generated by FreeCraft Version " - VERSION "\n"); + time(&now); - fprintf(logf,";;;\tDate: %s",ctime(&now)); - fprintf(logf,";;;\tMap: %s\n\n",TheMap.Description); + s=ctime(&now); + if( (s1=strchr(s,'\n')) ) { + *s1='\0'; + } + + // + // Parseable header + // + fprintf(logf,";;;(replay-log\n"); + fprintf(logf,";;; 'comment\t\"Generated by FreeCraft Version " VERSION "\"\n"); + fprintf(logf,";;; 'comment\t\"Visit http://FreeCraft.Org for more informations\"\n"); + fprintf(logf,";;; 'comment\t\"$Id$\"\n"); + fprintf(logf,";;; 'type\t\"%s\"\n","single-player"); + fprintf(logf,";;; 'date\t\"%s\"\n",s); + fprintf(logf,";;; 'map\t\"%s\"\n",TheMap.Description); + fprintf(logf,";;; 'map-id\t%u\n",TheMap.Info->MapUID); + fprintf(logf,";;; 'map-path\t\"%s\"\n",CurrentMapPath); + fprintf(logf,";;; 'engine\t'(%d %d %d)\n", + FreeCraftMajorVersion,FreeCraftMinorVersion,FreeCraftPatchLevel); + fprintf(logf,";;; 'network\t'(%d %d %d)\n", + NetworkProtocolMajorVersion, + NetworkProtocolMinorVersion, + NetworkProtocolPatchLevel); + fprintf(logf,";;; )\n"); } //