5125: Fix server loading map twice on startup r=def- a=Zwelf

Fixes creating two teehistorian files. And probably increases performance :). Fixes #5121 

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Zwelf <zwelf@strct.cc>
This commit is contained in:
bors[bot] 2022-05-14 19:58:21 +00:00 committed by GitHub
commit 450e6a53f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2383,6 +2383,8 @@ void CServer::ChangeMap(const char *pMap)
int CServer::LoadMap(const char *pMapName)
{
m_MapReload = false;
char aBuf[IO_MAX_PATH_LENGTH];
str_format(aBuf, sizeof(aBuf), "maps/%s.map", pMapName);
GameServer()->OnMapChange(aBuf, sizeof(aBuf));
@ -2602,8 +2604,6 @@ int CServer::Run()
// load new map TODO: don't poll this
if(m_MapReload)
{
m_MapReload = false;
// load map
if(LoadMap(Config()->m_SvMap))
{