Multiplayer: Transfered files are now saved in the correct location on the client side (I just replace the server executable directory from the file with the client executable directory)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2642 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2009-03-30 07:07:04 +00:00
parent b3efb29dd7
commit 5a232eb15f
2 changed files with 66 additions and 12 deletions
+14 -6
View File
@@ -29,19 +29,17 @@
#include "types.h"
#include "gamesettings.h"
//char *fileToSend;
// WANNE: FILE TRANSFER
unsigned int setID;
//char *fileToSendCopy;
// Sender progress notification
class TestFileListProgress : public FileListProgress
class ServerFileListProgress : public FileListProgress
{
virtual void OnFilePush(const char *fileName, unsigned int fileLengthBytes, unsigned int offset, unsigned int bytesBeingSent, bool done, SystemAddress targetSystem)
{
printf("Sending %s bytes=%i offset=%i\n", fileName, bytesBeingSent, offset);
}
} testFileListProgress;
} serverFileListProgress;
@@ -519,6 +517,15 @@ void rSortArray(int* arr, int len)
}
}
void requestEXECUTABLE_DIR(RPCParameters *rpcParameters)
{
SystemAddress sender = rpcParameters->sender;//get senders address
STRING512 executableDir;
GetExecutableDirectory(executableDir);
server->RPC("recieveEXECUTABLE_DIR",(const char*)&executableDir, (int)sizeof(STRING512), HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0);
}
//************************* //UNASSIGNED_SYSTEM_ADDRESS
//START INTERNAL SERVER
@@ -843,6 +850,7 @@ void start_server (void)
REGISTER_STATIC_RPC(server, sendGUI);
REGISTER_STATIC_RPC(server, sendBULLET);
REGISTER_STATIC_RPC(server, requestSETTINGS);
REGISTER_STATIC_RPC(server, requestEXECUTABLE_DIR);
REGISTER_STATIC_RPC(server, sendSTATE);
REGISTER_STATIC_RPC(server, sendDEATH);
REGISTER_STATIC_RPC(server, sendhitSTRUCT);
@@ -876,7 +884,7 @@ void start_server (void)
// WANNE: FILE TRANSFER
server->AttachPlugin(&fltServer);
server->SetSplitMessageProgressInterval(1);
fltServer.SetCallback(&testFileListProgress);
fltServer.SetCallback(&serverFileListProgress);
STRING512 executableDir;
STRING512 fileToSend;