More informative header.

This commit is contained in:
johns 2002-07-26 14:40:26 +00:00
parent 6633d1382d
commit 10517756b8
2 changed files with 31 additions and 4 deletions

View file

@ -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);

View file

@ -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");
}
//