mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 15:08:19 +00:00
ddnet-saves.txt: Also parse correctly when saving on other country
This commit is contained in:
parent
431d824cf1
commit
53971f44f1
|
@ -556,16 +556,18 @@ void CChat::StoreSave(const char *pText)
|
||||||
{
|
{
|
||||||
const char *pStart = str_find(pText, "Team successfully saved by ");
|
const char *pStart = str_find(pText, "Team successfully saved by ");
|
||||||
const char *pMid = str_find(pText, ". Use '/load ");
|
const char *pMid = str_find(pText, ". Use '/load ");
|
||||||
const char *pEnd = str_find(pText, "' to continue");
|
const char *pOn = str_find(pText, "' on ");
|
||||||
|
const char *pEnd = str_find(pText, pOn ? " to continue" : "' to continue");
|
||||||
|
|
||||||
if(!pStart || !pMid || !pEnd || pMid < pStart || pEnd < pMid)
|
if(!pStart || !pMid || !pEnd || pMid < pStart || pEnd < pMid || (pOn && (pOn < pMid || pEnd < pOn)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char aName[16];
|
char aName[16];
|
||||||
str_copy(aName, pStart + 27, minimum(static_cast<size_t>(pMid - pStart - 26), sizeof(aName)));
|
str_copy(aName, pStart + 27, minimum(static_cast<size_t>(pMid - pStart - 26), sizeof(aName)));
|
||||||
|
|
||||||
char aSaveCode[64];
|
char aSaveCode[64];
|
||||||
str_copy(aSaveCode, pMid + 13, minimum(static_cast<size_t>(pEnd - pMid - 12), sizeof(aSaveCode)));
|
|
||||||
|
str_copy(aSaveCode, pMid + 13, minimum(static_cast<size_t>((pOn ? pOn : pEnd) - pMid - 12), sizeof(aSaveCode)));
|
||||||
|
|
||||||
char aTimestamp[20];
|
char aTimestamp[20];
|
||||||
str_timestamp_format(aTimestamp, sizeof(aTimestamp), FORMAT_SPACE);
|
str_timestamp_format(aTimestamp, sizeof(aTimestamp), FORMAT_SPACE);
|
||||||
|
|
Loading…
Reference in a new issue