- added code for new network protocol (disabled by default as i need to test this on arm)
This commit is contained in:
parent
f128d40def
commit
61c86c15d1
|
@ -72,6 +72,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
//#include "network_message.h"
|
||||||
|
//#include "network_protocol.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -3076,6 +3079,55 @@ int glestMain(int argc, char** argv) {
|
||||||
printf("%s %s",extractFileFromDirectoryPath(argv[0]).c_str(),getNetworkPlatformFreeVersionString().c_str());
|
printf("%s %s",extractFileFromDirectoryPath(argv[0]).c_str(),getNetworkPlatformFreeVersionString().c_str());
|
||||||
printf("\nCompiled using: %s on: %s platform: %s endianness: %s",getCompilerNameString().c_str(),getCompileDateTime().c_str(),getPlatformNameString().c_str(),(Shared::PlatformByteOrder::isBigEndian() == true ? "big" : "little"));
|
printf("\nCompiled using: %s on: %s platform: %s endianness: %s",getCompilerNameString().c_str(),getCompileDateTime().c_str(),getPlatformNameString().c_str(),(Shared::PlatformByteOrder::isBigEndian() == true ? "big" : "little"));
|
||||||
|
|
||||||
|
|
||||||
|
// SwitchSetupRequest data("factionname", 3,-1,2,"softcoder",10, 11,"eng");
|
||||||
|
//
|
||||||
|
// unsigned char *buf = data.packMessage();
|
||||||
|
// printf("\nSend packet size = %u\n%s\nTeam = %d faction [%s] currentFactionIndex = %d toFactionIndex = %d [%s] [%s] %d %d\n",data.getPackedSize(),buf,data.getToTeam(),data.getSelectedFactionName().c_str(),data.getCurrentFactionIndex(),data.getToFactionIndex(),data.getNetworkPlayerLanguage().c_str(),data.getNetworkPlayerName().c_str(),data.getNetworkPlayerStatus(),data.getSwitchFlags());
|
||||||
|
// //delete [] buf;
|
||||||
|
//
|
||||||
|
// data.unpackMessage(buf);
|
||||||
|
// printf("\nGot packet size = %u\n%s\nTeam = %d faction [%s] currentFactionIndex = %d toFactionIndex = %d [%s] [%s] %d %d\n",data.getPackedSize(),buf,data.getToTeam(),data.getSelectedFactionName().c_str(),data.getCurrentFactionIndex(),data.getToFactionIndex(),data.getNetworkPlayerLanguage().c_str(),data.getNetworkPlayerName().c_str(),data.getNetworkPlayerStatus(),data.getSwitchFlags());
|
||||||
|
// delete [] buf;
|
||||||
|
|
||||||
|
// int8 a = 1;
|
||||||
|
// uint8 b = 2;
|
||||||
|
// int16 c = 3;
|
||||||
|
// uint16 d = 4;
|
||||||
|
// int32 e = 5;
|
||||||
|
// uint32 f = 6;
|
||||||
|
//
|
||||||
|
// printf("\nPack test #1: [%d][%u][%d][%u][%d][%u]\n,",a,b,c,d,e,f);
|
||||||
|
//
|
||||||
|
// unsigned char *buf = new unsigned char[100];
|
||||||
|
// unsigned int packedsize = pack(buf, "cChHlL",
|
||||||
|
// a,
|
||||||
|
// b,
|
||||||
|
// c,
|
||||||
|
// d,
|
||||||
|
// e,
|
||||||
|
// f);
|
||||||
|
//
|
||||||
|
// printf("Pack test #2: [%u][%s]\n,",packedsize,buf);
|
||||||
|
//
|
||||||
|
// int8 a1 = 0;
|
||||||
|
// uint8 b1 = 0;
|
||||||
|
// int16 c1 = 0;
|
||||||
|
// uint16 d1 = 0;
|
||||||
|
// int32 e1 = 0;
|
||||||
|
// uint32 f1 = 0;
|
||||||
|
//
|
||||||
|
// unpack(buf, "cChHlL",
|
||||||
|
// &a1,
|
||||||
|
// &b1,
|
||||||
|
// &c1,
|
||||||
|
// &d1,
|
||||||
|
// &e1,
|
||||||
|
// &f1);
|
||||||
|
//
|
||||||
|
// printf("UnPack test #3: [%d][%u][%d][%u][%d][%u]\n,",a1,b1,c1,d1,e1,f1);
|
||||||
|
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED == true) {
|
||||||
int8 testVar = 111;
|
int8 testVar = 111;
|
||||||
printf("\nEndian value = %d",testVar);
|
printf("\nEndian value = %d",testVar);
|
||||||
testVar = Shared::PlatformByteOrder::toCommonEndian(testVar);
|
testVar = Shared::PlatformByteOrder::toCommonEndian(testVar);
|
||||||
|
@ -3085,6 +3137,7 @@ int glestMain(int argc, char** argv) {
|
||||||
|
|
||||||
printf("\nint8 sizeof = %zu",sizeof(int8));
|
printf("\nint8 sizeof = %zu",sizeof(int8));
|
||||||
printf("\nSwitchSetupRequest sizeof = %zu",SwitchSetupRequest().getDataSize());
|
printf("\nSwitchSetupRequest sizeof = %zu",SwitchSetupRequest().getDataSize());
|
||||||
|
}
|
||||||
|
|
||||||
printf("\nSVN: [%s]",getSVNRevisionString().c_str());
|
printf("\nSVN: [%s]",getSVNRevisionString().c_str());
|
||||||
|
|
||||||
|
@ -3248,6 +3301,11 @@ int glestMain(int argc, char** argv) {
|
||||||
config.setBool("DebugNetworkPackets",true,true);
|
config.setBool("DebugNetworkPackets",true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_ENABLE_NEW_PROTOCOL]) == true) {
|
||||||
|
printf("*NOTE: enabling new newtork protocol.\n");
|
||||||
|
NetworkMessage::useOldProtocol = false;
|
||||||
|
}
|
||||||
|
|
||||||
Socket::setBroadCastPort(config.getInt("BroadcastPort",intToStr(Socket::getBroadCastPort()).c_str()));
|
Socket::setBroadCastPort(config.getInt("BroadcastPort",intToStr(Socket::getBroadCastPort()).c_str()));
|
||||||
|
|
||||||
Socket::disableNagle = config.getBool("DisableNagle","false");
|
Socket::disableNagle = config.getBool("DisableNagle","false");
|
||||||
|
|
|
@ -46,7 +46,7 @@ const int ClientInterface::waitSleepTime= 10;
|
||||||
const int ClientInterface::maxNetworkCommandListSendTimeWait = 4;
|
const int ClientInterface::maxNetworkCommandListSendTimeWait = 4;
|
||||||
|
|
||||||
ClientInterface::ClientInterface() : GameNetworkInterface() {
|
ClientInterface::ClientInterface() : GameNetworkInterface() {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] constructor for %p\n",__FILE__,__FUNCTION__,__LINE__,this);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] constructor for %p\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,this);
|
||||||
|
|
||||||
networkCommandListThreadAccessor = new Mutex();
|
networkCommandListThreadAccessor = new Mutex();
|
||||||
networkCommandListThread = NULL;
|
networkCommandListThread = NULL;
|
||||||
|
@ -88,12 +88,12 @@ void ClientInterface::shutdownNetworkCommandListThread() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientInterface::~ClientInterface() {
|
ClientInterface::~ClientInterface() {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] destructor for %p\n",__FILE__,__FUNCTION__,__LINE__,this);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] destructor for %p\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,this);
|
||||||
|
|
||||||
shutdownNetworkCommandListThread();
|
shutdownNetworkCommandListThread();
|
||||||
|
|
||||||
if(clientSocket != NULL && clientSocket->isConnected() == true) {
|
if(clientSocket != NULL && clientSocket->isConnected() == true) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
||||||
|
@ -106,9 +106,9 @@ ClientInterface::~ClientInterface() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
close();
|
close();
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
delete clientSocket;
|
delete clientSocket;
|
||||||
clientSocket = NULL;
|
clientSocket = NULL;
|
||||||
|
@ -116,11 +116,11 @@ ClientInterface::~ClientInterface() {
|
||||||
delete networkCommandListThreadAccessor;
|
delete networkCommandListThreadAccessor;
|
||||||
networkCommandListThreadAccessor = NULL;
|
networkCommandListThreadAccessor = NULL;
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::connect(const Ip &ip, int port) {
|
void ClientInterface::connect(const Ip &ip, int port) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
this->ip = ip;
|
this->ip = ip;
|
||||||
this->port = port;
|
this->port = port;
|
||||||
|
@ -132,7 +132,7 @@ void ClientInterface::connect(const Ip &ip, int port) {
|
||||||
connectedTime = time(NULL);
|
connectedTime = time(NULL);
|
||||||
clientSocket->setBlock(true);
|
clientSocket->setBlock(true);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END - socket = %d\n",__FILE__,__FUNCTION__,clientSocket->getSocketId());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END - socket = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,clientSocket->getSocketId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::reset() {
|
void ClientInterface::reset() {
|
||||||
|
@ -168,30 +168,30 @@ void ClientInterface::update() {
|
||||||
|
|
||||||
double lastSendElapsed = difftime((long int)time(NULL),lastNetworkCommandListSendTime);
|
double lastSendElapsed = difftime((long int)time(NULL),lastNetworkCommandListSendTime);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
if(networkMessageCommandList.getCommandCount() > 0 ||
|
if(networkMessageCommandList.getCommandCount() > 0 ||
|
||||||
(lastNetworkCommandListSendTime > 0 && lastSendElapsed >= ClientInterface::maxNetworkCommandListSendTimeWait)) {
|
(lastNetworkCommandListSendTime > 0 && lastSendElapsed >= ClientInterface::maxNetworkCommandListSendTimeWait)) {
|
||||||
lastNetworkCommandListSendTime = time(NULL);
|
lastNetworkCommandListSendTime = time(NULL);
|
||||||
sendMessage(&networkMessageCommandList);
|
sendMessage(&networkMessageCommandList);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possible cause of out of synch since we have more commands that need
|
// Possible cause of out of synch since we have more commands that need
|
||||||
// to be sent in this frame
|
// to be sent in this frame
|
||||||
if(requestedCommands.empty() == false) {
|
if(requestedCommands.empty() == false) {
|
||||||
//char szBuf[4096]="";
|
//char szBuf[4096]="";
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING / ERROR, requestedCommands.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,requestedCommands.size());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING / ERROR, requestedCommands.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,requestedCommands.size());
|
||||||
|
|
||||||
string sMsg = "may go out of synch: client requestedCommands.size() = " + intToStr(requestedCommands.size());
|
string sMsg = "may go out of synch: client requestedCommands.size() = " + intToStr(requestedCommands.size());
|
||||||
sendTextMessage(sMsg,-1, true,"");
|
sendTextMessage(sMsg,-1, true,"");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ClientInterface::getServerIpAddress() {
|
std::string ClientInterface::getServerIpAddress() {
|
||||||
|
@ -216,16 +216,16 @@ void ClientInterface::updateLobby() {
|
||||||
serverName= networkMessageIntro.getName();
|
serverName= networkMessageIntro.getName();
|
||||||
serverFTPPort = networkMessageIntro.getFtpPort();
|
serverFTPPort = networkMessageIntro.getFtpPort();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort);
|
||||||
|
|
||||||
//check consistency
|
//check consistency
|
||||||
bool compatible = checkVersionComptability(networkMessageIntro.getVersionString(), getNetworkVersionSVNString());
|
bool compatible = checkVersionComptability(networkMessageIntro.getVersionString(), getNetworkVersionSVNString());
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort);
|
||||||
|
|
||||||
if(compatible == false) {
|
if(compatible == false) {
|
||||||
//if(networkMessageIntro.getVersionString() != getNetworkVersionString()) {
|
//if(networkMessageIntro.getVersionString() != getNetworkVersionString()) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
bool versionMatched = false;
|
bool versionMatched = false;
|
||||||
string platformFreeVersion = getNetworkPlatformFreeVersionString();
|
string platformFreeVersion = getNetworkPlatformFreeVersionString();
|
||||||
|
@ -262,10 +262,10 @@ void ClientInterface::updateLobby() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(networkMessageIntro.getGameState() == nmgstOk) {
|
if(networkMessageIntro.getGameState() == nmgstOk) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
//send intro message
|
//send intro message
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
|
@ -279,21 +279,21 @@ void ClientInterface::updateLobby() {
|
||||||
lang.getLanguage());
|
lang.getLanguage());
|
||||||
sendMessage(&sendNetworkMessageIntro);
|
sendMessage(&sendNetworkMessageIntro);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(clientSocket == NULL || clientSocket->isConnected() == false) {
|
if(clientSocket == NULL || clientSocket->isConnected() == false) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
string sErr = "Disconnected from server during intro handshake.";
|
string sErr = "Disconnected from server during intro handshake.";
|
||||||
DisplayErrorMessage(sErr);
|
DisplayErrorMessage(sErr);
|
||||||
quit= true;
|
quit= true;
|
||||||
close();
|
close();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
assert(playerIndex>=0 && playerIndex<GameConstants::maxPlayers);
|
assert(playerIndex>=0 && playerIndex<GameConstants::maxPlayers);
|
||||||
introDone= true;
|
introDone= true;
|
||||||
|
@ -304,7 +304,7 @@ void ClientInterface::updateLobby() {
|
||||||
DisplayErrorMessage(sErr);
|
DisplayErrorMessage(sErr);
|
||||||
quit= true;
|
quit= true;
|
||||||
close();
|
close();
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -312,7 +312,7 @@ void ClientInterface::updateLobby() {
|
||||||
DisplayErrorMessage(sErr);
|
DisplayErrorMessage(sErr);
|
||||||
quit= true;
|
quit= true;
|
||||||
close();
|
close();
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,11 +321,11 @@ void ClientInterface::updateLobby() {
|
||||||
|
|
||||||
case nmtPing:
|
case nmtPing:
|
||||||
{
|
{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtPing\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtPing\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
NetworkMessagePing networkMessagePing;
|
NetworkMessagePing networkMessagePing;
|
||||||
if(receiveMessage(&networkMessagePing)) {
|
if(receiveMessage(&networkMessagePing)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
lastPingInfo = networkMessagePing;
|
lastPingInfo = networkMessagePing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ void ClientInterface::updateLobby() {
|
||||||
NetworkMessageSynchNetworkGameData networkMessageSynchNetworkGameData;
|
NetworkMessageSynchNetworkGameData networkMessageSynchNetworkGameData;
|
||||||
|
|
||||||
if(receiveMessage(&networkMessageSynchNetworkGameData)) {
|
if(receiveMessage(&networkMessageSynchNetworkGameData)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageSynchNetworkGameData, getTechCRCFileCount() = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageSynchNetworkGameData.getTechCRCFileCount());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageSynchNetworkGameData, getTechCRCFileCount() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageSynchNetworkGameData.getTechCRCFileCount());
|
||||||
|
|
||||||
networkGameDataSynchCheckOkMap = false;
|
networkGameDataSynchCheckOkMap = false;
|
||||||
networkGameDataSynchCheckOkTile = false;
|
networkGameDataSynchCheckOkTile = false;
|
||||||
|
@ -359,7 +359,7 @@ void ClientInterface::updateLobby() {
|
||||||
scenarioDir = scenarioDir.erase(scenarioDir.size() - gameSettings.getScenario().size(), gameSettings.getScenario().size() + 1);
|
scenarioDir = scenarioDir.erase(scenarioDir.size() - gameSettings.getScenario().size(), gameSettings.getScenario().size() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] gameSettings.getScenarioDir() = [%s] gameSettings.getScenario() = [%s] scenarioDir = [%s]\n",__FILE__,__FUNCTION__,__LINE__,gameSettings.getScenarioDir().c_str(),gameSettings.getScenario().c_str(),scenarioDir.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] gameSettings.getScenarioDir() = [%s] gameSettings.getScenario() = [%s] scenarioDir = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,gameSettings.getScenarioDir().c_str(),gameSettings.getScenario().c_str(),scenarioDir.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the checksum's
|
// check the checksum's
|
||||||
|
@ -368,7 +368,7 @@ void ClientInterface::updateLobby() {
|
||||||
this->setNetworkGameDataSynchCheckOkTile((tilesetCRC == networkMessageSynchNetworkGameData.getTilesetCRC()));
|
this->setNetworkGameDataSynchCheckOkTile((tilesetCRC == networkMessageSynchNetworkGameData.getTilesetCRC()));
|
||||||
//if(this->getNetworkGameDataSynchCheckOkTile() == false)
|
//if(this->getNetworkGameDataSynchCheckOkTile() == false)
|
||||||
//{
|
//{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] tilesetCRC info, local = %d, remote = %d, networkMessageSynchNetworkGameData.getTileset() = [%s]\n",__FILE__,__FUNCTION__,__LINE__,tilesetCRC,networkMessageSynchNetworkGameData.getTilesetCRC(),networkMessageSynchNetworkGameData.getTileset().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] tilesetCRC info, local = %d, remote = %d, networkMessageSynchNetworkGameData.getTileset() = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,tilesetCRC,networkMessageSynchNetworkGameData.getTilesetCRC(),networkMessageSynchNetworkGameData.getTileset().c_str());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//tech, load before map because of resources
|
//tech, load before map because of resources
|
||||||
|
@ -377,12 +377,12 @@ void ClientInterface::updateLobby() {
|
||||||
this->setNetworkGameDataSynchCheckOkTech((techCRC == networkMessageSynchNetworkGameData.getTechCRC()));
|
this->setNetworkGameDataSynchCheckOkTech((techCRC == networkMessageSynchNetworkGameData.getTechCRC()));
|
||||||
|
|
||||||
if(this->getNetworkGameDataSynchCheckOkTech() == false) {
|
if(this->getNetworkGameDataSynchCheckOkTech() == false) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
string pathSearchString = "/" + networkMessageSynchNetworkGameData.getTech() + "/*";
|
string pathSearchString = "/" + networkMessageSynchNetworkGameData.getTech() + "/*";
|
||||||
vctFileList = getFolderTreeContentsCheckSumListRecursively(config.getPathListForType(ptTechs,scenarioDir),pathSearchString, ".xml", NULL);
|
vctFileList = getFolderTreeContentsCheckSumListRecursively(config.getPathListForType(ptTechs,scenarioDir),pathSearchString, ".xml", NULL);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
string report = networkMessageSynchNetworkGameData.getTechCRCFileMismatchReport(vctFileList);
|
string report = networkMessageSynchNetworkGameData.getTechCRCFileMismatchReport(vctFileList);
|
||||||
this->setNetworkGameDataSynchCheckTechMismatchReport(report);
|
this->setNetworkGameDataSynchCheckTechMismatchReport(report);
|
||||||
|
@ -390,7 +390,7 @@ void ClientInterface::updateLobby() {
|
||||||
}
|
}
|
||||||
//if(this->getNetworkGameDataSynchCheckOkTech() == false)
|
//if(this->getNetworkGameDataSynchCheckOkTech() == false)
|
||||||
//{
|
//{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] techCRC info, local = %d, remote = %d, networkMessageSynchNetworkGameData.getTech() = [%s]\n",__FILE__,__FUNCTION__,techCRC,networkMessageSynchNetworkGameData.getTechCRC(),networkMessageSynchNetworkGameData.getTech().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] techCRC info, local = %d, remote = %d, networkMessageSynchNetworkGameData.getTech() = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,techCRC,networkMessageSynchNetworkGameData.getTechCRC(),networkMessageSynchNetworkGameData.getTech().c_str());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//map
|
//map
|
||||||
|
@ -405,13 +405,13 @@ void ClientInterface::updateLobby() {
|
||||||
|
|
||||||
//if(this->getNetworkGameDataSynchCheckOkMap() == false)
|
//if(this->getNetworkGameDataSynchCheckOkMap() == false)
|
||||||
//{
|
//{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] mapCRC info, local = %d, remote = %d, file = [%s]\n",__FILE__,__FUNCTION__,__LINE__,mapCRC,networkMessageSynchNetworkGameData.getMapCRC(),file.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] mapCRC info, local = %d, remote = %d, file = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,mapCRC,networkMessageSynchNetworkGameData.getMapCRC(),file.c_str());
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
catch(const runtime_error &ex) {
|
catch(const runtime_error &ex) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||||
string sErr = ex.what();
|
string sErr = ex.what();
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error during processing, sErr = [%s]\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error during processing, sErr = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,sErr.c_str());
|
||||||
|
|
||||||
DisplayErrorMessage(sErr);
|
DisplayErrorMessage(sErr);
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ void ClientInterface::updateLobby() {
|
||||||
if(fileCRC != networkMessageSynchNetworkGameDataFileCRCCheck.getFileCRC())
|
if(fileCRC != networkMessageSynchNetworkGameDataFileCRCCheck.getFileCRC())
|
||||||
{
|
{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtSynchNetworkGameDataFileCRCCheck localCRC = %d, remoteCRC = %d, file [%s]\n",
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtSynchNetworkGameDataFileCRCCheck localCRC = %d, remoteCRC = %d, file [%s]\n",
|
||||||
__FILE__,__FUNCTION__,fileCRC,
|
extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,fileCRC,
|
||||||
networkMessageSynchNetworkGameDataFileCRCCheck.getFileCRC(),
|
networkMessageSynchNetworkGameDataFileCRCCheck.getFileCRC(),
|
||||||
networkMessageSynchNetworkGameDataFileCRCCheck.getFileName().c_str());
|
networkMessageSynchNetworkGameDataFileCRCCheck.getFileName().c_str());
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ void ClientInterface::updateLobby() {
|
||||||
NetworkMessageText networkMessageText;
|
NetworkMessageText networkMessageText;
|
||||||
if(receiveMessage(&networkMessageText))
|
if(receiveMessage(&networkMessageText))
|
||||||
{
|
{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtText\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtText\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex(),networkMessageText.getTargetLanguage());
|
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex(),networkMessageText.getTargetLanguage());
|
||||||
this->addChatInfo(msg);
|
this->addChatInfo(msg);
|
||||||
|
@ -484,7 +484,7 @@ void ClientInterface::updateLobby() {
|
||||||
{
|
{
|
||||||
NetworkMessageMarkCell networkMessageMarkCell;
|
NetworkMessageMarkCell networkMessageMarkCell;
|
||||||
if(receiveMessage(&networkMessageMarkCell)) {
|
if(receiveMessage(&networkMessageMarkCell)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtMarkCell\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtMarkCell\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
MarkedCell msg(networkMessageMarkCell.getTarget(),
|
MarkedCell msg(networkMessageMarkCell.getTarget(),
|
||||||
networkMessageMarkCell.getFactionIndex(),
|
networkMessageMarkCell.getFactionIndex(),
|
||||||
|
@ -498,7 +498,7 @@ void ClientInterface::updateLobby() {
|
||||||
{
|
{
|
||||||
NetworkMessageUnMarkCell networkMessageMarkCell;
|
NetworkMessageUnMarkCell networkMessageMarkCell;
|
||||||
if(receiveMessage(&networkMessageMarkCell)) {
|
if(receiveMessage(&networkMessageMarkCell)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtMarkCell\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtMarkCell\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
UnMarkedCell msg(networkMessageMarkCell.getTarget(),
|
UnMarkedCell msg(networkMessageMarkCell.getTarget(),
|
||||||
networkMessageMarkCell.getFactionIndex());
|
networkMessageMarkCell.getFactionIndex());
|
||||||
|
@ -510,7 +510,7 @@ void ClientInterface::updateLobby() {
|
||||||
{
|
{
|
||||||
NetworkMessageHighlightCell networkMessageHighlightCell;
|
NetworkMessageHighlightCell networkMessageHighlightCell;
|
||||||
if(receiveMessage(&networkMessageHighlightCell)) {
|
if(receiveMessage(&networkMessageHighlightCell)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtHighlightCell\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtHighlightCell\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
MarkedCell msg(networkMessageHighlightCell.getTarget(),
|
MarkedCell msg(networkMessageHighlightCell.getTarget(),
|
||||||
networkMessageHighlightCell.getFactionIndex(),
|
networkMessageHighlightCell.getFactionIndex(),
|
||||||
|
@ -526,22 +526,22 @@ void ClientInterface::updateLobby() {
|
||||||
NetworkMessageLaunch networkMessageLaunch;
|
NetworkMessageLaunch networkMessageLaunch;
|
||||||
if(receiveMessage(&networkMessageLaunch)) {
|
if(receiveMessage(&networkMessageLaunch)) {
|
||||||
if(networkMessageLaunch.getMessageType() == nmtLaunch) {
|
if(networkMessageLaunch.getMessageType() == nmtLaunch) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtLaunch\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtLaunch\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
else if(networkMessageLaunch.getMessageType() == nmtBroadCastSetup) {
|
else if(networkMessageLaunch.getMessageType() == nmtBroadCastSetup) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtBroadCastSetup\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtBroadCastSetup\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
||||||
|
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
snprintf(szBuf,1023,"In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
networkMessageLaunch.buildGameSettings(&gameSettings);
|
networkMessageLaunch.buildGameSettings(&gameSettings);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
||||||
//replace server player by network
|
//replace server player by network
|
||||||
for(int i= 0; i<gameSettings.getFactionCount(); ++i) {
|
for(int i= 0; i<gameSettings.getFactionCount(); ++i) {
|
||||||
//replace by network
|
//replace by network
|
||||||
|
@ -552,7 +552,7 @@ void ClientInterface::updateLobby() {
|
||||||
//set the faction index
|
//set the faction index
|
||||||
if(gameSettings.getStartLocationIndex(i) == playerIndex) {
|
if(gameSettings.getStartLocationIndex(i) == playerIndex) {
|
||||||
gameSettings.setThisFactionIndex(i);
|
gameSettings.setThisFactionIndex(i);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] gameSettings.getThisFactionIndex(i) = %d, playerIndex = %d, i = %d\n",__FILE__,__FUNCTION__,__LINE__,gameSettings.getThisFactionIndex(),playerIndex,i);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] gameSettings.getThisFactionIndex(i) = %d, playerIndex = %d, i = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,gameSettings.getThisFactionIndex(),playerIndex,i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,14 +571,14 @@ void ClientInterface::updateLobby() {
|
||||||
if(receiveMessage(&playerIndexMessage)) {
|
if(receiveMessage(&playerIndexMessage)) {
|
||||||
playerIndex= playerIndexMessage.getPlayerIndex();
|
playerIndex= playerIndexMessage.getPlayerIndex();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got nmtPlayerIndexMessage, playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got nmtPlayerIndexMessage, playerIndex = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,playerIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
string sErr = string(__FILE__) + "::" + string(__FUNCTION__) + " Unexpected network message: " + intToStr(networkMessageType);
|
string sErr = string(extractFileFromDirectoryPath(__FILE__).c_str()) + "::" + string(__FUNCTION__) + " Unexpected network message: " + intToStr(networkMessageType);
|
||||||
//throw megaglest_runtime_error(string(__FILE__) + "::" + string(__FUNCTION__) + " Unexpected network message: " + intToStr(networkMessageType));
|
//throw megaglest_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + "::" + string(__FUNCTION__) + " Unexpected network message: " + intToStr(networkMessageType));
|
||||||
sendTextMessage("Unexpected network message: " + intToStr(networkMessageType),-1, true,"");
|
sendTextMessage("Unexpected network message: " + intToStr(networkMessageType),-1, true,"");
|
||||||
DisplayErrorMessage(sErr);
|
DisplayErrorMessage(sErr);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
@ -590,7 +590,7 @@ void ClientInterface::updateLobby() {
|
||||||
|
|
||||||
if( clientSocket != NULL && clientSocket->isConnected() == true &&
|
if( clientSocket != NULL && clientSocket->isConnected() == true &&
|
||||||
gotIntro == false && difftime((long int)time(NULL),connectedTime) > GameConstants::maxClientConnectHandshakeSecs) {
|
gotIntro == false && difftime((long int)time(NULL),connectedTime) > GameConstants::maxClientConnectHandshakeSecs) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] difftime(time(NULL),connectedTime) = %f\n",__FILE__,__FUNCTION__,__LINE__,difftime((long int)time(NULL),connectedTime));
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] difftime(time(NULL),connectedTime) = %f\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,difftime((long int)time(NULL),connectedTime));
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
// waitCount++;
|
// waitCount++;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] receiveMessage took %lld msecs, waitCount = %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis(),waitCount);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] receiveMessage took %lld msecs, waitCount = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis(),waitCount);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
|
||||||
//check that we are in the right frame
|
//check that we are in the right frame
|
||||||
if(checkFrame != NULL) {
|
if(checkFrame != NULL) {
|
||||||
|
@ -665,7 +665,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
//pendingCommands.push_back(*networkMessageCommandList.getCommand(i));
|
//pendingCommands.push_back(*networkMessageCommandList.getCommand(i));
|
||||||
cachedPendingCommands[networkMessageCommandList.getFrameCount()].push_back(*networkMessageCommandList.getCommand(i));
|
cachedPendingCommands[networkMessageCommandList.getFrameCount()].push_back(*networkMessageCommandList.getCommand(i));
|
||||||
}
|
}
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] transfer network commands took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] transfer network commands took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
done= true;
|
done= true;
|
||||||
}
|
}
|
||||||
|
@ -673,15 +673,15 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
|
|
||||||
case nmtPing:
|
case nmtPing:
|
||||||
{
|
{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtPing\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtPing\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
NetworkMessagePing networkMessagePing;
|
NetworkMessagePing networkMessagePing;
|
||||||
if(receiveMessage(&networkMessagePing)) {
|
if(receiveMessage(&networkMessagePing)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
lastPingInfo = networkMessagePing;
|
lastPingInfo = networkMessagePing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -712,12 +712,12 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
throw megaglest_runtime_error("error retrieving nmtText returned false!");
|
throw megaglest_runtime_error("error retrieving nmtText returned false!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex(),networkMessageText.getTargetLanguage());
|
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex(),networkMessageText.getTargetLanguage());
|
||||||
this->addChatInfo(msg);
|
this->addChatInfo(msg);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -725,7 +725,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
{
|
{
|
||||||
NetworkMessageMarkCell networkMessageMarkCell;
|
NetworkMessageMarkCell networkMessageMarkCell;
|
||||||
if(receiveMessage(&networkMessageMarkCell)) {
|
if(receiveMessage(&networkMessageMarkCell)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtMarkCell\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtMarkCell\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
MarkedCell msg(networkMessageMarkCell.getTarget(),
|
MarkedCell msg(networkMessageMarkCell.getTarget(),
|
||||||
networkMessageMarkCell.getFactionIndex(),
|
networkMessageMarkCell.getFactionIndex(),
|
||||||
|
@ -740,7 +740,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
{
|
{
|
||||||
NetworkMessageUnMarkCell networkMessageMarkCell;
|
NetworkMessageUnMarkCell networkMessageMarkCell;
|
||||||
if(receiveMessage(&networkMessageMarkCell)) {
|
if(receiveMessage(&networkMessageMarkCell)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtMarkCell\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtMarkCell\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
UnMarkedCell msg(networkMessageMarkCell.getTarget(),
|
UnMarkedCell msg(networkMessageMarkCell.getTarget(),
|
||||||
networkMessageMarkCell.getFactionIndex());
|
networkMessageMarkCell.getFactionIndex());
|
||||||
|
@ -752,7 +752,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
{
|
{
|
||||||
NetworkMessageHighlightCell networkMessageHighlightCell;
|
NetworkMessageHighlightCell networkMessageHighlightCell;
|
||||||
if(receiveMessage(&networkMessageHighlightCell)) {
|
if(receiveMessage(&networkMessageHighlightCell)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtHighlightCell\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtHighlightCell\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
MarkedCell msg(networkMessageHighlightCell.getTarget(),
|
MarkedCell msg(networkMessageHighlightCell.getTarget(),
|
||||||
networkMessageHighlightCell.getFactionIndex(),
|
networkMessageHighlightCell.getFactionIndex(),
|
||||||
|
@ -769,22 +769,22 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
NetworkMessageLaunch networkMessageLaunch;
|
NetworkMessageLaunch networkMessageLaunch;
|
||||||
if(receiveMessage(&networkMessageLaunch)) {
|
if(receiveMessage(&networkMessageLaunch)) {
|
||||||
if(networkMessageLaunch.getMessageType() == nmtLaunch) {
|
if(networkMessageLaunch.getMessageType() == nmtLaunch) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtLaunch\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtLaunch\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
else if(networkMessageLaunch.getMessageType() == nmtBroadCastSetup) {
|
else if(networkMessageLaunch.getMessageType() == nmtBroadCastSetup) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtBroadCastSetup\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtBroadCastSetup\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
||||||
|
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
snprintf(szBuf,1023,"In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
snprintf(szBuf,1023,"In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
networkMessageLaunch.buildGameSettings(&gameSettings);
|
networkMessageLaunch.buildGameSettings(&gameSettings);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
|
||||||
//replace server player by network
|
//replace server player by network
|
||||||
for(int i= 0; i<gameSettings.getFactionCount(); ++i) {
|
for(int i= 0; i<gameSettings.getFactionCount(); ++i) {
|
||||||
//replace by network
|
//replace by network
|
||||||
|
@ -795,7 +795,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
//set the faction index
|
//set the faction index
|
||||||
if(gameSettings.getStartLocationIndex(i) == playerIndex) {
|
if(gameSettings.getStartLocationIndex(i) == playerIndex) {
|
||||||
gameSettings.setThisFactionIndex(i);
|
gameSettings.setThisFactionIndex(i);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] gameSettings.getThisFactionIndex(i) = %d, playerIndex = %d, i = %d\n",__FILE__,__FUNCTION__,__LINE__,gameSettings.getThisFactionIndex(),playerIndex,i);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] gameSettings.getThisFactionIndex(i) = %d, playerIndex = %d, i = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,gameSettings.getThisFactionIndex(),playerIndex,i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
sendTextMessage("Unexpected message in client interface: " + intToStr(networkMessageType),-1, true,"");
|
sendTextMessage("Unexpected message in client interface: " + intToStr(networkMessageType),-1, true,"");
|
||||||
DisplayErrorMessage(string(__FILE__) + "::" + string(__FUNCTION__) + " Unexpected message in client interface: " + intToStr(networkMessageType));
|
DisplayErrorMessage(string(extractFileFromDirectoryPath(__FILE__).c_str()) + "::" + string(__FUNCTION__) + " Unexpected message in client interface: " + intToStr(networkMessageType));
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
quit= true;
|
quit= true;
|
||||||
|
@ -853,7 +853,7 @@ void ClientInterface::simpleTask(BaseThread *callingThread) {
|
||||||
while(callingThread->getQuitStatus() == false && quit == false) {
|
while(callingThread->getQuitStatus() == false && quit == false) {
|
||||||
updateFrame(NULL);
|
updateFrame(NULL);
|
||||||
}
|
}
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientInterface::getNetworkCommand(int frameCount, int currentCachedPendingCommandsIndex) {
|
bool ClientInterface::getNetworkCommand(int frameCount, int currentCachedPendingCommandsIndex) {
|
||||||
|
@ -902,7 +902,7 @@ void ClientInterface::updateKeyframe(int frameCount) {
|
||||||
else {
|
else {
|
||||||
if(networkCommandListThread == NULL) {
|
if(networkCommandListThread == NULL) {
|
||||||
networkCommandListThread = new SimpleTaskThread(this,0,0);
|
networkCommandListThread = new SimpleTaskThread(this,0,0);
|
||||||
networkCommandListThread->setUniqueID(__FILE__);
|
networkCommandListThread->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str());
|
||||||
networkCommandListThread->start();
|
networkCommandListThread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,8 +910,8 @@ void ClientInterface::updateKeyframe(int frameCount) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
//printf("In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
//printf("In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientInterface::isMasterServerAdminOverride() {
|
bool ClientInterface::isMasterServerAdminOverride() {
|
||||||
|
@ -919,7 +919,7 @@ bool ClientInterface::isMasterServerAdminOverride() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::waitUntilReady(Checksum* checksum) {
|
void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
Logger &logger= Logger::getInstance();
|
Logger &logger= Logger::getInstance();
|
||||||
|
|
||||||
|
@ -934,7 +934,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
NetworkMessageReady networkMessageReady;
|
NetworkMessageReady networkMessageReady;
|
||||||
sendMessage(&networkMessageReady);
|
sendMessage(&networkMessageReady);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
NetworkMessageLoadingStatus networkMessageLoadingStatus(nmls_NONE);
|
NetworkMessageLoadingStatus networkMessageLoadingStatus(nmls_NONE);
|
||||||
|
|
||||||
|
@ -958,17 +958,17 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isConnected() == false) {
|
if(isConnected() == false) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
string sErr = "Error, Server has disconnected!";
|
string sErr = "Error, Server has disconnected!";
|
||||||
DisplayErrorMessage(sErr);
|
DisplayErrorMessage(sErr);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
quit= true;
|
quit= true;
|
||||||
close();
|
close();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NetworkMessageType networkMessageType = getNextMessageType();
|
NetworkMessageType networkMessageType = getNextMessageType();
|
||||||
|
@ -978,35 +978,35 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
if(discarded == false) {
|
if(discarded == false) {
|
||||||
if(networkMessageType == nmtReady) {
|
if(networkMessageType == nmtReady) {
|
||||||
if(receiveMessage(&networkMessageReady)) {
|
if(receiveMessage(&networkMessageReady)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(networkMessageType == nmtLoadingStatusMessage) {
|
else if(networkMessageType == nmtLoadingStatusMessage) {
|
||||||
if(receiveMessage(&networkMessageLoadingStatus)) {
|
if(receiveMessage(&networkMessageLoadingStatus)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(networkMessageType == nmtQuit) {
|
else if(networkMessageType == nmtQuit) {
|
||||||
NetworkMessageQuit networkMessageQuit;
|
NetworkMessageQuit networkMessageQuit;
|
||||||
if(receiveMessage(&networkMessageQuit)) {
|
if(receiveMessage(&networkMessageQuit)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
DisplayErrorMessage(lang.get("GameCancelledByUser"));
|
DisplayErrorMessage(lang.get("GameCancelledByUser"));
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
quit= true;
|
quit= true;
|
||||||
close();
|
close();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(networkMessageType == nmtInvalid) {
|
else if(networkMessageType == nmtInvalid) {
|
||||||
if(chrono.getMillis() > readyWaitTimeout) {
|
if(chrono.getMillis() > readyWaitTimeout) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
||||||
|
@ -1023,13 +1023,13 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
quit= true;
|
quit= true;
|
||||||
close();
|
close();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1128,20 +1128,20 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
sendTextMessage("Unexpected network message: " + intToStr(networkMessageType),-1, true,"");
|
sendTextMessage("Unexpected network message: " + intToStr(networkMessageType),-1, true,"");
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
DisplayErrorMessage(string(__FILE__) + "::" + string(__FUNCTION__) + " Unexpected network message: " + intToStr(networkMessageType));
|
DisplayErrorMessage(string(extractFileFromDirectoryPath(__FILE__).c_str()) + "::" + string(__FUNCTION__) + " Unexpected network message: " + intToStr(networkMessageType));
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
quit= true;
|
quit= true;
|
||||||
close();
|
close();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1151,11 +1151,11 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
//check checksum
|
//check checksum
|
||||||
if(networkMessageReady.getChecksum() != checksum->getSum()) {
|
if(networkMessageReady.getChecksum() != checksum->getSum()) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
||||||
|
@ -1186,12 +1186,12 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
}
|
}
|
||||||
sendTextMessage(sErr2,-1,echoLocal,languageList[i]);
|
sendTextMessage(sErr2,-1,echoLocal,languageList[i]);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d %s %s %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str(),sErr1.c_str(),sErr2.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d %s %s %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,sErr.c_str(),sErr1.c_str(),sErr2.c_str());
|
||||||
|
|
||||||
if(echoLocal == true) {
|
if(echoLocal == true) {
|
||||||
if(Config::getInstance().getBool("NetworkConsistencyChecks")) {
|
if(Config::getInstance().getBool("NetworkConsistencyChecks")) {
|
||||||
// error message and disconnect only if checked
|
// error message and disconnect only if checked
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
string niceError = sErr + string("\n") + sErr1 + string("\n") + sErr2;
|
string niceError = sErr + string("\n") + sErr1 + string("\n") + sErr2;
|
||||||
DisplayErrorMessage(niceError);
|
DisplayErrorMessage(niceError);
|
||||||
|
@ -1212,11 +1212,11 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
// string sErr2 = "Server Checksum: " + intToStr(networkMessageReady.getChecksum());
|
// string sErr2 = "Server Checksum: " + intToStr(networkMessageReady.getChecksum());
|
||||||
// sendTextMessage(sErr2,-1, true);
|
// sendTextMessage(sErr2,-1, true);
|
||||||
|
|
||||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d %s %s %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str(),sErr1.c_str(),sErr2.c_str());
|
// if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d %s %s %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,sErr.c_str(),sErr1.c_str(),sErr2.c_str());
|
||||||
|
|
||||||
if(Config::getInstance().getBool("NetworkConsistencyChecks")) {
|
if(Config::getInstance().getBool("NetworkConsistencyChecks")) {
|
||||||
// error message and disconnect only if checked
|
// error message and disconnect only if checked
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
//string niceError = sErr + string("\n") + sErr1 + string("\n") + sErr2;
|
//string niceError = sErr + string("\n") + sErr1 + string("\n") + sErr2;
|
||||||
//DisplayErrorMessage(niceError);
|
//DisplayErrorMessage(niceError);
|
||||||
|
@ -1224,7 +1224,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
quit= true;
|
quit= true;
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
@ -1239,14 +1239,14 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||||
// This triggers LAG update packets to begin as required
|
// This triggers LAG update packets to begin as required
|
||||||
lastNetworkCommandListSendTime = time(NULL);
|
lastNetworkCommandListSendTime = time(NULL);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::sendTextMessage(const string &text, int teamIndex, bool echoLocal,
|
void ClientInterface::sendTextMessage(const string &text, int teamIndex, bool echoLocal,
|
||||||
string targetLanguage) {
|
string targetLanguage) {
|
||||||
|
|
||||||
string humanPlayerName = getHumanPlayerName();
|
string humanPlayerName = getHumanPlayerName();
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] humanPlayerName = [%s] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,humanPlayerName.c_str(),playerIndex);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] humanPlayerName = [%s] playerIndex = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,humanPlayerName.c_str(),playerIndex);
|
||||||
|
|
||||||
NetworkMessageText networkMessageText(text, teamIndex,playerIndex,targetLanguage);
|
NetworkMessageText networkMessageText(text, teamIndex,playerIndex,targetLanguage);
|
||||||
sendMessage(&networkMessageText);
|
sendMessage(&networkMessageText);
|
||||||
|
@ -1259,14 +1259,14 @@ void ClientInterface::sendTextMessage(const string &text, int teamIndex, bool ec
|
||||||
|
|
||||||
void ClientInterface::sendMarkCellMessage(Vec2i targetPos, int factionIndex, string note,int playerIndex) {
|
void ClientInterface::sendMarkCellMessage(Vec2i targetPos, int factionIndex, string note,int playerIndex) {
|
||||||
string humanPlayerName = getHumanPlayerName();
|
string humanPlayerName = getHumanPlayerName();
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] humanPlayerName = [%s] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,humanPlayerName.c_str(),playerIndex);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] humanPlayerName = [%s] playerIndex = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,humanPlayerName.c_str(),playerIndex);
|
||||||
|
|
||||||
NetworkMessageMarkCell networkMessageMarkCell(targetPos,factionIndex, note,playerIndex);
|
NetworkMessageMarkCell networkMessageMarkCell(targetPos,factionIndex, note,playerIndex);
|
||||||
sendMessage(&networkMessageMarkCell);
|
sendMessage(&networkMessageMarkCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::sendHighlightCellMessage(Vec2i targetPos, int factionIndex) {
|
void ClientInterface::sendHighlightCellMessage(Vec2i targetPos, int factionIndex) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,playerIndex);
|
||||||
|
|
||||||
NetworkMessageHighlightCell networkMessageHighlightCell(targetPos,factionIndex);
|
NetworkMessageHighlightCell networkMessageHighlightCell(targetPos,factionIndex);
|
||||||
sendMessage(&networkMessageHighlightCell);
|
sendMessage(&networkMessageHighlightCell);
|
||||||
|
@ -1274,7 +1274,7 @@ void ClientInterface::sendHighlightCellMessage(Vec2i targetPos, int factionIndex
|
||||||
|
|
||||||
void ClientInterface::sendUnMarkCellMessage(Vec2i targetPos, int factionIndex) {
|
void ClientInterface::sendUnMarkCellMessage(Vec2i targetPos, int factionIndex) {
|
||||||
string humanPlayerName = getHumanPlayerName();
|
string humanPlayerName = getHumanPlayerName();
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] humanPlayerName = [%s] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,humanPlayerName.c_str(),playerIndex);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] humanPlayerName = [%s] playerIndex = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,humanPlayerName.c_str(),playerIndex);
|
||||||
|
|
||||||
NetworkMessageUnMarkCell networkMessageMarkCell(targetPos,factionIndex);
|
NetworkMessageUnMarkCell networkMessageMarkCell(targetPos,factionIndex);
|
||||||
sendMessage(&networkMessageMarkCell);
|
sendMessage(&networkMessageMarkCell);
|
||||||
|
@ -1328,7 +1328,7 @@ NetworkMessageType ClientInterface::waitForMessage()
|
||||||
//if(1) {
|
//if(1) {
|
||||||
//throw megaglest_runtime_error("Timeout waiting for message");
|
//throw megaglest_runtime_error("Timeout waiting for message");
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
||||||
|
@ -1358,19 +1358,19 @@ NetworkMessageType ClientInterface::waitForMessage()
|
||||||
//waitLoopCount++;
|
//waitLoopCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] waiting took %lld msecs, waitLoopCount = %ull, msg = %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis(),waitLoopCount,msg);
|
//if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] waiting took %lld msecs, waitLoopCount = %ull, msg = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis(),waitLoopCount,msg);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] waiting took %lld msecs, msg = %d\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis(),msg);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] waiting took %lld msecs, msg = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis(),msg);
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::quitGame(bool userManuallyQuit)
|
void ClientInterface::quitGame(bool userManuallyQuit)
|
||||||
{
|
{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] userManuallyQuit = %d\n",__FILE__,__FUNCTION__,__LINE__,userManuallyQuit);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] userManuallyQuit = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,userManuallyQuit);
|
||||||
|
|
||||||
if(clientSocket != NULL && userManuallyQuit == true)
|
if(clientSocket != NULL && userManuallyQuit == true)
|
||||||
{
|
{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
||||||
|
@ -1386,12 +1386,12 @@ void ClientInterface::quitGame(bool userManuallyQuit)
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::close()
|
void ClientInterface::close()
|
||||||
{
|
{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] START, clientSocket = %p\n",__FILE__,__FUNCTION__,__LINE__,clientSocket);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] START, clientSocket = %p\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,clientSocket);
|
||||||
|
|
||||||
delete clientSocket;
|
delete clientSocket;
|
||||||
clientSocket= NULL;
|
clientSocket= NULL;
|
||||||
|
@ -1399,34 +1399,34 @@ void ClientInterface::close()
|
||||||
connectedTime = 0;
|
connectedTime = 0;
|
||||||
gotIntro = false;
|
gotIntro = false;
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] END\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] END\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::discoverServers(DiscoveredServersInterface *cb) {
|
void ClientInterface::discoverServers(DiscoveredServersInterface *cb) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
ClientSocket::discoverServers(cb);
|
ClientSocket::discoverServers(cb);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
void ClientInterface::stopServerDiscovery() {
|
void ClientInterface::stopServerDiscovery() {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
ClientSocket::stopBroadCastClientThread();
|
ClientSocket::stopBroadCastClientThread();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::sendSwitchSetupRequest(string selectedFactionName, int8 currentFactionIndex,
|
void ClientInterface::sendSwitchSetupRequest(string selectedFactionName, int8 currentFactionIndex,
|
||||||
int8 toFactionIndex,int8 toTeam, string networkPlayerName,
|
int8 toFactionIndex,int8 toTeam, string networkPlayerName,
|
||||||
int8 networkPlayerStatus, int8 flags,
|
int8 networkPlayerStatus, int8 flags,
|
||||||
string language) {
|
string language) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] networkPlayerName [%s] flags = %d\n",__FILE__,__FUNCTION__,__LINE__,networkPlayerName.c_str(),flags);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] networkPlayerName [%s] flags = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkPlayerName.c_str(),flags);
|
||||||
SwitchSetupRequest message=SwitchSetupRequest(selectedFactionName,
|
SwitchSetupRequest message=SwitchSetupRequest(selectedFactionName,
|
||||||
currentFactionIndex, toFactionIndex,toTeam,networkPlayerName,
|
currentFactionIndex, toFactionIndex,toTeam,networkPlayerName,
|
||||||
networkPlayerStatus, flags,language);
|
networkPlayerStatus, flags,language);
|
||||||
sendMessage(&message);
|
sendMessage(&message);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientInterface::shouldDiscardNetworkMessage(NetworkMessageType networkMessageType) {
|
bool ClientInterface::shouldDiscardNetworkMessage(NetworkMessageType networkMessageType) {
|
||||||
|
@ -1457,7 +1457,7 @@ bool ClientInterface::shouldDiscardNetworkMessage(NetworkMessageType networkMess
|
||||||
break;
|
break;
|
||||||
case nmtText:
|
case nmtText:
|
||||||
{
|
{
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got nmtText\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got nmtText\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
discard = true;
|
discard = true;
|
||||||
NetworkMessageText netMsg = NetworkMessageText();
|
NetworkMessageText netMsg = NetworkMessageText();
|
||||||
this->receiveMessage(&netMsg);
|
this->receiveMessage(&netMsg);
|
||||||
|
@ -1580,31 +1580,31 @@ string ClientInterface::getHumanPlayerName(int index) {
|
||||||
|
|
||||||
|
|
||||||
void ClientInterface::setGameSettings(GameSettings *serverGameSettings) {
|
void ClientInterface::setGameSettings(GameSettings *serverGameSettings) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
//MutexSafeWrapper safeMutex(&serverSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
|
//MutexSafeWrapper safeMutex(&serverSynchAccessor,string(extractFileFromDirectoryPath(__FILE__).c_str()) + "_" + intToStr(__LINE__));
|
||||||
gameSettings = *serverGameSettings;
|
gameSettings = *serverGameSettings;
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::broadcastGameSetup(const GameSettings *gameSettings) {
|
void ClientInterface::broadcastGameSetup(const GameSettings *gameSettings) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
//MutexSafeWrapper safeMutex(&serverSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
|
//MutexSafeWrapper safeMutex(&serverSynchAccessor,string(extractFileFromDirectoryPath(__FILE__).c_str()) + "_" + intToStr(__LINE__));
|
||||||
NetworkMessageLaunch networkMessageLaunch(gameSettings, nmtBroadCastSetup);
|
NetworkMessageLaunch networkMessageLaunch(gameSettings, nmtBroadCastSetup);
|
||||||
//broadcastMessage(&networkMessageLaunch);
|
//broadcastMessage(&networkMessageLaunch);
|
||||||
sendMessage(&networkMessageLaunch);
|
sendMessage(&networkMessageLaunch);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::broadcastGameStart(const GameSettings *gameSettings) {
|
void ClientInterface::broadcastGameStart(const GameSettings *gameSettings) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
//MutexSafeWrapper safeMutex(&serverSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
|
//MutexSafeWrapper safeMutex(&serverSynchAccessor,string(extractFileFromDirectoryPath(__FILE__).c_str()) + "_" + intToStr(__LINE__));
|
||||||
NetworkMessageLaunch networkMessageLaunch(gameSettings, nmtLaunch);
|
NetworkMessageLaunch networkMessageLaunch(gameSettings, nmtLaunch);
|
||||||
//broadcastMessage(&networkMessageLaunch);
|
//broadcastMessage(&networkMessageLaunch);
|
||||||
sendMessage(&networkMessageLaunch);
|
sendMessage(&networkMessageLaunch);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
void ClientInterface::setGameSettingsReceived(bool value) {
|
void ClientInterface::setGameSettingsReceived(bool value) {
|
||||||
//printf("In [%s:%s] Line: %d gameSettingsReceived = %d value = %d, gameSettingsReceivedCount = %d\n",__FILE__,__FUNCTION__,__LINE__,gameSettingsReceived,value,gameSettingsReceivedCount);
|
//printf("In [%s:%s] Line: %d gameSettingsReceived = %d value = %d, gameSettingsReceivedCount = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,gameSettingsReceived,value,gameSettingsReceivedCount);
|
||||||
gameSettingsReceived = value;
|
gameSettingsReceived = value;
|
||||||
gameSettingsReceivedCount++;
|
gameSettingsReceivedCount++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "platform_util.h"
|
#include "platform_util.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "network_protocol.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace Shared::Platform;
|
using namespace Shared::Platform;
|
||||||
|
@ -56,14 +56,14 @@ NetworkMessageType NetworkInterface::getNextMessageType()
|
||||||
//peek message type
|
//peek message type
|
||||||
int dataSize = socket->getDataToRead();
|
int dataSize = socket->getDataToRead();
|
||||||
if(dataSize >= sizeof(messageType)) {
|
if(dataSize >= sizeof(messageType)) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,dataSize);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() dataSize = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,dataSize);
|
||||||
|
|
||||||
int iPeek = socket->peek(&messageType, sizeof(messageType));
|
int iPeek = socket->peek(&messageType, sizeof(messageType));
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() iPeek = %d, messageType = %d [size = %d]\n",__FILE__,__FUNCTION__,__LINE__,iPeek,messageType,sizeof(messageType));
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() iPeek = %d, messageType = %d [size = %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,iPeek,messageType,sizeof(messageType));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] PEEK WARNING, socket->getDataToRead() messageType = %d [size = %d], dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,messageType,sizeof(messageType),dataSize);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] PEEK WARNING, socket->getDataToRead() messageType = %d [size = %d], dataSize = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,messageType,sizeof(messageType),dataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
//sanity check new message type
|
//sanity check new message type
|
||||||
|
@ -72,7 +72,7 @@ NetworkMessageType NetworkInterface::getNextMessageType()
|
||||||
throw megaglest_runtime_error("Invalid message type: " + intToStr(messageType));
|
throw megaglest_runtime_error("Invalid message type: " + intToStr(messageType));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] Invalid message type = %d (no packet handshake yet so ignored)\n",__FILE__,__FUNCTION__,__LINE__,messageType);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] Invalid message type = %d (no packet handshake yet so ignored)\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,messageType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ NetworkMessageType NetworkInterface::getNextMessageType()
|
||||||
|
|
||||||
bool NetworkInterface::receiveMessage(NetworkMessage* networkMessage){
|
bool NetworkInterface::receiveMessage(NetworkMessage* networkMessage){
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s]\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__);
|
||||||
|
|
||||||
Socket* socket= getSocket(false);
|
Socket* socket= getSocket(false);
|
||||||
|
|
||||||
|
@ -95,10 +95,10 @@ bool NetworkInterface::isConnected(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) {
|
void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] sErr [%s]\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] sErr [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,sErr.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] sErr [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,sErr.c_str());
|
||||||
|
|
||||||
if(closeSocket == true && getSocket() != NULL)
|
if(closeSocket == true && getSocket() != NULL) {
|
||||||
{
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ std::vector<ChatMsgInfo> NetworkInterface::getChatTextList(bool clearList) {
|
||||||
|
|
||||||
void NetworkInterface::clearChatInfo() {
|
void NetworkInterface::clearChatInfo() {
|
||||||
if(chatTextList.empty() == false) {
|
if(chatTextList.empty() == false) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] chatTextList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,chatTextList.size());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] chatTextList.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chatTextList.size());
|
||||||
chatTextList.clear();
|
chatTextList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ std::vector<MarkedCell> NetworkInterface::getMarkedCellList(bool clearList) {
|
||||||
|
|
||||||
void NetworkInterface::clearMarkedCellList() {
|
void NetworkInterface::clearMarkedCellList() {
|
||||||
if(markedCellList.empty() == false) {
|
if(markedCellList.empty() == false) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] markedCellList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,markedCellList.size());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] markedCellList.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,markedCellList.size());
|
||||||
markedCellList.clear();
|
markedCellList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ std::vector<UnMarkedCell> NetworkInterface::getUnMarkedCellList(bool clearList)
|
||||||
|
|
||||||
void NetworkInterface::clearUnMarkedCellList() {
|
void NetworkInterface::clearUnMarkedCellList() {
|
||||||
if(unmarkedCellList.empty() == false) {
|
if(unmarkedCellList.empty() == false) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unmarkedCellList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,unmarkedCellList.size());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unmarkedCellList.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,unmarkedCellList.size());
|
||||||
unmarkedCellList.clear();
|
unmarkedCellList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ std::vector<MarkedCell> NetworkInterface::getHighlightedCellList(bool clearList)
|
||||||
|
|
||||||
void NetworkInterface::clearHighlightedCellList() {
|
void NetworkInterface::clearHighlightedCellList() {
|
||||||
if(highlightedCellList.empty() == false) {
|
if(highlightedCellList.empty() == false) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] markedCellList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,markedCellList.size());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] markedCellList.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,markedCellList.size());
|
||||||
highlightedCellList.clear();
|
highlightedCellList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -67,6 +67,7 @@ static const int maxLanguageStringSize= 60;
|
||||||
|
|
||||||
class NetworkMessage {
|
class NetworkMessage {
|
||||||
public:
|
public:
|
||||||
|
static bool useOldProtocol;
|
||||||
virtual ~NetworkMessage(){}
|
virtual ~NetworkMessage(){}
|
||||||
virtual bool receive(Socket* socket)= 0;
|
virtual bool receive(Socket* socket)= 0;
|
||||||
virtual void send(Socket* socket) = 0;
|
virtual void send(Socket* socket) = 0;
|
||||||
|
@ -78,6 +79,11 @@ protected:
|
||||||
void send(Socket* socket, const void* data, int dataSize);
|
void send(Socket* socket, const void* data, int dataSize);
|
||||||
|
|
||||||
void dump_packet(string label, const void* data, int dataSize);
|
void dump_packet(string label, const void* data, int dataSize);
|
||||||
|
|
||||||
|
virtual const char * getPackedMessageFormat() const = 0;
|
||||||
|
virtual unsigned int getPackedSize() = 0;
|
||||||
|
virtual void unpackMessage(unsigned char *buf) = 0;
|
||||||
|
virtual unsigned char * packMessage() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -111,6 +117,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageIntro();
|
NetworkMessageIntro();
|
||||||
NetworkMessageIntro(int32 sessionId, const string &versionString,
|
NetworkMessageIntro(int32 sessionId, const string &versionString,
|
||||||
|
@ -154,6 +166,12 @@ private:
|
||||||
Data data;
|
Data data;
|
||||||
int64 pingReceivedLocalTime;
|
int64 pingReceivedLocalTime;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessagePing();
|
NetworkMessagePing();
|
||||||
NetworkMessagePing(int32 pingFrequency, int64 pingTime);
|
NetworkMessagePing(int32 pingFrequency, int64 pingTime);
|
||||||
|
@ -188,6 +206,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageReady();
|
NetworkMessageReady();
|
||||||
NetworkMessageReady(uint32 checksum);
|
NetworkMessageReady(uint32 checksum);
|
||||||
|
@ -265,6 +289,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageLaunch();
|
NetworkMessageLaunch();
|
||||||
NetworkMessageLaunch(const GameSettings *gameSettings,int8 messageType);
|
NetworkMessageLaunch(const GameSettings *gameSettings,int8 messageType);
|
||||||
|
@ -292,6 +322,7 @@ public:
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
class NetworkMessageCommandList: public NetworkMessage {
|
class NetworkMessageCommandList: public NetworkMessage {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//static const int maxCommandCount = 2496; // can be as large as 65535
|
//static const int maxCommandCount = 2496; // can be as large as 65535
|
||||||
|
|
||||||
|
@ -317,6 +348,22 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const { return NULL; }
|
||||||
|
virtual unsigned int getPackedSize() { return 0; }
|
||||||
|
virtual void unpackMessage(unsigned char *buf) { };
|
||||||
|
virtual unsigned char * packMessage() { return NULL; }
|
||||||
|
|
||||||
|
const char * getPackedMessageFormatHeader() const;
|
||||||
|
unsigned int getPackedSizeHeader();
|
||||||
|
void unpackMessageHeader(unsigned char *buf);
|
||||||
|
unsigned char * packMessageHeader();
|
||||||
|
|
||||||
|
const char * getPackedMessageFormatDetail() const;
|
||||||
|
unsigned int getPackedSizeDetail(int count);
|
||||||
|
void unpackMessageDetail(unsigned char *buf,int count);
|
||||||
|
unsigned char * packMessageDetail(uint16 totalCommand);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageCommandList(int32 frameCount= -1);
|
NetworkMessageCommandList(int32 frameCount= -1);
|
||||||
|
|
||||||
|
@ -359,6 +406,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageText(){}
|
NetworkMessageText(){}
|
||||||
NetworkMessageText(const string &text, int teamIndex, int playerIndex,
|
NetworkMessageText(const string &text, int teamIndex, int playerIndex,
|
||||||
|
@ -395,6 +448,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageQuit();
|
NetworkMessageQuit();
|
||||||
|
|
||||||
|
@ -458,6 +517,21 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const { return NULL; }
|
||||||
|
virtual unsigned int getPackedSize() { return 0; }
|
||||||
|
virtual void unpackMessage(unsigned char *buf) { };
|
||||||
|
virtual unsigned char * packMessage() { return NULL; }
|
||||||
|
|
||||||
|
const char * getPackedMessageFormatHeader() const;
|
||||||
|
unsigned int getPackedSizeHeader();
|
||||||
|
void unpackMessageHeader(unsigned char *buf);
|
||||||
|
unsigned char * packMessageHeader();
|
||||||
|
|
||||||
|
unsigned int getPackedSizeDetail();
|
||||||
|
void unpackMessageDetail(unsigned char *buf);
|
||||||
|
unsigned char * packMessageDetail();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageSynchNetworkGameData() {};
|
NetworkMessageSynchNetworkGameData() {};
|
||||||
NetworkMessageSynchNetworkGameData(const GameSettings *gameSettings);
|
NetworkMessageSynchNetworkGameData(const GameSettings *gameSettings);
|
||||||
|
@ -531,6 +605,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const { return NULL; }
|
||||||
|
virtual unsigned int getPackedSize() { return 0; }
|
||||||
|
virtual void unpackMessage(unsigned char *buf) { };
|
||||||
|
virtual unsigned char * packMessage() { return NULL; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageSynchNetworkGameDataStatus() {};
|
NetworkMessageSynchNetworkGameDataStatus() {};
|
||||||
NetworkMessageSynchNetworkGameDataStatus(uint32 mapCRC, uint32 tilesetCRC, uint32 techCRC, vector<std::pair<string,uint32> > &vctFileList);
|
NetworkMessageSynchNetworkGameDataStatus(uint32 mapCRC, uint32 tilesetCRC, uint32 techCRC, vector<std::pair<string,uint32> > &vctFileList);
|
||||||
|
@ -581,6 +661,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const { return NULL; }
|
||||||
|
virtual unsigned int getPackedSize() { return 0; }
|
||||||
|
virtual void unpackMessage(unsigned char *buf) { };
|
||||||
|
virtual unsigned char * packMessage() { return NULL; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageSynchNetworkGameDataFileCRCCheck() {};
|
NetworkMessageSynchNetworkGameDataFileCRCCheck() {};
|
||||||
NetworkMessageSynchNetworkGameDataFileCRCCheck(uint32 totalFileCount, uint32 fileIndex, uint32 fileCRC, const string fileName);
|
NetworkMessageSynchNetworkGameDataFileCRCCheck(uint32 totalFileCount, uint32 fileIndex, uint32 fileCRC, const string fileName);
|
||||||
|
@ -622,6 +708,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const { return NULL; }
|
||||||
|
virtual unsigned int getPackedSize() { return 0; }
|
||||||
|
virtual void unpackMessage(unsigned char *buf) { };
|
||||||
|
virtual unsigned char * packMessage() { return NULL; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageSynchNetworkGameDataFileGet() {};
|
NetworkMessageSynchNetworkGameDataFileGet() {};
|
||||||
NetworkMessageSynchNetworkGameDataFileGet(const string fileName);
|
NetworkMessageSynchNetworkGameDataFileGet(const string fileName);
|
||||||
|
@ -677,6 +769,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SwitchSetupRequest();
|
SwitchSetupRequest();
|
||||||
SwitchSetupRequest( string selectedFactionName, int8 currentFactionIndex,
|
SwitchSetupRequest( string selectedFactionName, int8 currentFactionIndex,
|
||||||
|
@ -724,6 +822,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlayerIndexMessage( int16 playerIndex);
|
PlayerIndexMessage( int16 playerIndex);
|
||||||
|
|
||||||
|
@ -777,6 +881,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageLoadingStatus();
|
NetworkMessageLoadingStatus();
|
||||||
NetworkMessageLoadingStatus(uint32 status);
|
NetworkMessageLoadingStatus(uint32 status);
|
||||||
|
@ -818,6 +928,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageMarkCell(){}
|
NetworkMessageMarkCell(){}
|
||||||
NetworkMessageMarkCell(Vec2i target, int factionIndex, const string &text, int playerIndex);
|
NetworkMessageMarkCell(Vec2i target, int factionIndex, const string &text, int playerIndex);
|
||||||
|
@ -858,6 +974,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageUnMarkCell(){}
|
NetworkMessageUnMarkCell(){}
|
||||||
NetworkMessageUnMarkCell(Vec2i target, int factionIndex);
|
NetworkMessageUnMarkCell(Vec2i target, int factionIndex);
|
||||||
|
@ -899,6 +1021,12 @@ private:
|
||||||
private:
|
private:
|
||||||
Data data;
|
Data data;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const char * getPackedMessageFormat() const;
|
||||||
|
virtual unsigned int getPackedSize();
|
||||||
|
virtual void unpackMessage(unsigned char *buf);
|
||||||
|
virtual unsigned char * packMessage();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkMessageHighlightCell(){}
|
NetworkMessageHighlightCell(){}
|
||||||
NetworkMessageHighlightCell(Vec2i target, int factionIndex);
|
NetworkMessageHighlightCell(Vec2i target, int factionIndex);
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "unit_type.h"
|
#include "unit_type.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace Shared::Util;
|
using namespace Shared::Util;
|
||||||
|
|
|
@ -35,7 +35,6 @@ using Shared::Graphics::Vec2i;
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
class World;
|
class World;
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class NetworkString
|
// class NetworkString
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@ -62,6 +61,7 @@ public:
|
||||||
buffer[maxBufferSize-1] = '\0';
|
buffer[maxBufferSize-1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *getBuffer() { return &buffer[0]; }
|
||||||
string getString() const { return (buffer[0] != '\0' ? buffer : ""); }
|
string getString() const { return (buffer[0] != '\0' ? buffer : ""); }
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -88,21 +88,6 @@ enum NetworkCommandType {
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
class NetworkCommand {
|
class NetworkCommand {
|
||||||
private:
|
|
||||||
int16 networkCommandType;
|
|
||||||
int32 unitId;
|
|
||||||
int16 unitTypeId;
|
|
||||||
int16 commandTypeId;
|
|
||||||
int16 positionX;
|
|
||||||
int16 positionY;
|
|
||||||
int32 targetId;
|
|
||||||
int8 wantQueue;
|
|
||||||
int8 fromFactionIndex;
|
|
||||||
uint16 unitFactionUnitCount;
|
|
||||||
int8 unitFactionIndex;
|
|
||||||
int8 commandStateType;
|
|
||||||
int32 commandStateValue;
|
|
||||||
int32 unitCommandGroupId;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkCommand() {
|
NetworkCommand() {
|
||||||
|
@ -136,6 +121,21 @@ public:
|
||||||
int commandTypeStateValue = -1,
|
int commandTypeStateValue = -1,
|
||||||
int unitCommandGroupId = -1);
|
int unitCommandGroupId = -1);
|
||||||
|
|
||||||
|
int16 networkCommandType;
|
||||||
|
int32 unitId;
|
||||||
|
int16 unitTypeId;
|
||||||
|
int16 commandTypeId;
|
||||||
|
int16 positionX;
|
||||||
|
int16 positionY;
|
||||||
|
int32 targetId;
|
||||||
|
int8 wantQueue;
|
||||||
|
int8 fromFactionIndex;
|
||||||
|
uint16 unitFactionUnitCount;
|
||||||
|
int8 unitFactionIndex;
|
||||||
|
int8 commandStateType;
|
||||||
|
int32 commandStateValue;
|
||||||
|
int32 unitCommandGroupId;
|
||||||
|
|
||||||
NetworkCommandType getNetworkCommandType() const {return static_cast<NetworkCommandType>(networkCommandType);}
|
NetworkCommandType getNetworkCommandType() const {return static_cast<NetworkCommandType>(networkCommandType);}
|
||||||
int getUnitId() const {return unitId;}
|
int getUnitId() const {return unitId;}
|
||||||
int getCommandTypeId() const {return commandTypeId;}
|
int getCommandTypeId() const {return commandTypeId;}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,6 +13,7 @@
|
||||||
#define BYTE_ORDER_H
|
#define BYTE_ORDER_H
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared{ namespace PlatformByteOrder {
|
namespace Shared{ namespace PlatformByteOrder {
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ const char *GAME_ARGS[] = {
|
||||||
"--disable-opengl-checks",
|
"--disable-opengl-checks",
|
||||||
"--disable-streflop-checks",
|
"--disable-streflop-checks",
|
||||||
"--debug-network-packets",
|
"--debug-network-packets",
|
||||||
|
"--enable-new-protocol",
|
||||||
|
|
||||||
"--verbose"
|
"--verbose"
|
||||||
|
|
||||||
|
@ -162,6 +163,7 @@ enum GAME_ARG_TYPE {
|
||||||
GAME_ARG_DISABLE_STREFLOP_CAPS_CHECK,
|
GAME_ARG_DISABLE_STREFLOP_CAPS_CHECK,
|
||||||
|
|
||||||
GAME_ARG_DEBUG_NETWORK_PACKETS,
|
GAME_ARG_DEBUG_NETWORK_PACKETS,
|
||||||
|
GAME_ARG_ENABLE_NEW_PROTOCOL,
|
||||||
|
|
||||||
GAME_ARG_VERBOSE_MODE,
|
GAME_ARG_VERBOSE_MODE,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user