Ticket #2745: 2745.diff

File 2745.diff, 1.2 KB (added by trompetin17, 9 years ago)
  • source/ps/Replay.cpp

     
    1 /* Copyright (C) 2014 Wildfire Games.
     1/* Copyright (C) 2015 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
    44 * 0 A.D. is free software: you can redistribute it and/or modify
     
    3232#include "scriptinterface/ScriptStats.h"
    3333#include "simulation2/Simulation2.h"
    3434#include "simulation2/helpers/SimulationCommand.h"
     35#include "lib/svn_revision.h"
    3536
    3637#include <sstream>
    3738#include <fstream>
     
    7778
    7879void CReplayLogger::StartGame(JS::MutableHandleValue attribs)
    7980{
     81    char svnRevision[32];
     82    sprintf_s(svnRevision, ARRAY_SIZE(svnRevision), "%ls", svn_revision);
     83    *m_Stream << "version " << svnRevision << "\n";
    8084    *m_Stream << "start " << m_ScriptInterface.StringifyJSON(attribs, false) << "\n";
    8185}
    8286
     
    243247            if (turn % 20 == 0)
    244248                g_ProfileViewer.SaveToFile();
    245249        }
     250        else if (type == "version")
     251        {
     252            std::string s_version;
     253            std::getline(*m_Stream, s_version);
     254            debug_printf(L"version %hs\n", s_version.c_str());
     255        }
    246256        else
    247257        {
    248258            debug_printf(L"Unrecognised replay token %hs\n", type.c_str());