Removed obsolete save directory configuration

This was used in one of the CeeBots probably for setting up networked installations in schools. This is now obsolete since now those are only paths relative to main PHYSFS save directory.
master
krzys-h 2015-07-19 15:57:48 +02:00
parent ffb387f8af
commit 264f5dc278
8 changed files with 19 additions and 83 deletions

View File

@ -92,6 +92,10 @@ CPlayerProfile::CPlayerProfile(std::string playerName)
LoadApperance();
}
CPlayerProfile::~CPlayerProfile()
{
}
std::string CPlayerProfile::GetLastName()
{
std::string name;
@ -102,9 +106,9 @@ std::string CPlayerProfile::GetLastName()
return name;
}
CPlayerProfile::~CPlayerProfile()
std::vector<std::string> CPlayerProfile::GetPlayerList()
{
return CResourceManager::ListDirectories("savegame");
}
bool CPlayerProfile::Delete()
@ -119,7 +123,7 @@ std::string CPlayerProfile::GetName()
std::string CPlayerProfile::GetSaveDir()
{
return std::string(CRobotMain::GetInstancePointer()->GetSavegameDir()) + "/" + m_playerName;
return "savegame/" + m_playerName;
}
std::string CPlayerProfile::GetSaveFile(std::string filename)

View File

@ -24,6 +24,7 @@
#include <string>
#include <map>
#include <vector>
struct LevelInfo
{
@ -46,8 +47,9 @@ class CPlayerProfile
{
public:
CPlayerProfile(std::string playerName);
static std::string GetLastName();
~CPlayerProfile();
static std::string GetLastName();
static std::vector<std::string> GetPlayerList();
bool Delete();

View File

@ -319,7 +319,7 @@ void CRobotMain::Create()
SelectPlayer(CPlayerProfile::GetLastName());
CScriptFunctions::m_filesDir = CResourceManager::GetSaveLocation() + "/" + m_dialog->GetFilesDir(); //TODO: Refactor to PHYSFS while rewriting CBot engine
CScriptFunctions::m_filesDir = CResourceManager::GetSaveLocation() + "/files"; //TODO: Refactor to PHYSFS while rewriting CBot engine
CScriptFunctions::Init();
}
@ -5643,21 +5643,6 @@ bool CRobotMain::GetRadar()
return false;
}
const char* CRobotMain::GetSavegameDir()
{
return m_dialog->GetSavegameDir().c_str();
}
const char* CRobotMain::GetPublicDir()
{
return m_dialog->GetPublicDir().c_str();
}
const char* CRobotMain::GetFilesDir()
{
return m_dialog->GetFilesDir().c_str();
}
MissionType CRobotMain::GetMissionType()
{
return m_missionType;

View File

@ -255,9 +255,6 @@ public:
bool GetSceneSoluce();
bool GetShowAll();
bool GetRadar();
const char* GetSavegameDir();
const char* GetPublicDir();
const char* GetFilesDir();
MissionType GetMissionType();
int GetGamerFace();

View File

@ -2898,13 +2898,12 @@ void PrepareFilename(CBotString &filename, const char *dir)
bool CScriptFunctions::rDeleteFile(CBotVar* var, CBotVar* result, int& exception, void* user)
{
CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CBotString cbs;
const char* filename;
const char* dir;
cbs = var->GetValString();
dir = script->m_main->GetFilesDir();
dir = CScriptFunctions::m_filesDir.c_str();
PrepareFilename(cbs, dir);
filename = cbs;
//std function that removes file.

View File

@ -176,10 +176,6 @@ CMainDialog::CMainDialog()
m_partiTime[i] = 0.0f;
}
m_savegameDir = "savegame";
m_publicDir = "program";
m_filesDir = "files";
m_setupFull = false;
m_bDialog = false;
@ -3346,13 +3342,6 @@ void CMainDialog::BuildResumeName(char *filename, std::string base, int chap, in
sprintf(filename, "%s %d.%d", base.c_str(), chap, rank);
}
// Returns the name of the file or save the files.
std::string & CMainDialog::GetFilesDir()
{
return m_filesDir;
}
// Updates the list of players after checking the files on disk.
@ -3364,10 +3353,10 @@ void CMainDialog::ReadNameList()
if (pl == nullptr) return;
pl->Flush();
auto userSaveDirs = CResourceManager::ListDirectories(m_savegameDir);
for (int i = 0; i < static_cast<int>(userSaveDirs.size()); ++i)
auto players = CPlayerProfile::GetPlayerList();
for (int i = 0; i < static_cast<int>(players.size()); ++i)
{
pl->SetItemName(i, userSaveDirs.at(i).c_str());
pl->SetItemName(i, players.at(i).c_str());
}
}
@ -4858,9 +4847,6 @@ void CMainDialog::ChangeSetupButtons()
void CMainDialog::SetupMemorize()
{
GetConfigFile().SetStringProperty("Directory", "savegame", m_savegameDir);
GetConfigFile().SetStringProperty("Directory", "public", m_publicDir);
GetConfigFile().SetStringProperty("Directory", "files", m_filesDir);
GetConfigFile().SetIntProperty("Setup", "Tooltips", m_bTooltip);
GetConfigFile().SetIntProperty("Setup", "InterfaceGlint", m_bGlint);
GetConfigFile().SetIntProperty("Setup", "InterfaceGlint", m_bRain);
@ -4935,22 +4921,6 @@ void CMainDialog::SetupRecall()
int iValue;
std::string key;
if ( GetConfigFile().GetStringProperty("Directory", "savegame", key) )
{
m_savegameDir = key;
}
if ( GetConfigFile().GetStringProperty("Directory", "public", key) )
{
m_publicDir = key;
}
if ( GetConfigFile().GetStringProperty("Directory", "files", key) )
{
m_filesDir = key;
}
if ( GetConfigFile().GetIntProperty("Setup", "TotoMode", iValue) )
{
m_engine->SetTotoMode(iValue);
@ -5829,20 +5799,6 @@ bool CMainDialog::GetSceneSoluce()
return m_bSceneSoluce;
}
// Returns the name of the folder to save.
std::string & CMainDialog::GetSavegameDir()
{
return m_savegameDir;
}
// Returns the name of public folder.
std::string & CMainDialog::GetPublicDir()
{
return m_publicDir;
}
// Indicates if there are reflections on the buttons.

View File

@ -69,8 +69,6 @@ public:
std::string GetCustomLevelDir();
bool GetSceneSoluce();
std::string & GetSavegameDir();
std::string & GetPublicDir();
bool GetTooltip();
bool GetGlint();
@ -79,8 +77,7 @@ public:
bool GetNiceReset();
bool GetHimselfDamage();
void BuildResumeName(char *filename, std::string base, int chap, int rank);
std::string & GetFilesDir();
void BuildResumeName(char *filename, std::string base, int chap, int rank);
void StartAbort();
void StartDeleteObject();
@ -164,10 +161,6 @@ protected:
int m_apperanceTab; // perso: tab selected
float m_apperanceAngle; // perso: angle of presentation
std::string m_savegameDir; // savegame folder
std::string m_publicDir; // program folder
std::string m_filesDir; // case files
LevelCategory m_category; // 0..4
std::map<LevelCategory, int> m_chap; // selected chapter (0..8)
std::map<LevelCategory, int> m_sel; // chosen mission (0..98)

View File

@ -1579,11 +1579,11 @@ std::string CStudio::SearchDirectory(bool bCreate)
std::string dir;
if ( m_main->GetIOPublic() )
{
dir = std::string(m_main->GetPublicDir()) + "/";
dir = "public";
}
else
{
dir = m_main->GetPlayerProfile()->GetSaveFile("program/");
dir = m_main->GetPlayerProfile()->GetSaveFile("program");
}
if ( bCreate )
@ -1591,7 +1591,7 @@ std::string CStudio::SearchDirectory(bool bCreate)
if (!CResourceManager::DirectoryExists(dir))
CResourceManager::CreateDirectory(dir);
}
return dir;
return dir+"/";
}
// Reads a new program.