File score: report file opening errors

This commit is contained in:
def 2019-04-10 22:13:01 +02:00 committed by Dennis Felsing
parent 279d6e60ca
commit 0a286b1d94

View file

@ -70,7 +70,11 @@ void CFileScore::SaveScoreThread(void *pUser)
lock_wait(gs_ScoreLock); lock_wait(gs_ScoreLock);
std::fstream f; std::fstream f;
f.open(SaveFile().c_str(), std::ios::out); f.open(SaveFile().c_str(), std::ios::out);
if (!f.fail()) if(f.fail())
{
dbg_msg("filescore", "opening '%s' for writing failed", SaveFile().c_str());
}
else
{ {
int t = 0; int t = 0;
for (sorted_array<CPlayerScore>::range r = pSelf->m_Top.all(); for (sorted_array<CPlayerScore>::range r = pSelf->m_Top.all();
@ -109,6 +113,10 @@ void CFileScore::Init()
std::fstream f; std::fstream f;
f.open(SaveFile().c_str(), std::ios::in); f.open(SaveFile().c_str(), std::ios::in);
if(f.fail())
{
dbg_msg("filescore", "opening '%s' for reading failed", SaveFile().c_str());
}
while (!f.eof() && !f.fail()) while (!f.eof() && !f.fail())
{ {
std::string TmpName, TmpScore, TmpCpLine; std::string TmpName, TmpScore, TmpCpLine;