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

** Big Maps Projects code (incl. Multiplayer v1.5 **
**********************************************************
- Merged Big Maps Project code from BMP+MP trunk (Revision: 3340)
o Complete SVN Revision history: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP
- Before THIS merge, I made a branch of the existing 1.13 source
o SVN Branch: https://81.169.133.124/source/ja2/branches/JA2_rev.3336/src
- Removed old VS 6.0 and VS 2003 project and solutions files, because compilation is broken long time ago
- I will add VS 2010 projects and solution file in the next few days

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3341 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2010-02-28 18:38:52 +00:00
parent a98c44ac78
commit 14750c6903
461 changed files with 23615 additions and 120157 deletions
+43 -37
View File
@@ -34,7 +34,7 @@
#include "VFS/vfs.h"
#include "VFS/vfs_init.h"
#include "VFS/PropertyContainer.h"
#include "VFS/iteratedir.h"
#include "VFS/os_functions.h"
#include "Random.h"
@@ -128,39 +128,45 @@ CHAR16 gzServerPortField[ 5+1 ] = {0} ;
extern CHAR16 gzFileTransferDirectory[100];
#ifdef USE_VFS
utf8string const& CUniqueServerId::GetServerId(vfs::Path dir, CPropertyContainer* props)
void CUniqueServerId::uniqueRandomString(utf8string& str)
{
std::vector<wchar_t> _rand(30,0);
int pos = 0;
for(int block = 0; block < 5; ++block)
{
for(int i=0; i<5; ++i)
{
int r = Random(36);
if(r < 10)
{
r += L'0';
}
else
{
r += L'A' - 10;
}
_rand[pos++] = r;
}
_rand[pos++] = L'-';
}
str.r_wcs().assign(&_rand[0],29);
}
utf8string const& CUniqueServerId::getServerId(vfs::Path dir, CPropertyContainer* props)
{
if(!props)
{
return _id;
}
utf8string key = L"\"" + dir().c_wcs() + L"\"";
utf8string id = props->GetStringProperty(L"SERVER",key);
utf8string key = L"\"" + dir.c_wcs() + L"\"";
utf8string id = props->getStringProperty(L"SERVER",key);
if(id.empty())
{
std::vector<wchar_t> _rand(30,0);
int pos = 0;
for(int block = 0; block < 5; ++block)
{
for(int i=0; i<5; ++i)
{
int r = Random(36);
if(r < 10)
{
r += L'0';
}
else
{
r += L'A' - 10;
}
_rand[pos++] = r;
}
_rand[pos++] = L'-';
}
id.r_wcs().assign(&_rand[0],29);
uniqueRandomString(id);
}
_id = id;
props->SetStringProperty(L"SERVER",key,_id);
props->setStringProperty(L"SERVER",key,_id);
return _id;
}
@@ -221,10 +227,10 @@ UINT32 MPJoinScreenInit( void )
GetPrivateProfileStringW( L"Ja2_mp Settings",L"CLIENT_NAME", L"Player Name", gzPlayerHandleField, 12 , L"..\\Ja2_mp.ini" );
#else
CPropertyContainer props;
props.InitFromIniFile( L"Ja2_mp.ini");
props.GetStringProperty( L"Ja2_mp Settings", L"SERVER_IP", gzServerIPField, 16, "127.0.0.1");
props.GetStringProperty( L"Ja2_mp Settings", L"SERVER_PORT", gzServerPortField, 6, "60005");
props.GetStringProperty( L"Ja2_mp Settings", L"CLIENT_NAME", gzPlayerHandleField, 12, L"Player Name");
props.initFromIniFile( L"Ja2_mp.ini");
props.getStringProperty( L"Ja2_mp Settings", L"SERVER_IP", gzServerIPField, 16, "127.0.0.1");
props.getStringProperty( L"Ja2_mp Settings", L"SERVER_PORT", gzServerPortField, 6, "60005");
props.getStringProperty( L"Ja2_mp Settings", L"CLIENT_NAME", gzPlayerHandleField, 12, L"Player Name");
#endif
return( 1 );
}
@@ -245,15 +251,15 @@ void SaveJoinSettings(bool ReSaving)
WritePrivateProfileStringW( L"Ja2_mp Settings",L"CLIENT_NAME", gzPlayerHandleField , L"..\\Ja2_mp.ini" );
#else
CPropertyContainer props;
props.InitFromIniFile("Ja2_mp.ini");
props.initFromIniFile("Ja2_mp.ini");
props.SetStringProperty(L"Ja2_mp Settings",L"SERVER_IP", gzServerIPField);
props.SetStringProperty(L"Ja2_mp Settings",L"SERVER_PORT", gzServerPortField);
props.SetStringProperty(L"Ja2_mp Settings",L"CLIENT_NAME", gzPlayerHandleField);
props.setStringProperty(L"Ja2_mp Settings",L"SERVER_IP", gzServerIPField);
props.setStringProperty(L"Ja2_mp Settings",L"SERVER_PORT", gzServerPortField);
props.setStringProperty(L"Ja2_mp Settings",L"CLIENT_NAME", gzPlayerHandleField);
s_ServerId.GetServerId(vfs::Path(gzFileTransferDirectory), &props);
s_ServerId.getServerId(vfs::Path(gzFileTransferDirectory), &props);
props.WriteToIniFile(L"ja2_mp.ini",true);
props.writeToIniFile(L"ja2_mp.ini",true);
#endif
}
@@ -339,9 +345,9 @@ bool ValidateJoinSettings(bool bSkipServerAddress, bool bSkipSyncDir)
CreateDirectoryA(syncDir, NULL);
}
#else
if(os::CreateRealDirecory(vfs::Path(L"Multiplayer")))
if(os::createRealDirectory(vfs::Path(L"Multiplayer")))
{
os::CreateRealDirecory(vfs::Path(L"Multiplayer/Servers"));
os::createRealDirectory(vfs::Path(L"Multiplayer/Servers"));
}
#endif
}