************************************************************

* Merged Source Code from Development Trunk: Revision 4063 *
************************************************************
- Source Code is merged from: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP
- This will be the Source for the Beta 2011 Test

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4064 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-01-18 09:11:09 +00:00
parent 44e1646410
commit 91087ca8c0
469 changed files with 118108 additions and 24678 deletions
+36
View File
@@ -525,3 +525,39 @@ void CheckForContinue()
}
}
}
#include <vfs/Core/vfs_os_functions.h>
#include <vfs/Core/vfs_profile.h>
#include <vfs/Core/vfs.h>
#include <vfs/Core/vfs_init.h>
void ja2::mp::InitializeMultiplayerProfile(vfs::Path const& profileRoot)
{
// does the profile root directory actually exist
if(!vfs::OS::checkRealDirectory(profileRoot))
{
// OK, directory did not exist, probably a new profile
SGP_THROW_IFFALSE( vfs::OS::createRealDirectory(profileRoot),
_BS(L"Could not create directory : ") << profileRoot << _BS::wget );
}
// create and initialize a new Multiplayer profile
std::auto_ptr<vfs::CVirtualProfile> pProf( new vfs::CVirtualProfile("_MULTIPLAYER",profileRoot,true) );
if(!vfs_init::initWriteProfile(*pProf))
{
SGP_THROW(_BS(L"Could not initialize client profile") << profileRoot << _BS::wget);
}
vfs::CProfileStack *PS = getVFS()->getProfileStack();
// remove old Multiplayer profile (if it exists)
vfs::CVirtualProfile *pOldProf = PS->getProfile("_MULTIPLAYER");
if( pOldProf && (pOldProf == PS->topProfile()) )
{
SGP_THROW_IFFALSE(PS->popProfile(), L"Could not remove old \"_MULTIPLAYER\" profile");
}
// add new profile
PS->pushProfile(pProf.release());
}