mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-17 21:48:19 +00:00
Fix server-side demos with maps in folders
When maps are loaded from folders on the server, the same folders were used for demos but recording would usually fail due to the folders not existing in the demos folder. Furthermore, the map name being written in the demo header also included the folder names, which causes the client to not find the map unless it also exists at that location. Closes #9033.
This commit is contained in:
parent
e24b87adbd
commit
ab60d0bf70
|
@ -3393,13 +3393,13 @@ void CServer::DemoRecorder_HandleAutoStart()
|
||||||
char aTimestamp[20];
|
char aTimestamp[20];
|
||||||
str_timestamp(aTimestamp, sizeof(aTimestamp));
|
str_timestamp(aTimestamp, sizeof(aTimestamp));
|
||||||
char aFilename[IO_MAX_PATH_LENGTH];
|
char aFilename[IO_MAX_PATH_LENGTH];
|
||||||
str_format(aFilename, sizeof(aFilename), "demos/auto/server/%s_%s.demo", m_aCurrentMap, aTimestamp);
|
str_format(aFilename, sizeof(aFilename), "demos/auto/server/%s_%s.demo", GetMapName(), aTimestamp);
|
||||||
m_aDemoRecorder[RECORDER_AUTO].Start(
|
m_aDemoRecorder[RECORDER_AUTO].Start(
|
||||||
Storage(),
|
Storage(),
|
||||||
m_pConsole,
|
m_pConsole,
|
||||||
aFilename,
|
aFilename,
|
||||||
GameServer()->NetVersion(),
|
GameServer()->NetVersion(),
|
||||||
m_aCurrentMap,
|
GetMapName(),
|
||||||
m_aCurrentMapSha256[MAP_TYPE_SIX],
|
m_aCurrentMapSha256[MAP_TYPE_SIX],
|
||||||
m_aCurrentMapCrc[MAP_TYPE_SIX],
|
m_aCurrentMapCrc[MAP_TYPE_SIX],
|
||||||
"server",
|
"server",
|
||||||
|
@ -3423,7 +3423,7 @@ void CServer::SaveDemo(int ClientId, float Time)
|
||||||
if(IsRecording(ClientId))
|
if(IsRecording(ClientId))
|
||||||
{
|
{
|
||||||
char aNewFilename[IO_MAX_PATH_LENGTH];
|
char aNewFilename[IO_MAX_PATH_LENGTH];
|
||||||
str_format(aNewFilename, sizeof(aNewFilename), "demos/%s_%s_%05.2f.demo", m_aCurrentMap, m_aClients[ClientId].m_aName, Time);
|
str_format(aNewFilename, sizeof(aNewFilename), "demos/%s_%s_%05.2f.demo", GetMapName(), m_aClients[ClientId].m_aName, Time);
|
||||||
m_aDemoRecorder[ClientId].Stop(IDemoRecorder::EStopMode::KEEP_FILE, aNewFilename);
|
m_aDemoRecorder[ClientId].Stop(IDemoRecorder::EStopMode::KEEP_FILE, aNewFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3433,13 +3433,13 @@ void CServer::StartRecord(int ClientId)
|
||||||
if(Config()->m_SvPlayerDemoRecord)
|
if(Config()->m_SvPlayerDemoRecord)
|
||||||
{
|
{
|
||||||
char aFilename[IO_MAX_PATH_LENGTH];
|
char aFilename[IO_MAX_PATH_LENGTH];
|
||||||
str_format(aFilename, sizeof(aFilename), "demos/%s_%d_%d_tmp.demo", m_aCurrentMap, m_NetServer.Address().port, ClientId);
|
str_format(aFilename, sizeof(aFilename), "demos/%s_%d_%d_tmp.demo", GetMapName(), m_NetServer.Address().port, ClientId);
|
||||||
m_aDemoRecorder[ClientId].Start(
|
m_aDemoRecorder[ClientId].Start(
|
||||||
Storage(),
|
Storage(),
|
||||||
Console(),
|
Console(),
|
||||||
aFilename,
|
aFilename,
|
||||||
GameServer()->NetVersion(),
|
GameServer()->NetVersion(),
|
||||||
m_aCurrentMap,
|
GetMapName(),
|
||||||
m_aCurrentMapSha256[MAP_TYPE_SIX],
|
m_aCurrentMapSha256[MAP_TYPE_SIX],
|
||||||
m_aCurrentMapCrc[MAP_TYPE_SIX],
|
m_aCurrentMapCrc[MAP_TYPE_SIX],
|
||||||
"server",
|
"server",
|
||||||
|
@ -3501,7 +3501,7 @@ void CServer::ConRecord(IConsole::IResult *pResult, void *pUser)
|
||||||
pServer->Console(),
|
pServer->Console(),
|
||||||
aFilename,
|
aFilename,
|
||||||
pServer->GameServer()->NetVersion(),
|
pServer->GameServer()->NetVersion(),
|
||||||
pServer->m_aCurrentMap,
|
pServer->GetMapName(),
|
||||||
pServer->m_aCurrentMapSha256[MAP_TYPE_SIX],
|
pServer->m_aCurrentMapSha256[MAP_TYPE_SIX],
|
||||||
pServer->m_aCurrentMapCrc[MAP_TYPE_SIX],
|
pServer->m_aCurrentMapCrc[MAP_TYPE_SIX],
|
||||||
"server",
|
"server",
|
||||||
|
|
Loading…
Reference in a new issue