Fixed saving files from CBot

dev-mp
krzys-h 2014-12-20 18:16:21 +01:00
parent ce27a80caa
commit af9960d41e
2 changed files with 5 additions and 10 deletions

View File

@ -277,7 +277,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
m_showLimit[i].link = 0;
}
CScript::m_filesDir = m_dialog->GetFilesDir();
CScript::m_filesDir = CResourceManager::GetSaveLocation()+"/"+m_dialog->GetFilesDir(); //TODO: Refactor to PHYSFS while rewriting CBot engine
CScript::InitFonctions();
}

View File

@ -3493,13 +3493,7 @@ void PrepareFilename(CBotString &filename)
int pos = filename.ReverseFind('/');
if ( pos > 0 )
{
filename = filename.Mid(pos+1); // Remove files with
}
pos = filename.ReverseFind('/');
if ( pos > 0 )
{
filename = filename.Mid(pos+1); // also with /
filename = filename.Mid(pos+1); // Remove files with /
}
pos = filename.ReverseFind(':');
@ -3509,6 +3503,7 @@ void PrepareFilename(CBotString &filename)
}
filename = CBotString(CScript::m_filesDir.c_str()) + CBotString("/") + filename;
CLogger::GetInstancePointer()->Debug("CBot accessing file '%s'\n", static_cast<const char*>(filename));
}
@ -3553,7 +3548,7 @@ bool CScript::rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int&
m_CompteurFileOpen ++;
// save the channel file
// save the file handle
pVar = pThis->GetItem("handle");
pVar->SetValInt(reinterpret_cast<long>(pFile));
}
@ -3663,7 +3658,7 @@ bool CScript::rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exce
m_CompteurFileOpen ++;
// Registered the channel file
// save file handle
pVar = pThis->GetItem("handle");
pVar->SetValInt(reinterpret_cast<long>(pFile));