From d1e8707c6c194d798434b1801d0af57a02fecbf7 Mon Sep 17 00:00:00 2001 From: oy Date: Sun, 13 Mar 2011 11:07:21 +0100 Subject: fixed demo length info and let the demo recorder search within sub folders for maps --- src/engine/shared/demo.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/engine/shared/demo.cpp') diff --git a/src/engine/shared/demo.cpp b/src/engine/shared/demo.cpp index 87d0951c..764241f1 100644 --- a/src/engine/shared/demo.cpp +++ b/src/engine/shared/demo.cpp @@ -21,8 +21,6 @@ CDemoRecorder::CDemoRecorder(class CSnapshotDelta *pSnapshotDelta) m_pSnapshotDelta = pSnapshotDelta; } -//static IOHANDLE m_File = 0; - // Record int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, const char *pFilename, const char *pNetVersion, const char *pMap, int Crc, const char *pType) { @@ -44,6 +42,14 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con MapFile = pStorage->OpenFile(aMapFilename, IOFLAG_READ, IStorage::TYPE_ALL); } if(!MapFile) + { + // search for the map within subfolders + char aBuf[512]; + str_format(aMapFilename, sizeof(aMapFilename), "%s.map", pMap); + if(pStorage->FindFile(aMapFilename, "maps", IStorage::TYPE_ALL, aBuf, sizeof(aBuf))) + MapFile = pStorage->OpenFile(aBuf, IOFLAG_READ, IStorage::TYPE_ALL); + } + if(!MapFile) { char aBuf[256]; str_format(aBuf, sizeof(aBuf), "Unable to open mapfile '%s'", pMap); @@ -247,7 +253,7 @@ int CDemoRecorder::Stop() // add the demo length to the header io_seek(m_File, gs_LengthOffset, IOSEEK_START); - int DemoLength = Length()/SERVER_TICK_SPEED; + int DemoLength = Length(); char aLength[4]; aLength[0] = (DemoLength>>24)&0xff; aLength[1] = (DemoLength>>16)&0xff; -- cgit 1.4.1