- added player platform to game stats
This commit is contained in:
parent
eb085907d0
commit
9798668789
|
@ -2326,11 +2326,13 @@ void Game::update() {
|
|||
ConnectionSlot *slot = server->getSlot(faction->getStartLocationIndex());
|
||||
server->gameSettings.setNetworkPlayerName(i,slot->getName());
|
||||
server->gameSettings.setNetworkPlayerUUID(i,slot->getUUID());
|
||||
server->gameSettings.setNetworkPlayerPlatform(i,slot->getPlatform());
|
||||
server->gameSettings.setNetworkPlayerStatuses(i,npst_None);
|
||||
|
||||
this->gameSettings.setFactionControl(i,ctNetwork);
|
||||
this->gameSettings.setNetworkPlayerName(i,server->gameSettings.getNetworkPlayerName(i));
|
||||
this->gameSettings.setNetworkPlayerUUID(i,server->gameSettings.getNetworkPlayerUUID(i));
|
||||
this->gameSettings.setNetworkPlayerPlatform(i,server->gameSettings.getNetworkPlayerPlatform(i));
|
||||
this->gameSettings.setNetworkPlayerStatuses(i,npst_None);
|
||||
}
|
||||
}
|
||||
|
@ -2370,6 +2372,7 @@ void Game::update() {
|
|||
this->gameSettings.setFactionControl(i,ctNetwork);
|
||||
this->gameSettings.setNetworkPlayerName(i,server->gameSettings.getNetworkPlayerName(i));
|
||||
this->gameSettings.setNetworkPlayerUUID(i,server->gameSettings.getNetworkPlayerUUID(i));
|
||||
this->gameSettings.setNetworkPlayerPlatform(i,server->gameSettings.getNetworkPlayerPlatform(i));
|
||||
|
||||
if(this->gameSettings.getNetworkPlayerStatuses(i) == npst_Disconnected) {
|
||||
this->gameSettings.setNetworkPlayerStatuses(i,npst_None);
|
||||
|
@ -2787,6 +2790,9 @@ bool Game::switchSetupForSlots(ServerInterface *& serverInterface,
|
|||
gameSettings.setNetworkPlayerUUID(oldFactionIndex, "");
|
||||
serverInterface->gameSettings.setNetworkPlayerUUID(oldFactionIndex, "");
|
||||
|
||||
gameSettings.setNetworkPlayerPlatform(oldFactionIndex, "");
|
||||
serverInterface->gameSettings.setNetworkPlayerPlatform(oldFactionIndex, "");
|
||||
|
||||
gameSettings.setFactionControl(newFactionIndex,ctNetwork);
|
||||
serverInterface->gameSettings.setFactionControl(newFactionIndex,ctNetwork);
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ private:
|
|||
string scenarioDir;
|
||||
string factionTypeNames[GameConstants::maxPlayers]; //faction names
|
||||
string networkPlayerNames[GameConstants::maxPlayers];
|
||||
string networkPlayerPlatform[GameConstants::maxPlayers];
|
||||
int networkPlayerStatuses[GameConstants::maxPlayers];
|
||||
string networkPlayerLanguages[GameConstants::maxPlayers];
|
||||
int networkPlayerGameStatus[GameConstants::maxPlayers];
|
||||
|
@ -160,6 +161,7 @@ public:
|
|||
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
||||
factionTypeNames[i] = "";
|
||||
networkPlayerNames[i] = "";
|
||||
networkPlayerPlatform[i] = "";
|
||||
networkPlayerStatuses[i] = npst_None;
|
||||
networkPlayerLanguages[i] = DEFAULT_LANG;
|
||||
factionControls[i] = ctClosed;
|
||||
|
@ -214,6 +216,17 @@ public:
|
|||
}
|
||||
return result;
|
||||
}
|
||||
string getNetworkPlayerPlatform(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
string result = networkPlayerPlatform[factionIndex];
|
||||
return result;
|
||||
}
|
||||
|
||||
const int getNetworkPlayerStatuses(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[8096]="";
|
||||
|
@ -268,6 +281,17 @@ public:
|
|||
}
|
||||
return result;
|
||||
}
|
||||
const string getNetworkPlayerPlatformByPlayerIndex(int playerIndex) const {
|
||||
string result = "";
|
||||
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
||||
if(startLocationIndex[i] == playerIndex) {
|
||||
result = networkPlayerPlatform[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ControlType getFactionControl(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[8096]="";
|
||||
|
@ -391,6 +415,16 @@ public:
|
|||
|
||||
this->networkPlayerNames[factionIndex]= playername;
|
||||
}
|
||||
void setNetworkPlayerPlatform(int factionIndex,const string& platform) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
this->networkPlayerPlatform[factionIndex]= platform;
|
||||
}
|
||||
|
||||
void setNetworkPlayerStatuses(int factionIndex,int status) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[8096]="";
|
||||
|
@ -530,6 +564,7 @@ public:
|
|||
result += "player index = " + intToStr(idx) + "\n";
|
||||
result += "factionTypeName = " + factionTypeNames[idx] + "\n";
|
||||
result += "networkPlayerName = " + networkPlayerNames[idx] + "\n";
|
||||
result += "networkPlayerPlatform = " + networkPlayerPlatform[idx] + "\n";
|
||||
result += "networkPlayerLanguage = " + networkPlayerLanguages[idx] + "\n";
|
||||
|
||||
result += "factionControl = " + intToStr(factionControls[idx]) + "\n";
|
||||
|
@ -598,6 +633,11 @@ public:
|
|||
networkPlayerNamesNode->addAttribute("name",networkPlayerNames[idx], mapTagReplacements);
|
||||
}
|
||||
|
||||
for(int idx =0; idx < GameConstants::maxPlayers; idx++) {
|
||||
XmlNode *networkPlayerNamesNode = gameSettingsNode->addChild("networkPlayerPlatform");
|
||||
networkPlayerNamesNode->addAttribute("name",networkPlayerPlatform[idx], mapTagReplacements);
|
||||
}
|
||||
|
||||
// int networkPlayerStatuses[GameConstants::maxPlayers];
|
||||
for(int idx =0; idx < GameConstants::maxPlayers; idx++) {
|
||||
XmlNode *networkPlayerStatusesNode = gameSettingsNode->addChild("networkPlayerStatuses");
|
||||
|
|
|
@ -2088,6 +2088,7 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
gameSettings->setThisFactionIndex(slotIndex);
|
||||
gameSettings->setNetworkPlayerName(slotIndex, getHumanPlayerName());
|
||||
gameSettings->setNetworkPlayerUUID(slotIndex,Config::getInstance().getString("PlayerId",""));
|
||||
gameSettings->setNetworkPlayerPlatform(slotIndex,getPlatformNameString());
|
||||
gameSettings->setNetworkPlayerStatuses(slotIndex, getNetworkPlayerStatus());
|
||||
Lang &lang= Lang::getInstance();
|
||||
gameSettings->setNetworkPlayerLanguages(slotIndex, lang.getLanguage());
|
||||
|
|
|
@ -3281,6 +3281,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force
|
|||
gameSettings->setThisFactionIndex(slotIndex);
|
||||
gameSettings->setNetworkPlayerName(slotIndex, getHumanPlayerName(i));
|
||||
gameSettings->setNetworkPlayerUUID(slotIndex,Config::getInstance().getString("PlayerId",""));
|
||||
gameSettings->setNetworkPlayerPlatform(slotIndex,getPlatformNameString());
|
||||
gameSettings->setNetworkPlayerStatuses(slotIndex, getNetworkPlayerStatus());
|
||||
Lang &lang= Lang::getInstance();
|
||||
gameSettings->setNetworkPlayerLanguages(slotIndex, lang.getLanguage());
|
||||
|
@ -3340,6 +3341,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force
|
|||
|
||||
gameSettings->setNetworkPlayerName(slotIndex, serverInterface->getSlot(i)->getName());
|
||||
gameSettings->setNetworkPlayerUUID(i,serverInterface->getSlot(i)->getUUID());
|
||||
gameSettings->setNetworkPlayerPlatform(i,serverInterface->getSlot(i)->getPlatform());
|
||||
labelPlayerNames[i].setText(serverInterface->getSlot(i)->getName());
|
||||
}
|
||||
else {
|
||||
|
@ -3362,6 +3364,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force
|
|||
}
|
||||
if(serverInterface != NULL && serverInterface->getSlot(i) != NULL) {
|
||||
gameSettings->setNetworkPlayerUUID(slotIndex,serverInterface->getSlot(i)->getUUID());
|
||||
gameSettings->setNetworkPlayerPlatform(slotIndex,serverInterface->getSlot(i)->getPlatform());
|
||||
}
|
||||
|
||||
factionCount++;
|
||||
|
@ -3394,6 +3397,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force
|
|||
gameSettings->setFactionTypeName(slotIndex, factionFiles[listBoxFactions[i].getSelectedItemIndex()]);
|
||||
gameSettings->setNetworkPlayerName(slotIndex, "Closed");
|
||||
gameSettings->setNetworkPlayerUUID(slotIndex,"");
|
||||
gameSettings->setNetworkPlayerPlatform(slotIndex,"");
|
||||
|
||||
closedCount++;
|
||||
}
|
||||
|
|
|
@ -538,6 +538,7 @@ void ClientInterface::updateLobby() {
|
|||
playerIndex= networkMessageIntro.getPlayerIndex();
|
||||
serverName= networkMessageIntro.getName();
|
||||
serverUUID = networkMessageIntro.getPlayerUUID();
|
||||
serverPlatform = networkMessageIntro.getPlayerPlatform();
|
||||
serverFTPPort = networkMessageIntro.getFtpPort();
|
||||
|
||||
MutexSafeWrapper safeMutexFlags(flagAccessor,CODE_AT_LINE);
|
||||
|
@ -609,7 +610,8 @@ void ClientInterface::updateLobby() {
|
|||
serverFTPPort,
|
||||
lang.getLanguage(),
|
||||
networkMessageIntro.getGameInProgress(),
|
||||
Config::getInstance().getString("PlayerId",""));
|
||||
Config::getInstance().getString("PlayerId",""),
|
||||
getPlatformNameString());
|
||||
sendMessage(&sendNetworkMessageIntro);
|
||||
|
||||
//printf("Got intro sending client details to server\n");
|
||||
|
|
|
@ -82,6 +82,7 @@ private:
|
|||
int serverFTPPort;
|
||||
|
||||
string serverUUID;
|
||||
string serverPlatform;
|
||||
|
||||
ClientInterfaceThread *networkCommandListThread;
|
||||
|
||||
|
|
|
@ -422,6 +422,7 @@ ConnectionSlot::ConnectionSlot(ServerInterface* serverInterface, int playerIndex
|
|||
this->playerStatus = npst_None;
|
||||
this->playerLanguage = "";
|
||||
this->playerUUID = "";
|
||||
this->platform = "";
|
||||
this->currentFrameCount = 0;
|
||||
this->currentLagCount = 0;
|
||||
this->gotLagCountWarning = false;
|
||||
|
@ -639,6 +640,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
this->playerStatus = npst_PickSettings;
|
||||
this->playerLanguage = "";
|
||||
this->playerUUID = "";
|
||||
this->platform = "";
|
||||
this->ready = false;
|
||||
this->vctFileList.clear();
|
||||
this->receivedNetworkGameStatus = false;
|
||||
|
@ -684,7 +686,8 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
ServerSocket::getFTPServerPort(),
|
||||
"",
|
||||
serverInterface->getGameHasBeenInitiated(),
|
||||
Config::getInstance().getString("PlayerId",""));
|
||||
Config::getInstance().getString("PlayerId",""),
|
||||
getPlatformNameString());
|
||||
sendMessage(&networkMessageIntro);
|
||||
|
||||
if(this->serverInterface->getGameHasBeenInitiated() == true) {
|
||||
|
@ -922,6 +925,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
this->connectedRemoteIPAddress = networkMessageIntro.getExternalIp();
|
||||
this->playerLanguage = networkMessageIntro.getPlayerLanguage();
|
||||
this->playerUUID = networkMessageIntro.getPlayerUUID();
|
||||
this->platform = networkMessageIntro.getPlayerPlatform();
|
||||
|
||||
//printf("Got uuid from client [%s]\n",this->playerUUID.c_str());
|
||||
|
||||
|
@ -998,6 +1002,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
this->serverInterface->addClientToServerIPAddress(this->getSocket()->getConnectedIPAddress(this->getSocket()->getIpAddress()),this->connectedRemoteIPAddress);
|
||||
|
||||
this->serverInterface->gameSettings.setNetworkPlayerUUID(factionIndex,this->playerUUID);
|
||||
this->serverInterface->gameSettings.setNetworkPlayerPlatform(factionIndex,this->platform);
|
||||
|
||||
if(serverInterface->getGameHasBeenInitiated() == true &&
|
||||
serverInterface->getAllowInGameConnections() == true) {
|
||||
|
@ -1128,6 +1133,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
this->serverInterface->gameSettings.setFactionControl(factionIndex,ctNetwork);
|
||||
this->serverInterface->gameSettings.setNetworkPlayerName(factionIndex,this->name);
|
||||
this->serverInterface->gameSettings.setNetworkPlayerUUID(factionIndex,this->playerUUID);
|
||||
this->serverInterface->gameSettings.setNetworkPlayerPlatform(factionIndex,this->platform);
|
||||
|
||||
if(this->serverInterface->gameSettings.getNetworkPlayerStatuses(factionIndex) == npst_Disconnected) {
|
||||
this->serverInterface->gameSettings.setNetworkPlayerStatuses(factionIndex,npst_None);
|
||||
|
|
|
@ -151,6 +151,7 @@ private:
|
|||
int playerStatus;
|
||||
string playerLanguage;
|
||||
string playerUUID;
|
||||
string platform;
|
||||
|
||||
bool skipLagCheck;
|
||||
bool joinGameInProgress;
|
||||
|
@ -193,6 +194,7 @@ public:
|
|||
void setReady();
|
||||
const string &getName() const {return name;}
|
||||
const string &getUUID() const {return playerUUID;}
|
||||
const string &getPlatform() const { return platform; }
|
||||
void setName(string value) {name = value;}
|
||||
bool isReady() const {return ready;}
|
||||
|
||||
|
|
|
@ -120,7 +120,8 @@ NetworkMessageIntro::NetworkMessageIntro(int32 sessionId,const string &versionSt
|
|||
uint32 externalIp,
|
||||
uint32 ftpPort,
|
||||
const string &playerLanguage,
|
||||
int gameInProgress, const string &playerUUID) {
|
||||
int gameInProgress, const string &playerUUID,
|
||||
const string &platform) {
|
||||
data.messageType = nmtIntro;
|
||||
data.sessionId = sessionId;
|
||||
data.versionString = versionString;
|
||||
|
@ -132,10 +133,11 @@ NetworkMessageIntro::NetworkMessageIntro(int32 sessionId,const string &versionSt
|
|||
data.language = playerLanguage;
|
||||
data.gameInProgress = gameInProgress;
|
||||
data.playerUUID = playerUUID;
|
||||
data.platform = platform;
|
||||
}
|
||||
|
||||
const char * NetworkMessageIntro::getPackedMessageFormat() const {
|
||||
return "cl128s32shcLL60sc60s";
|
||||
return "cl128s32shcLL60sc60s60s";
|
||||
}
|
||||
|
||||
unsigned int NetworkMessageIntro::getPackedSize() {
|
||||
|
@ -154,7 +156,8 @@ unsigned int NetworkMessageIntro::getPackedSize() {
|
|||
packedData.ftpPort,
|
||||
packedData.language.getBuffer(),
|
||||
data.gameInProgress,
|
||||
packedData.playerUUID.getBuffer());
|
||||
packedData.playerUUID.getBuffer(),
|
||||
packedData.platform.getBuffer());
|
||||
delete [] buf;
|
||||
}
|
||||
return result;
|
||||
|
@ -172,7 +175,8 @@ void NetworkMessageIntro::unpackMessage(unsigned char *buf) {
|
|||
&data.ftpPort,
|
||||
data.language.getBuffer(),
|
||||
&data.gameInProgress,
|
||||
data.playerUUID.getBuffer());
|
||||
data.playerUUID.getBuffer(),
|
||||
data.platform.getBuffer());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s] unpacked data:\n%s\n",__FUNCTION__,this->toString().c_str());
|
||||
}
|
||||
|
||||
|
@ -191,7 +195,8 @@ unsigned char * NetworkMessageIntro::packMessage() {
|
|||
data.ftpPort,
|
||||
data.language.getBuffer(),
|
||||
data.gameInProgress,
|
||||
data.playerUUID.getBuffer());
|
||||
data.playerUUID.getBuffer(),
|
||||
data.platform.getBuffer());
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -207,6 +212,7 @@ string NetworkMessageIntro::toString() const {
|
|||
result += " language = " + data.language.getString();
|
||||
result += " gameInProgress = " + uIntToStr(data.gameInProgress);
|
||||
result += " playerUUID = " + data.playerUUID.getString();
|
||||
result += " platform = " + data.platform.getString();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -229,6 +235,7 @@ bool NetworkMessageIntro::receive(Socket* socket) {
|
|||
data.versionString.nullTerminate();
|
||||
data.language.nullTerminate();
|
||||
data.playerUUID.nullTerminate();
|
||||
data.platform.nullTerminate();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] get nmtIntro, data.playerIndex = %d, data.sessionId = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,data.playerIndex,data.sessionId);
|
||||
return result;
|
||||
|
@ -531,6 +538,7 @@ NetworkMessageLaunch::NetworkMessageLaunch(const GameSettings *gameSettings,int8
|
|||
for(int i= 0; i < GameConstants::maxPlayers; ++i) {
|
||||
data.factionTypeNames[i]= gameSettings->getFactionTypeName(i);
|
||||
data.networkPlayerNames[i]= gameSettings->getNetworkPlayerName(i);
|
||||
data.networkPlayerPlatform[i]= gameSettings->getNetworkPlayerPlatform(i);
|
||||
data.networkPlayerStatuses[i] = gameSettings->getNetworkPlayerStatuses(i);
|
||||
data.networkPlayerLanguages[i] = gameSettings->getNetworkPlayerLanguages(i);
|
||||
data.factionControls[i]= gameSettings->getFactionControl(i);
|
||||
|
@ -588,6 +596,7 @@ void NetworkMessageLaunch::buildGameSettings(GameSettings *gameSettings) const {
|
|||
for(int i= 0; i < GameConstants::maxPlayers; ++i) {
|
||||
gameSettings->setFactionTypeName(i, data.factionTypeNames[i].getString());
|
||||
gameSettings->setNetworkPlayerName(i,data.networkPlayerNames[i].getString());
|
||||
gameSettings->setNetworkPlayerPlatform(i,data.networkPlayerPlatform[i].getString());
|
||||
gameSettings->setNetworkPlayerStatuses(i, data.networkPlayerStatuses[i]);
|
||||
gameSettings->setNetworkPlayerLanguages(i, data.networkPlayerLanguages[i].getString());
|
||||
gameSettings->setFactionControl(i, static_cast<ControlType>(data.factionControls[i]));
|
||||
|
@ -596,6 +605,7 @@ void NetworkMessageLaunch::buildGameSettings(GameSettings *gameSettings) const {
|
|||
gameSettings->setStartLocationIndex(i, data.startLocationIndex[i]);
|
||||
|
||||
gameSettings->setNetworkPlayerUUID(i,data.networkPlayerUUID[i].getString());
|
||||
gameSettings->setNetworkPlayerPlatform(i,data.networkPlayerPlatform[i].getString());
|
||||
//printf("Build game settings for index: %d [%s]\n",i,data.networkPlayerUUID[i].getString().c_str());
|
||||
}
|
||||
|
||||
|
@ -624,7 +634,7 @@ vector<pair<string,uint32> > NetworkMessageLaunch::getFactionCRCList() const {
|
|||
}
|
||||
|
||||
const char * NetworkMessageLaunch::getPackedMessageFormat() const {
|
||||
return "c256s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60sllllllll60s60s60s60s60s60s60s60sLLL60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60sLLLLLLLLLLLLLLLLLLLLcccccccccccccccccccccccccccccccccccccccccCccLccll256s60s60s60s60s60s60s60s60sc60s";
|
||||
return "c256s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60sllllllll60s60s60s60s60s60s60s60sLLL60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60s60sLLLLLLLLLLLLLLLLLLLLcccccccccccccccccccccccccccccccccccccccccCccLccll256s60s60s60s60s60s60s60s60sc60s";
|
||||
}
|
||||
|
||||
unsigned int NetworkMessageLaunch::getPackedSize() {
|
||||
|
@ -654,6 +664,14 @@ unsigned int NetworkMessageLaunch::getPackedSize() {
|
|||
packedData.networkPlayerNames[5].getBuffer(),
|
||||
packedData.networkPlayerNames[6].getBuffer(),
|
||||
packedData.networkPlayerNames[7].getBuffer(),
|
||||
packedData.networkPlayerPlatform[0].getBuffer(),
|
||||
packedData.networkPlayerPlatform[1].getBuffer(),
|
||||
packedData.networkPlayerPlatform[2].getBuffer(),
|
||||
packedData.networkPlayerPlatform[3].getBuffer(),
|
||||
packedData.networkPlayerPlatform[4].getBuffer(),
|
||||
packedData.networkPlayerPlatform[5].getBuffer(),
|
||||
packedData.networkPlayerPlatform[6].getBuffer(),
|
||||
packedData.networkPlayerPlatform[7].getBuffer(),
|
||||
packedData.networkPlayerStatuses[0],
|
||||
packedData.networkPlayerStatuses[1],
|
||||
packedData.networkPlayerStatuses[2],
|
||||
|
@ -801,6 +819,14 @@ void NetworkMessageLaunch::unpackMessage(unsigned char *buf) {
|
|||
data.networkPlayerNames[5].getBuffer(),
|
||||
data.networkPlayerNames[6].getBuffer(),
|
||||
data.networkPlayerNames[7].getBuffer(),
|
||||
data.networkPlayerPlatform[0].getBuffer(),
|
||||
data.networkPlayerPlatform[1].getBuffer(),
|
||||
data.networkPlayerPlatform[2].getBuffer(),
|
||||
data.networkPlayerPlatform[3].getBuffer(),
|
||||
data.networkPlayerPlatform[4].getBuffer(),
|
||||
data.networkPlayerPlatform[5].getBuffer(),
|
||||
data.networkPlayerPlatform[6].getBuffer(),
|
||||
data.networkPlayerPlatform[7].getBuffer(),
|
||||
&data.networkPlayerStatuses[0],
|
||||
&data.networkPlayerStatuses[1],
|
||||
&data.networkPlayerStatuses[2],
|
||||
|
@ -947,6 +973,14 @@ unsigned char * NetworkMessageLaunch::packMessage() {
|
|||
data.networkPlayerNames[5].getBuffer(),
|
||||
data.networkPlayerNames[6].getBuffer(),
|
||||
data.networkPlayerNames[7].getBuffer(),
|
||||
data.networkPlayerPlatform[0].getBuffer(),
|
||||
data.networkPlayerPlatform[1].getBuffer(),
|
||||
data.networkPlayerPlatform[2].getBuffer(),
|
||||
data.networkPlayerPlatform[3].getBuffer(),
|
||||
data.networkPlayerPlatform[4].getBuffer(),
|
||||
data.networkPlayerPlatform[5].getBuffer(),
|
||||
data.networkPlayerPlatform[6].getBuffer(),
|
||||
data.networkPlayerPlatform[7].getBuffer(),
|
||||
data.networkPlayerStatuses[0],
|
||||
data.networkPlayerStatuses[1],
|
||||
data.networkPlayerStatuses[2],
|
||||
|
@ -1092,6 +1126,7 @@ bool NetworkMessageLaunch::receive(Socket* socket) {
|
|||
for(int i= 0; i < GameConstants::maxPlayers; ++i){
|
||||
data.factionTypeNames[i].nullTerminate();
|
||||
data.networkPlayerNames[i].nullTerminate();
|
||||
data.networkPlayerPlatform[i].nullTerminate();
|
||||
data.networkPlayerLanguages[i].nullTerminate();
|
||||
|
||||
data.networkPlayerUUID[i].nullTerminate();
|
||||
|
|
|
@ -113,6 +113,7 @@ private:
|
|||
NetworkString<maxLanguageStringSize> language;
|
||||
int8 gameInProgress;
|
||||
NetworkString<maxSmallStringSize> playerUUID;
|
||||
NetworkString<maxSmallStringSize> platform;
|
||||
};
|
||||
void toEndian();
|
||||
void fromEndian();
|
||||
|
@ -127,7 +128,7 @@ public:
|
|||
NetworkMessageIntro(int32 sessionId, const string &versionString,
|
||||
const string &name, int playerIndex, NetworkGameStateType gameState,
|
||||
uint32 externalIp, uint32 ftpPort, const string &playerLanguage,
|
||||
int gameInProgress, const string &playerUUID);
|
||||
int gameInProgress, const string &playerUUID, const string &platform);
|
||||
|
||||
|
||||
virtual const char * getPackedMessageFormat() const;
|
||||
|
@ -149,6 +150,7 @@ public:
|
|||
uint8 getGameInProgress() const { return data.gameInProgress; }
|
||||
|
||||
string getPlayerUUID() const { return data.playerUUID.getString();}
|
||||
string getPlayerPlatform() const { return data.platform.getString();}
|
||||
|
||||
virtual bool receive(Socket* socket);
|
||||
virtual void send(Socket* socket);
|
||||
|
@ -260,6 +262,7 @@ private:
|
|||
NetworkString<maxSmallStringSize> tech;
|
||||
NetworkString<maxSmallStringSize> factionTypeNames[GameConstants::maxPlayers]; //faction names
|
||||
NetworkString<maxSmallStringSize> networkPlayerNames[GameConstants::maxPlayers]; //networkPlayerNames
|
||||
NetworkString<maxSmallStringSize> networkPlayerPlatform[GameConstants::maxPlayers];
|
||||
int32 networkPlayerStatuses[GameConstants::maxPlayers]; //networkPlayerStatuses
|
||||
NetworkString<maxSmallStringSize> networkPlayerLanguages[GameConstants::maxPlayers];
|
||||
|
||||
|
|
|
@ -2855,6 +2855,7 @@ std::map<string,string> ServerInterface::publishToMasterserverStats() {
|
|||
publishToServerInfo["quitBeforeGameEnd_" + intToStr(factionIndex)] = intToStr(gameStats->getPlayerLeftBeforeEnd(factionIndex));
|
||||
publishToServerInfo["quitTime_" + intToStr(factionIndex)] = intToStr(gameStats->getTimePlayerLeft(factionIndex));
|
||||
publishToServerInfo["playerUUID_" + intToStr(factionIndex)] = this->getGameSettings()->getNetworkPlayerUUID(factionIndex);
|
||||
publishToServerInfo["platform_" + intToStr(factionIndex)] = this->getGameSettings()->getNetworkPlayerPlatform(factionIndex);
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
|
|
@ -496,6 +496,7 @@ void Scenario::loadGameSettings(const vector<string> &dirList,
|
|||
gameSettings->setNetworkPlayerName(i,Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()));
|
||||
}
|
||||
gameSettings->setNetworkPlayerUUID(i,Config::getInstance().getString("PlayerId",""));
|
||||
gameSettings->setNetworkPlayerPlatform(i,getPlatformNameString());
|
||||
}
|
||||
else {
|
||||
if(gameSettings->getNetworkPlayerName(i) == "") {
|
||||
|
|
|
@ -202,6 +202,11 @@
|
|||
$playerUUID = (string) clean_str( $_GET['playerUUID_' . $factionNumber] );
|
||||
}
|
||||
|
||||
$playerPlatform = "";
|
||||
if ( isset( $_GET['platform_' . $factionNumber] ) ) {
|
||||
$playerPlatform = (string) clean_str( $_GET['platform_' . $factionNumber] );
|
||||
}
|
||||
|
||||
if($player_statsCount[0] > 0)
|
||||
{
|
||||
$result = mysql_query( 'UPDATE glestgameplayerstats SET ' .
|
||||
|
@ -222,6 +227,7 @@
|
|||
'quitBeforeGameEnd=' . $quitBeforeGameEnd . ', ' .
|
||||
'quitTime=' . $quitTime . ', ' .
|
||||
'playerUUID=\'' . mysql_real_escape_string( $playerUUID ) . '\', ' .
|
||||
'platform=\'' . mysql_real_escape_string( $playerPlatform ) . '\', ' .
|
||||
'lasttime=' . 'now()' . ' ' .
|
||||
'WHERE ' . $whereClause . ' AND factionIndex = ' . $factionIndex . ';');
|
||||
|
||||
|
@ -251,6 +257,7 @@
|
|||
'playerName=\'' . mysql_real_escape_string( $playerName ) . '\', ' .
|
||||
'quitBeforeGameEnd=' . $quitBeforeGameEnd . ', ' .
|
||||
'quitTime=' . $quitTime . ', ' .
|
||||
'platform=\'' . mysql_real_escape_string( $playerPlatform ) . '\', ' .
|
||||
'playerUUID=\'' . mysql_real_escape_string( $playerUUID ) . '\';');
|
||||
|
||||
if (!$result) {
|
||||
|
|
|
@ -91,6 +91,7 @@ CREATE TABLE `glestgameplayerstats` (
|
|||
`lasttime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`gameUUID` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`playerUUID` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`platform` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`factionIndex` int(11) NOT NULL,
|
||||
`controlType` int(11) NOT NULL,
|
||||
`resourceMultiplier` DECIMAL(10,6) NOT NULL,
|
||||
|
@ -109,6 +110,7 @@ CREATE TABLE `glestgameplayerstats` (
|
|||
|
||||
KEY `gameUUID` (`gameUUID`)
|
||||
KEY `playerUUID` (`playerUUID`)
|
||||
KEY `platform` (`platform`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
--
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
|
||||
echo ' <table>' . PHP_EOL;
|
||||
echo ' <tr>' . PHP_EOL;
|
||||
echo ' <th title="factionIndex">Faction Index</th>' . PHP_EOL;
|
||||
echo ' <th title="factionIndex">Player #</th>' . PHP_EOL;
|
||||
echo ' <th title="controlType">Player Type</th>' . PHP_EOL;
|
||||
echo ' <th title="resourceMultiplier">Resource Multiplier</th>' . PHP_EOL;
|
||||
echo ' <th title="factionTypeName">Faction Type</th>' . PHP_EOL;
|
||||
|
@ -97,6 +97,7 @@
|
|||
echo ' <th title="unitsProducedCount">Units Produced</th>' . PHP_EOL;
|
||||
echo ' <th title="resourceHarvestedCount">Resources Harvested</th>' . PHP_EOL;
|
||||
echo ' <th title="playerName">Player Name</th>' . PHP_EOL;
|
||||
echo ' <th title="playerPlatform">Platform</th>' . PHP_EOL;
|
||||
echo ' <th title="playerScore">Score</th>' . PHP_EOL;
|
||||
echo ' <th title="quitBeforeGameEnd">Quit Before Game Ended</th>' . PHP_EOL;
|
||||
echo ' <th title="quitTime">Quit Time</th>' . PHP_EOL;
|
||||
|
@ -133,7 +134,7 @@
|
|||
{
|
||||
echo "\t\t\t" . '<tr>' . PHP_EOL;
|
||||
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['factionIndex'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['factionIndex']+1, ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
$controlType = $player_stats['controlType'];
|
||||
switch ( $controlType )
|
||||
|
@ -182,7 +183,7 @@
|
|||
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['resourceMultiplier'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['factionTypeName'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['teamIndex'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['teamIndex']+1, ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
$wonGame_class = "player_loser";
|
||||
if($player_stats['wonGame'])
|
||||
|
@ -190,7 +191,7 @@
|
|||
$wonGame_class = "player_winner";
|
||||
}
|
||||
|
||||
printf( "\t\t\t\t<td class='%s'>%s</td>%s", $wonGame_class, htmlspecialchars( $player_stats['wonGame'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td class='%s'>%s</td>%s", $wonGame_class, htmlspecialchars( ($player_stats['wonGame'] ? "yes" : "no"), ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['killCount'], ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
$player_score_class = "player_losing_score";
|
||||
|
@ -218,6 +219,7 @@
|
|||
|
||||
printf( "\t\t\t\t<td class='%s'>%s</td>%s", $player_score_class, htmlspecialchars( $player_stats['resourceHarvestedCount'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['playerName'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['platform'], ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
$player_score = $player_stats['enemyKillCount'] * 100 + $player_stats['unitsProducedCount'] * 50 + $player_stats['resourceHarvestedCount'] / 10;
|
||||
$player_score_class = "player_losing_score";
|
||||
|
@ -228,7 +230,7 @@
|
|||
|
||||
printf( "\t\t\t\t<td class='%s'>%s</td>%s", $player_score_class, htmlspecialchars( $player_score, ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( $player_stats['quitBeforeGameEnd'], ENT_QUOTES ), PHP_EOL );
|
||||
printf( "\t\t\t\t<td>%s</td>%s", htmlspecialchars( ($player_stats['quitBeforeGameEnd'] ? "yes" : "no"), ENT_QUOTES ), PHP_EOL );
|
||||
|
||||
$quitTime = $player_stats['quitTime'];
|
||||
$quitTime = getTimeString($quitTime);
|
||||
|
|
Loading…
Reference in New Issue