mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix external records
This commit is contained in:
parent
eabe4639c8
commit
7f65d880f3
|
@ -15,6 +15,7 @@
|
|||
#include <engine/shared/packer.h>
|
||||
#include <engine/shared/datafile.h>
|
||||
#include <engine/shared/demorec.h>
|
||||
#include <engine/shared/storage.h>
|
||||
|
||||
#include <engine/server.h>
|
||||
#include <engine/map.h>
|
||||
|
@ -1633,14 +1634,25 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
pConsole->ExecuteLine("sv_npc 0", 4, -1);
|
||||
pConsole->ExecuteLine("sv_phook 1", 4, -1);
|
||||
pConsole->ExecuteLine("sv_endless_drag 0",4,-1);
|
||||
|
||||
|
||||
//TODO it is in 2 places (and in one file O_o)
|
||||
// execute autoexec file
|
||||
pConsole->ExecuteFile("autoexec.cfg");
|
||||
|
||||
|
||||
// parse the command line arguments
|
||||
if(argc > 1) // ignore_convention
|
||||
pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention
|
||||
|
||||
CStorage * storage = static_cast<CStorage*>(pStorage);
|
||||
|
||||
if(g_Config.m_SvExternalRecords == 1) {
|
||||
char pathBuf[512];
|
||||
str_format(pathBuf, sizeof(pathBuf), "%s/records", storage->m_aApplicationSavePath);
|
||||
fs_makedir(pathBuf);
|
||||
}
|
||||
|
||||
// run the server
|
||||
pServer->Run();
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ MACRO_CONFIG_STR(SvRconPasswordHelper, sv_rcon_password_helper, 32, "", CFGFLAG_
|
|||
MACRO_CONFIG_INT(SvNetmsgLimit, sv_netmsg_limit, 0, 0, 100, CFGFLAG_SERVER, "How Many unauthed Command Tries Before ban")
|
||||
MACRO_CONFIG_INT(SvNetmsgBanTime, sv_netmsg_bantime, 300, 0, 9999, CFGFLAG_SERVER, "How Much time will the unauthed rcon command spammer will be banned")
|
||||
|
||||
MACRO_CONFIG_INT(SvExternalRecords, sv_exteranal_records, 0, 0, 1, CFGFLAG_SERVER, "All records will be holded in the same dir as maps")
|
||||
MACRO_CONFIG_INT(SvExternalRecords, sv_external_records, 0, 0, 1, CFGFLAG_SERVER, "All records will be holded in the same dir as maps")
|
||||
|
||||
//=============================== */
|
||||
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
str_format(aPath, sizeof(aPath), "%s/demos", m_aApplicationSavePath);
|
||||
fs_makedir(aPath);
|
||||
|
||||
if(g_Config.m_SvExternalRecords) {
|
||||
str_format(aPath, sizeof(aPath), "%s/records", m_aApplicationSavePath);
|
||||
fs_makedir(aPath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return FindDatadir(pArgv0);
|
||||
|
@ -172,7 +169,7 @@
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
IStorage *CreateStorage(const char *pApplicationName, const char *pArgv0) { return CStorage::Create(pApplicationName, pArgv0); }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
IStorage *CreateStorage(const char *pApplicationName, const char *pArgv0) { return CStorage::Create(pApplicationName, pArgv0); }
|
||||
IStorage *CreateStorage(const char *pApplicationName, const char *pArgv0);
|
||||
|
||||
#endif
|
|
@ -59,7 +59,15 @@ void CScore::Save()
|
|||
void CScore::Load()
|
||||
{
|
||||
std::fstream f;
|
||||
f.open(SaveFile().c_str(), std::ios::in);
|
||||
if(!g_Config.m_SvExternalRecords) {
|
||||
f.open(SaveFile().c_str(), std::ios::out);
|
||||
} else {
|
||||
char buf[512];
|
||||
CServer* server = static_cast<CServer*>(m_pGameServer->Server());
|
||||
CStorage* storage = static_cast<CStorage*>(server->Storage());
|
||||
str_format(buf, sizeof(buf), "%s/records/%s", storage->m_aApplicationSavePath ,SaveFile().c_str());
|
||||
f.open(buf, std::ios::out);
|
||||
}
|
||||
top.clear();
|
||||
while (!f.eof() && !f.fail())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue