From 26dbb86d0ba0073c0ddd83129b66c397f1ec9e3e Mon Sep 17 00:00:00 2001 From: def Date: Thu, 5 Jun 2014 15:19:26 +0200 Subject: [PATCH] Fix: Save news in teeworlds settings directory --- src/engine/client/client.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index ad9f48be1..82dae1f84 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1134,13 +1134,12 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket) mem_copy(m_aNews, (char*)pPacket->m_pData + sizeof(VERSIONSRV_NEWS), NEWS_SIZE); - IOHANDLE newsFile = io_open("news", IOFLAG_WRITE); - if (!newsFile) - return; - - io_write(newsFile, m_aNews, sizeof(m_aNews)); - - io_close(newsFile); + IOHANDLE newsFile = m_pStorage->OpenFile("ddnet-news.txt", IOFLAG_WRITE, IStorage::TYPE_SAVE); + if (newsFile) + { + io_write(newsFile, m_aNews, sizeof(m_aNews)); + io_close(newsFile); + } } // map version list @@ -2318,13 +2317,12 @@ void CClient::InitInterfaces() } m_Friends.Init(); - IOHANDLE newsFile = io_open("news", IOFLAG_READ); - if (!newsFile) - return; - - io_read(newsFile, m_aNews, NEWS_SIZE); - - io_close(newsFile); + IOHANDLE newsFile = m_pStorage->OpenFile("ddnet-news.txt", IOFLAG_READ, IStorage::TYPE_SAVE); + if (newsFile) + { + io_read(newsFile, m_aNews, NEWS_SIZE); + io_close(newsFile); + } } void CClient::Run()