about summary refs log tree commit diff
path: root/src/engine/shared
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-03-13 11:07:21 +0100
committeroy <Tom_Adams@web.de>2011-03-13 11:07:21 +0100
commitd1e8707c6c194d798434b1801d0af57a02fecbf7 (patch)
tree4f8495303d1bb3a17160d5f0957470ebae0e2fd5 /src/engine/shared
parentbe8f669333b01e32465c515728fccabaa627bd37 (diff)
downloadzcatch-d1e8707c6c194d798434b1801d0af57a02fecbf7.tar.gz
zcatch-d1e8707c6c194d798434b1801d0af57a02fecbf7.zip
fixed demo length info and let the demo recorder search within sub folders for maps
Diffstat (limited to 'src/engine/shared')
-rw-r--r--src/engine/shared/demo.cpp12
1 files changed, 9 insertions, 3 deletions
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)
 {
@@ -45,6 +43,14 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
 	}
 	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);
 		m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demo_recorder", aBuf);
@@ -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;