Only reload map afer saving in editor if we're on localhost

This commit is contained in:
def 2014-01-24 03:41:30 +01:00
parent 6997a801bc
commit 4f6e2eb11f

View file

@ -450,10 +450,18 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
{ {
CServerInfo CurrentServerInfo; CServerInfo CurrentServerInfo;
m_pEditor->Client()->GetServerInfo(&CurrentServerInfo); m_pEditor->Client()->GetServerInfo(&CurrentServerInfo);
char aMapName[128]; const unsigned char ipv4Localhost[16] = {127,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0};
m_pEditor->ExtractName(pFileName, aMapName, sizeof(aMapName)); const unsigned char ipv6Localhost[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
if(!str_comp(aMapName, CurrentServerInfo.m_aMap))
m_pEditor->Client()->Rcon("reload"); // and if we're on localhost
if(!mem_comp(CurrentServerInfo.m_NetAddr.ip, ipv4Localhost, sizeof(ipv4Localhost))
|| !mem_comp(CurrentServerInfo.m_NetAddr.ip, ipv6Localhost, sizeof(ipv6Localhost)))
{
char aMapName[128];
m_pEditor->ExtractName(pFileName, aMapName, sizeof(aMapName));
if(!str_comp(aMapName, CurrentServerInfo.m_aMap))
m_pEditor->Client()->Rcon("reload");
}
} }
return 1; return 1;