- added the beginning of some new master server info (very limited)
- Masterserver menu will show more titles / colors. - We keep the game showing in the Masterserver menu while it is in progress. - Disable join button when slots are full. - Update title with IN PROGRESS when game is being played. - PHP Script is backwards compatible with older clients
This commit is contained in:
parent
fd3a8e4705
commit
ae8571a406
|
@ -8,16 +8,16 @@ AnnouncementURL=http://megaglest.pepper.freeit.org/announcement.txt
|
||||||
AutoMaxFullScreen=false
|
AutoMaxFullScreen=false
|
||||||
AutoTest=false
|
AutoTest=false
|
||||||
CheckGlCaps=true
|
CheckGlCaps=true
|
||||||
ColorBits=32
|
ColorBits=32
|
||||||
ConsoleMaxLines=7
|
ConsoleMaxLines=7
|
||||||
ConsoleMaxLinesStored=20
|
ConsoleMaxLinesStored=20
|
||||||
ConsoleTimeout=20
|
ConsoleTimeout=20
|
||||||
DayTime=1000
|
DayTime=1000
|
||||||
DebugLogFile=debug.log
|
DebugLogFile=debug.log
|
||||||
DebugMode=false
|
DebugMode=false
|
||||||
DebugPerformance=false
|
DebugPerformance=false
|
||||||
DebugNetwork=false
|
DebugNetwork=false
|
||||||
DebugWorldSynch=false
|
DebugWorldSynch=false
|
||||||
DepthBits=16
|
DepthBits=16
|
||||||
FactoryGraphics=OpenGL
|
FactoryGraphics=OpenGL
|
||||||
FactorySound=OpenAL
|
FactorySound=OpenAL
|
||||||
|
@ -46,16 +46,17 @@ FontSizeAdjustment=0
|
||||||
Lang=english
|
Lang=english
|
||||||
MaxLights=3
|
MaxLights=3
|
||||||
;Masterserver=http://soft-haus.com/glest/cgi-bin/
|
;Masterserver=http://soft-haus.com/glest/cgi-bin/
|
||||||
|
Masterserver=http://192.168.0.107/glest/
|
||||||
;MasterServerExternalPortList=80,143,587,21,110,25,443,993,995
|
;MasterServerExternalPortList=80,143,587,21,110,25,443,993,995
|
||||||
Masterserver=http://megaglest.pepper.freeit.org/masterserver/
|
;Masterserver=http://megaglest.pepper.freeit.org/masterserver/
|
||||||
MasterServerExternalPortList=61357,61358,61359,61360,61000,80,143,587,21,110,25,443,993,995,1080,8080
|
MasterServerExternalPortList=61357,61358,61359,61360,61000,80,143,587,21,110,25,443,993,995,1080,8080
|
||||||
NetPlayerName=newbie
|
NetPlayerName=newbie
|
||||||
NetworkConsistencyChecks=true
|
NetworkConsistencyChecks=true
|
||||||
PhotoMode=false
|
PhotoMode=false
|
||||||
RefreshFrequency=75
|
RefreshFrequency=75
|
||||||
ScreenHeight=768
|
ScreenHeight=768
|
||||||
ScreenWidth=1024
|
ScreenWidth=1024
|
||||||
ServerIp=192.168.0.107
|
ServerIp=192.168.0.107
|
||||||
ServerPort=61357
|
ServerPort=61357
|
||||||
ShadowAlpha=0.2
|
ShadowAlpha=0.2
|
||||||
ShadowFrameSkip=2
|
ShadowFrameSkip=2
|
||||||
|
@ -67,7 +68,7 @@ SoundVolumeAmbient=80
|
||||||
SoundVolumeFx=80
|
SoundVolumeFx=80
|
||||||
SoundVolumeMusic=90
|
SoundVolumeMusic=90
|
||||||
StencilBits=0
|
StencilBits=0
|
||||||
Textures3D=true
|
Textures3D=true
|
||||||
UnitParticles=true
|
UnitParticles=true
|
||||||
UserData_Root=mydata/
|
UserData_Root=mydata/
|
||||||
Windowed=false
|
Windowed=false
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "vec.h"
|
||||||
|
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Marti<EFBFBD>o Figueroa
|
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -15,12 +16,24 @@
|
||||||
// License, or (at your option) any later version
|
// License, or (at your option) any later version
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
|
|
||||||
|
using namespace Shared::Graphics;
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class GameConstants
|
// class GameConstants
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
|
const Vec4f BLACK(0, 0, 0, 1);
|
||||||
|
const Vec4f RED(1, 0, 0, 1);
|
||||||
|
const Vec4f GREEN(0, 1, 0, 1);
|
||||||
|
const Vec4f BLUE(0, 0, 1, 1);
|
||||||
|
const Vec4f GLASS(1, 1, 1, 0.3);
|
||||||
|
const Vec4f CYAN(0, 1, 1, 1);
|
||||||
|
const Vec4f YELLOW(1, 1, 0, 1);
|
||||||
|
const Vec4f MAGENTA(1, 0, 1, 1);
|
||||||
|
const Vec4f WHITE(1, 1, 1, 1);
|
||||||
|
|
||||||
enum PathFinderType {
|
enum PathFinderType {
|
||||||
pfBasic,
|
pfBasic,
|
||||||
pfRoutePlanner
|
pfRoutePlanner
|
||||||
|
|
|
@ -41,8 +41,8 @@ ServerLine::ServerLine( MasterServerInfo *mServerInfo, int lineIndex, const char
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
|
|
||||||
index=lineIndex;
|
index=lineIndex;
|
||||||
int lineOffset=25*lineIndex;
|
int lineOffset = 25 * lineIndex;
|
||||||
masterServerInfo=mServerInfo;
|
masterServerInfo = *mServerInfo;
|
||||||
int i=10;
|
int i=10;
|
||||||
int startOffset=600;
|
int startOffset=600;
|
||||||
|
|
||||||
|
@ -51,63 +51,63 @@ ServerLine::ServerLine( MasterServerInfo *mServerInfo, int lineIndex, const char
|
||||||
glestVersionLabel.registerGraphicComponent(containerName,"glestVersionLabel" + intToStr(lineIndex));
|
glestVersionLabel.registerGraphicComponent(containerName,"glestVersionLabel" + intToStr(lineIndex));
|
||||||
registeredObjNameList.push_back("glestVersionLabel" + intToStr(lineIndex));
|
registeredObjNameList.push_back("glestVersionLabel" + intToStr(lineIndex));
|
||||||
glestVersionLabel.init(i,startOffset-lineOffset);
|
glestVersionLabel.init(i,startOffset-lineOffset);
|
||||||
glestVersionLabel.setText(masterServerInfo->getGlestVersion());
|
glestVersionLabel.setText(masterServerInfo.getGlestVersion());
|
||||||
|
|
||||||
i+=80;
|
i+=80;
|
||||||
registeredObjNameList.push_back("platformLabel" + intToStr(lineIndex));
|
registeredObjNameList.push_back("platformLabel" + intToStr(lineIndex));
|
||||||
platformLabel.registerGraphicComponent(containerName,"platformLabel" + intToStr(lineIndex));
|
platformLabel.registerGraphicComponent(containerName,"platformLabel" + intToStr(lineIndex));
|
||||||
platformLabel.init(i,startOffset-lineOffset);
|
platformLabel.init(i,startOffset-lineOffset);
|
||||||
platformLabel.setText(masterServerInfo->getPlatform());
|
platformLabel.setText(masterServerInfo.getPlatform());
|
||||||
|
|
||||||
i+=50;
|
i+=50;
|
||||||
registeredObjNameList.push_back("binaryCompileDateLabel" + intToStr(lineIndex));
|
registeredObjNameList.push_back("binaryCompileDateLabel" + intToStr(lineIndex));
|
||||||
binaryCompileDateLabel.registerGraphicComponent(containerName,"binaryCompileDateLabel" + intToStr(lineIndex));
|
binaryCompileDateLabel.registerGraphicComponent(containerName,"binaryCompileDateLabel" + intToStr(lineIndex));
|
||||||
binaryCompileDateLabel.init(i,startOffset-lineOffset);
|
binaryCompileDateLabel.init(i,startOffset-lineOffset);
|
||||||
binaryCompileDateLabel.setText(masterServerInfo->getBinaryCompileDate());
|
binaryCompileDateLabel.setText(masterServerInfo.getBinaryCompileDate());
|
||||||
|
|
||||||
//game info:
|
//game info:
|
||||||
i+=130;
|
i+=130;
|
||||||
registeredObjNameList.push_back("serverTitleLabel" + intToStr(lineIndex));
|
registeredObjNameList.push_back("serverTitleLabel" + intToStr(lineIndex));
|
||||||
serverTitleLabel.registerGraphicComponent(containerName,"serverTitleLabel" + intToStr(lineIndex));
|
serverTitleLabel.registerGraphicComponent(containerName,"serverTitleLabel" + intToStr(lineIndex));
|
||||||
serverTitleLabel.init(i,startOffset-lineOffset);
|
serverTitleLabel.init(i,startOffset-lineOffset);
|
||||||
serverTitleLabel.setText(masterServerInfo->getServerTitle());
|
serverTitleLabel.setText(masterServerInfo.getServerTitle());
|
||||||
|
|
||||||
i+=160;
|
i+=160;
|
||||||
registeredObjNameList.push_back("ipAddressLabel" + intToStr(lineIndex));
|
registeredObjNameList.push_back("ipAddressLabel" + intToStr(lineIndex));
|
||||||
ipAddressLabel.registerGraphicComponent(containerName,"ipAddressLabel" + intToStr(lineIndex));
|
ipAddressLabel.registerGraphicComponent(containerName,"ipAddressLabel" + intToStr(lineIndex));
|
||||||
ipAddressLabel.init(i,startOffset-lineOffset);
|
ipAddressLabel.init(i,startOffset-lineOffset);
|
||||||
ipAddressLabel.setText(masterServerInfo->getIpAddress());
|
ipAddressLabel.setText(masterServerInfo.getIpAddress());
|
||||||
|
|
||||||
//game setup info:
|
//game setup info:
|
||||||
i+=100;
|
i+=100;
|
||||||
registeredObjNameList.push_back("techLabel" + intToStr(lineIndex));
|
registeredObjNameList.push_back("techLabel" + intToStr(lineIndex));
|
||||||
techLabel.registerGraphicComponent(containerName,"techLabel" + intToStr(lineIndex));
|
techLabel.registerGraphicComponent(containerName,"techLabel" + intToStr(lineIndex));
|
||||||
techLabel.init(i,startOffset-lineOffset);
|
techLabel.init(i,startOffset-lineOffset);
|
||||||
techLabel.setText(masterServerInfo->getTech());
|
techLabel.setText(masterServerInfo.getTech());
|
||||||
|
|
||||||
i+=100;
|
i+=100;
|
||||||
registeredObjNameList.push_back("mapLabel" + intToStr(lineIndex));
|
registeredObjNameList.push_back("mapLabel" + intToStr(lineIndex));
|
||||||
mapLabel.registerGraphicComponent(containerName,"mapLabel" + intToStr(lineIndex));
|
mapLabel.registerGraphicComponent(containerName,"mapLabel" + intToStr(lineIndex));
|
||||||
mapLabel.init(i,startOffset-lineOffset);
|
mapLabel.init(i,startOffset-lineOffset);
|
||||||
mapLabel.setText(masterServerInfo->getMap());
|
mapLabel.setText(masterServerInfo.getMap());
|
||||||
|
|
||||||
i+=100;
|
i+=100;
|
||||||
registeredObjNameList.push_back("tilesetLabel" + intToStr(lineIndex));
|
registeredObjNameList.push_back("tilesetLabel" + intToStr(lineIndex));
|
||||||
tilesetLabel.registerGraphicComponent(containerName,"tilesetLabel" + intToStr(lineIndex));
|
tilesetLabel.registerGraphicComponent(containerName,"tilesetLabel" + intToStr(lineIndex));
|
||||||
tilesetLabel.init(i,startOffset-lineOffset);
|
tilesetLabel.init(i,startOffset-lineOffset);
|
||||||
tilesetLabel.setText(masterServerInfo->getTileset());
|
tilesetLabel.setText(masterServerInfo.getTileset());
|
||||||
|
|
||||||
i+=100;
|
i+=100;
|
||||||
registeredObjNameList.push_back("activeSlotsLabel" + intToStr(lineIndex));
|
registeredObjNameList.push_back("activeSlotsLabel" + intToStr(lineIndex));
|
||||||
activeSlotsLabel.registerGraphicComponent(containerName,"activeSlotsLabel" + intToStr(lineIndex));
|
activeSlotsLabel.registerGraphicComponent(containerName,"activeSlotsLabel" + intToStr(lineIndex));
|
||||||
activeSlotsLabel.init(i,startOffset-lineOffset);
|
activeSlotsLabel.init(i,startOffset-lineOffset);
|
||||||
activeSlotsLabel.setText(intToStr(masterServerInfo->getActiveSlots())+"/"+intToStr(masterServerInfo->getNetworkSlots())+"/"+intToStr(masterServerInfo->getConnectedClients()));
|
activeSlotsLabel.setText(intToStr(masterServerInfo.getActiveSlots())+"/"+intToStr(masterServerInfo.getNetworkSlots())+"/"+intToStr(masterServerInfo.getConnectedClients()));
|
||||||
|
|
||||||
i+=50;
|
i+=50;
|
||||||
registeredObjNameList.push_back("externalConnectPort" + intToStr(lineIndex));
|
registeredObjNameList.push_back("externalConnectPort" + intToStr(lineIndex));
|
||||||
externalConnectPort.registerGraphicComponent(containerName,"externalConnectPort" + intToStr(lineIndex));
|
externalConnectPort.registerGraphicComponent(containerName,"externalConnectPort" + intToStr(lineIndex));
|
||||||
externalConnectPort.init(i,startOffset-lineOffset);
|
externalConnectPort.init(i,startOffset-lineOffset);
|
||||||
externalConnectPort.setText(intToStr(masterServerInfo->getExternalConnectPort()));
|
externalConnectPort.setText(intToStr(masterServerInfo.getExternalConnectPort()));
|
||||||
|
|
||||||
i+=50;
|
i+=50;
|
||||||
registeredObjNameList.push_back("selectButton" + intToStr(lineIndex));
|
registeredObjNameList.push_back("selectButton" + intToStr(lineIndex));
|
||||||
|
@ -116,16 +116,23 @@ ServerLine::ServerLine( MasterServerInfo *mServerInfo, int lineIndex, const char
|
||||||
selectButton.setText(">");
|
selectButton.setText(">");
|
||||||
|
|
||||||
//printf("glestVersionString [%s] masterServerInfo->getGlestVersion() [%s]\n",glestVersionString.c_str(),masterServerInfo->getGlestVersion().c_str());
|
//printf("glestVersionString [%s] masterServerInfo->getGlestVersion() [%s]\n",glestVersionString.c_str(),masterServerInfo->getGlestVersion().c_str());
|
||||||
bool compatible = checkVersionComptability(glestVersionString, masterServerInfo->getGlestVersion());
|
bool compatible = checkVersionComptability(glestVersionString, masterServerInfo.getGlestVersion());
|
||||||
selectButton.setEnabled(compatible);
|
selectButton.setEnabled(compatible);
|
||||||
selectButton.setEditable(compatible);
|
selectButton.setEditable(compatible);
|
||||||
|
|
||||||
|
registeredObjNameList.push_back("gameFull" + intToStr(lineIndex));
|
||||||
|
gameFull.registerGraphicComponent(containerName,"gameFull" + intToStr(lineIndex));
|
||||||
|
gameFull.init(i, startOffset-lineOffset);
|
||||||
|
gameFull.setText(lang.get("MGGameSlotsFull"));
|
||||||
|
gameFull.setEnabled(!compatible);
|
||||||
|
gameFull.setEditable(!compatible);
|
||||||
|
|
||||||
GraphicComponent::applyAllCustomProperties(containerName);
|
GraphicComponent::applyAllCustomProperties(containerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerLine::~ServerLine() {
|
ServerLine::~ServerLine() {
|
||||||
GraphicComponent::clearRegisterGraphicComponent(containerName, registeredObjNameList);
|
GraphicComponent::clearRegisterGraphicComponent(containerName, registeredObjNameList);
|
||||||
delete masterServerInfo;
|
//delete masterServerInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServerLine::buttonMouseClick(int x, int y){
|
bool ServerLine::buttonMouseClick(int x, int y){
|
||||||
|
@ -136,10 +143,29 @@ bool ServerLine::buttonMouseMove(int x, int y){
|
||||||
return selectButton.mouseMove(x,y);
|
return selectButton.mouseMove(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLine::render(){
|
void ServerLine::render() {
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
|
||||||
renderer.renderButton(&selectButton);
|
bool joinEnabled = (masterServerInfo.getNetworkSlots() > masterServerInfo.getConnectedClients());
|
||||||
|
if(joinEnabled == true) {
|
||||||
|
selectButton.setEnabled(true);
|
||||||
|
selectButton.setVisible(true);
|
||||||
|
|
||||||
|
gameFull.setEnabled(false);
|
||||||
|
gameFull.setEditable(false);
|
||||||
|
|
||||||
|
renderer.renderButton(&selectButton);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
selectButton.setEnabled(false);
|
||||||
|
selectButton.setVisible(false);
|
||||||
|
|
||||||
|
gameFull.setEnabled(true);
|
||||||
|
gameFull.setEditable(true);
|
||||||
|
|
||||||
|
renderer.renderLabel(&gameFull);
|
||||||
|
}
|
||||||
|
|
||||||
//general info:
|
//general info:
|
||||||
renderer.renderLabel(&glestVersionLabel);
|
renderer.renderLabel(&glestVersionLabel);
|
||||||
renderer.renderLabel(&platformLabel);
|
renderer.renderLabel(&platformLabel);
|
||||||
|
@ -209,6 +235,72 @@ MenuStateMasterserver::MenuStateMasterserver(Program *program, MainMenu *mainMen
|
||||||
labelChatUrl.init(150,buttonPos-50);
|
labelChatUrl.init(150,buttonPos-50);
|
||||||
labelChatUrl.setFont(CoreData::getInstance().getMenuFontBig());
|
labelChatUrl.setFont(CoreData::getInstance().getMenuFontBig());
|
||||||
labelChatUrl.setText(lang.get("NoServerVisitChat")+": http://webchat.freenode.net/?channels=glest");
|
labelChatUrl.setText(lang.get("NoServerVisitChat")+": http://webchat.freenode.net/?channels=glest");
|
||||||
|
|
||||||
|
// Titles for current games - START
|
||||||
|
int lineIndex = 0;
|
||||||
|
int lineOffset=25*lineIndex;
|
||||||
|
int i=10;
|
||||||
|
int startOffset=623;
|
||||||
|
|
||||||
|
//general info:
|
||||||
|
i+=10;
|
||||||
|
glestVersionLabel.registerGraphicComponent(containerName,"glestVersionLabel");
|
||||||
|
glestVersionLabel.init(i,startOffset-lineOffset);
|
||||||
|
glestVersionLabel.setText(lang.get("MGVersion"));
|
||||||
|
|
||||||
|
i+=80;
|
||||||
|
platformLabel.registerGraphicComponent(containerName,"platformLabel");
|
||||||
|
platformLabel.init(i,startOffset-lineOffset);
|
||||||
|
platformLabel.setText(lang.get("MGPlatform"));
|
||||||
|
|
||||||
|
i+=50;
|
||||||
|
binaryCompileDateLabel.registerGraphicComponent(containerName,"binaryCompileDateLabel");
|
||||||
|
binaryCompileDateLabel.init(i,startOffset-lineOffset);
|
||||||
|
binaryCompileDateLabel.setText(lang.get("MGBuildDateTime"));
|
||||||
|
|
||||||
|
//game info:
|
||||||
|
i+=130;
|
||||||
|
serverTitleLabel.registerGraphicComponent(containerName,"serverTitleLabel");
|
||||||
|
serverTitleLabel.init(i,startOffset-lineOffset);
|
||||||
|
serverTitleLabel.setText(lang.get("MGGameTitle"));
|
||||||
|
|
||||||
|
i+=160;
|
||||||
|
ipAddressLabel.registerGraphicComponent(containerName,"ipAddressLabel");
|
||||||
|
ipAddressLabel.init(i,startOffset-lineOffset);
|
||||||
|
ipAddressLabel.setText(lang.get("MGGameIP"));
|
||||||
|
|
||||||
|
//game setup info:
|
||||||
|
i+=100;
|
||||||
|
techLabel.registerGraphicComponent(containerName,"techLabel");
|
||||||
|
techLabel.init(i,startOffset-lineOffset);
|
||||||
|
techLabel.setText(lang.get("TechTree"));
|
||||||
|
|
||||||
|
i+=100;
|
||||||
|
mapLabel.registerGraphicComponent(containerName,"mapLabel");
|
||||||
|
mapLabel.init(i,startOffset-lineOffset);
|
||||||
|
mapLabel.setText(lang.get("Map"));
|
||||||
|
|
||||||
|
i+=100;
|
||||||
|
tilesetLabel.registerGraphicComponent(containerName,"tilesetLabel");
|
||||||
|
tilesetLabel.init(i,startOffset-lineOffset);
|
||||||
|
tilesetLabel.setText(lang.get("Tileset"));
|
||||||
|
|
||||||
|
i+=100;
|
||||||
|
activeSlotsLabel.registerGraphicComponent(containerName,"activeSlotsLabel");
|
||||||
|
activeSlotsLabel.init(i,startOffset-lineOffset);
|
||||||
|
activeSlotsLabel.setText(lang.get("MGGameSlots"));
|
||||||
|
|
||||||
|
i+=50;
|
||||||
|
externalConnectPort.registerGraphicComponent(containerName,"externalConnectPort");
|
||||||
|
externalConnectPort.init(i,startOffset-lineOffset);
|
||||||
|
externalConnectPort.setText(lang.get("Port"));
|
||||||
|
|
||||||
|
i+=50;
|
||||||
|
selectButton.registerGraphicComponent(containerName,"selectButton");
|
||||||
|
selectButton.init(i, startOffset-lineOffset);
|
||||||
|
selectButton.setText(lang.get("MGJoinGameSlots"));
|
||||||
|
|
||||||
|
// Titles for current games - END
|
||||||
|
|
||||||
buttonReturn.registerGraphicComponent(containerName,"buttonReturn");
|
buttonReturn.registerGraphicComponent(containerName,"buttonReturn");
|
||||||
buttonReturn.init(50, buttonPos, 150);
|
buttonReturn.init(50, buttonPos, 150);
|
||||||
|
@ -399,20 +491,44 @@ void MenuStateMasterserver::render(){
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
if(mainMessageBox.getEnabled()){
|
if(mainMessageBox.getEnabled()) {
|
||||||
renderer.renderMessageBox(&mainMessageBox);
|
renderer.renderMessageBox(&mainMessageBox);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderer.renderButton(&buttonRefresh);
|
renderer.renderButton(&buttonRefresh);
|
||||||
renderer.renderButton(&buttonReturn);
|
renderer.renderButton(&buttonReturn);
|
||||||
renderer.renderLabel(&labelTitle);
|
|
||||||
renderer.renderLabel(&announcementLabel);
|
renderer.renderLabel(&labelTitle,&GREEN);
|
||||||
|
renderer.renderLabel(&announcementLabel,&YELLOW);
|
||||||
renderer.renderLabel(&versionInfoLabel);
|
renderer.renderLabel(&versionInfoLabel);
|
||||||
|
|
||||||
renderer.renderLabel(&labelAutoRefresh);
|
renderer.renderLabel(&labelAutoRefresh);
|
||||||
renderer.renderLabel(&labelChatUrl);
|
renderer.renderLabel(&labelChatUrl);
|
||||||
renderer.renderButton(&buttonCreateGame);
|
renderer.renderButton(&buttonCreateGame);
|
||||||
renderer.renderListBox(&listBoxAutoRefresh);
|
renderer.renderListBox(&listBoxAutoRefresh);
|
||||||
|
|
||||||
|
// Render titles for server games listed
|
||||||
|
const Vec4f titleLabelColor = CYAN;
|
||||||
|
|
||||||
|
//general info:
|
||||||
|
renderer.renderLabel(&glestVersionLabel,&titleLabelColor);
|
||||||
|
renderer.renderLabel(&platformLabel,&titleLabelColor);
|
||||||
|
renderer.renderLabel(&binaryCompileDateLabel,&titleLabelColor);
|
||||||
|
|
||||||
|
//game info:
|
||||||
|
renderer.renderLabel(&serverTitleLabel,&titleLabelColor);
|
||||||
|
renderer.renderLabel(&ipAddressLabel,&titleLabelColor);
|
||||||
|
|
||||||
|
//game setup info:
|
||||||
|
renderer.renderLabel(&techLabel,&titleLabelColor);
|
||||||
|
renderer.renderLabel(&mapLabel,&titleLabelColor);
|
||||||
|
renderer.renderLabel(&tilesetLabel,&titleLabelColor);
|
||||||
|
renderer.renderLabel(&activeSlotsLabel,&titleLabelColor);
|
||||||
|
renderer.renderLabel(&externalConnectPort,&titleLabelColor);
|
||||||
|
renderer.renderLabel(&selectButton,&titleLabelColor);
|
||||||
|
|
||||||
|
|
||||||
// render console
|
// render console
|
||||||
renderer.renderConsole(&console,false,false);
|
renderer.renderConsole(&console,false,false);
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,10 @@ namespace Glest{ namespace Game{
|
||||||
class ServerLine {
|
class ServerLine {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
MasterServerInfo *masterServerInfo;
|
MasterServerInfo masterServerInfo;
|
||||||
int index;
|
int index;
|
||||||
GraphicButton selectButton;
|
GraphicButton selectButton;
|
||||||
|
GraphicLabel gameFull;
|
||||||
|
|
||||||
//general info:
|
//general info:
|
||||||
GraphicLabel glestVersionLabel;
|
GraphicLabel glestVersionLabel;
|
||||||
|
@ -55,7 +56,7 @@ private:
|
||||||
public:
|
public:
|
||||||
ServerLine( MasterServerInfo *mServerInfo, int lineIndex, const char *containerName);
|
ServerLine( MasterServerInfo *mServerInfo, int lineIndex, const char *containerName);
|
||||||
virtual ~ServerLine();
|
virtual ~ServerLine();
|
||||||
MasterServerInfo *getMasterServerInfo() const {return masterServerInfo;}
|
MasterServerInfo *getMasterServerInfo() {return &masterServerInfo;}
|
||||||
const int getIndex() const {return index;}
|
const int getIndex() const {return index;}
|
||||||
bool buttonMouseClick(int x, int y);
|
bool buttonMouseClick(int x, int y);
|
||||||
bool buttonMouseMove(int x, int y);
|
bool buttonMouseMove(int x, int y);
|
||||||
|
@ -88,6 +89,27 @@ private:
|
||||||
GraphicLabel announcementLabel;
|
GraphicLabel announcementLabel;
|
||||||
GraphicLabel versionInfoLabel;
|
GraphicLabel versionInfoLabel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GraphicLabel glestVersionLabel;
|
||||||
|
GraphicLabel platformLabel;
|
||||||
|
GraphicLabel binaryCompileDateLabel;
|
||||||
|
|
||||||
|
//game info:
|
||||||
|
GraphicLabel serverTitleLabel;
|
||||||
|
GraphicLabel ipAddressLabel;
|
||||||
|
|
||||||
|
//game setup info:
|
||||||
|
GraphicLabel techLabel;
|
||||||
|
GraphicLabel mapLabel;
|
||||||
|
GraphicLabel tilesetLabel;
|
||||||
|
GraphicLabel activeSlotsLabel;
|
||||||
|
|
||||||
|
GraphicLabel externalConnectPort;
|
||||||
|
|
||||||
|
GraphicLabel selectButton;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GraphicMessageBox mainMessageBox;
|
GraphicMessageBox mainMessageBox;
|
||||||
int mainMessageBoxState;
|
int mainMessageBoxState;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "game_util.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -59,11 +59,13 @@ double LAG_CHECK_GRACE_PERIOD = 15;
|
||||||
// badly and we want to give time for them to catch up
|
// badly and we want to give time for them to catch up
|
||||||
double MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE = 2;
|
double MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE = 2;
|
||||||
|
|
||||||
ServerInterface::ServerInterface(){
|
ServerInterface::ServerInterface() {
|
||||||
gameHasBeenInitiated = false;
|
gameHasBeenInitiated = false;
|
||||||
gameSettingsUpdateCount = 0;
|
gameSettingsUpdateCount = 0;
|
||||||
currentFrameCount = 0;
|
currentFrameCount = 0;
|
||||||
gameStartTime = 0;
|
gameStartTime = 0;
|
||||||
|
publishToMasterserverThread = NULL;
|
||||||
|
lastMasterserverHeartbeatTime = 0;
|
||||||
|
|
||||||
enabledThreadedClientCommandBroadcast = Config::getInstance().getBool("EnableThreadedClientCommandBroadcast","false");
|
enabledThreadedClientCommandBroadcast = Config::getInstance().getBool("EnableThreadedClientCommandBroadcast","false");
|
||||||
maxFrameCountLagAllowed = Config::getInstance().getInt("MaxFrameCountLagAllowed",intToStr(maxFrameCountLagAllowed).c_str());
|
maxFrameCountLagAllowed = Config::getInstance().getInt("MaxFrameCountLagAllowed",intToStr(maxFrameCountLagAllowed).c_str());
|
||||||
|
@ -82,7 +84,7 @@ ServerInterface::ServerInterface(){
|
||||||
serverSocket.setBindPort(Config::getInstance().getInt("ServerPort",intToStr(GameConstants::serverPort).c_str()));
|
serverSocket.setBindPort(Config::getInstance().getInt("ServerPort",intToStr(GameConstants::serverPort).c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerInterface::~ServerInterface(){
|
ServerInterface::~ServerInterface() {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
for(int i= 0; i<GameConstants::maxPlayers; ++i){
|
for(int i= 0; i<GameConstants::maxPlayers; ++i){
|
||||||
|
@ -97,6 +99,13 @@ ServerInterface::~ServerInterface(){
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
||||||
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
|
delete publishToMasterserverThread;
|
||||||
|
publishToMasterserverThread = NULL;
|
||||||
|
safeMutex.ReleaseLock();
|
||||||
|
// This triggers a gameOVer message to be sent to the masterserver
|
||||||
|
simpleTask();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +211,7 @@ void ServerInterface::removeSlot(int playerIndex) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionSlot* ServerInterface::getSlot(int playerIndex){
|
ConnectionSlot* ServerInterface::getSlot(int playerIndex) {
|
||||||
return slots[playerIndex];
|
return slots[playerIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,10 +227,10 @@ bool ServerInterface::hasClientConnection() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ServerInterface::getConnectedSlotCount(){
|
int ServerInterface::getConnectedSlotCount() {
|
||||||
int connectedSlotCount= 0;
|
int connectedSlotCount= 0;
|
||||||
|
|
||||||
for(int i= 0; i<GameConstants::maxPlayers; ++i){
|
for(int i= 0; i<GameConstants::maxPlayers; ++i) {
|
||||||
if(slots[i]!= NULL){
|
if(slots[i]!= NULL){
|
||||||
++connectedSlotCount;
|
++connectedSlotCount;
|
||||||
}
|
}
|
||||||
|
@ -870,7 +879,7 @@ bool ServerInterface::shouldDiscardNetworkMessage(NetworkMessageType networkMess
|
||||||
return discard;
|
return discard;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerInterface::waitUntilReady(Checksum* checksum){
|
void ServerInterface::waitUntilReady(Checksum* checksum) {
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s] START\n",__FUNCTION__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s] START\n",__FUNCTION__);
|
||||||
|
|
||||||
|
@ -989,8 +998,7 @@ void ServerInterface::sendTextMessage(const string &text, int teamIndex, bool ec
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerInterface::quitGame(bool userManuallyQuit)
|
void ServerInterface::quitGame(bool userManuallyQuit) {
|
||||||
{
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(userManuallyQuit == true) {
|
if(userManuallyQuit == true) {
|
||||||
|
@ -1041,33 +1049,36 @@ string ServerInterface::getNetworkStatus() {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServerInterface::launchGame(const GameSettings* gameSettings){
|
bool ServerInterface::launchGame(const GameSettings* gameSettings) {
|
||||||
|
|
||||||
bool bOkToStart = true;
|
bool bOkToStart = true;
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
for(int i= 0; i<GameConstants::maxPlayers; ++i)
|
for(int i= 0; i<GameConstants::maxPlayers; ++i) {
|
||||||
{
|
|
||||||
ConnectionSlot *connectionSlot= slots[i];
|
ConnectionSlot *connectionSlot= slots[i];
|
||||||
if(connectionSlot != NULL &&
|
if(connectionSlot != NULL &&
|
||||||
connectionSlot->getAllowDownloadDataSynch() == true &&
|
connectionSlot->getAllowDownloadDataSynch() == true &&
|
||||||
connectionSlot->isConnected())
|
connectionSlot->isConnected()) {
|
||||||
{
|
if(connectionSlot->getNetworkGameDataSynchCheckOk() == false) {
|
||||||
if(connectionSlot->getNetworkGameDataSynchCheckOk() == false)
|
|
||||||
{
|
|
||||||
bOkToStart = false;
|
bOkToStart = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bOkToStart == true)
|
if(bOkToStart == true) {
|
||||||
{
|
|
||||||
serverSocket.stopBroadCastThread();
|
serverSocket.stopBroadCastThread();
|
||||||
|
|
||||||
NetworkMessageLaunch networkMessageLaunch(gameSettings,nmtLaunch);
|
NetworkMessageLaunch networkMessageLaunch(gameSettings,nmtLaunch);
|
||||||
broadcastMessage(&networkMessageLaunch);
|
broadcastMessage(&networkMessageLaunch);
|
||||||
|
|
||||||
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
|
delete publishToMasterserverThread;
|
||||||
|
publishToMasterserverThread = NULL;
|
||||||
|
|
||||||
|
publishToMasterserverThread = new SimpleTaskThread(this,0,25);
|
||||||
|
publishToMasterserverThread->setUniqueID(__FILE__);
|
||||||
|
publishToMasterserverThread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@ -1378,4 +1389,106 @@ int ServerInterface::getHumanPlayerIndex() const {
|
||||||
return gameSettings.getStartLocationIndex(gameSettings.getThisFactionIndex());
|
return gameSettings.getStartLocationIndex(gameSettings.getThisFactionIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::map<string,string> ServerInterface::publishToMasterserver() {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
// The server player counts as 1 for each of these
|
||||||
|
int slotCountUsed=1;
|
||||||
|
int slotCountHumans=1;
|
||||||
|
int slotCountConnectedPlayers=1;
|
||||||
|
|
||||||
|
Config &config= Config::getInstance();
|
||||||
|
//string serverinfo="";
|
||||||
|
std::map<string,string> publishToServerInfo;
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
for(int i= 0; i < GameConstants::maxPlayers; ++i) {
|
||||||
|
if(slots[i] != NULL) {
|
||||||
|
slotCountUsed++;
|
||||||
|
slotCountHumans++;
|
||||||
|
ConnectionSlot* connectionSlot= slots[i];
|
||||||
|
if((connectionSlot!=NULL) && (connectionSlot->isConnected())) {
|
||||||
|
slotCountConnectedPlayers++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//?status=waiting&system=linux&info=titus
|
||||||
|
publishToServerInfo["glestVersion"] = glestVersionString;
|
||||||
|
publishToServerInfo["platform"] = getPlatformNameString();
|
||||||
|
publishToServerInfo["binaryCompileDate"] = getCompileDateTime();
|
||||||
|
|
||||||
|
//game info:
|
||||||
|
publishToServerInfo["serverTitle"] = getHumanPlayerName() + "'s game *IN PROGRESS*";
|
||||||
|
//ip is automatically set
|
||||||
|
|
||||||
|
//game setup info:
|
||||||
|
publishToServerInfo["tech"] = this->getGameSettings()->getTech();
|
||||||
|
publishToServerInfo["map"] = this->getGameSettings()->getMap();
|
||||||
|
publishToServerInfo["tileset"] = this->getGameSettings()->getTileset();
|
||||||
|
publishToServerInfo["activeSlots"] = intToStr(slotCountUsed);
|
||||||
|
publishToServerInfo["networkSlots"] = intToStr(slotCountHumans);
|
||||||
|
publishToServerInfo["connectedClients"] = intToStr(slotCountConnectedPlayers);
|
||||||
|
//string externalport = intToStr(Config::getInstance().getInt("ExternalServerPort",intToStr(Config::getInstance().getInt("ServerPort")).c_str()));
|
||||||
|
string externalport = config.getString("MasterServerExternalPort", "61357");
|
||||||
|
publishToServerInfo["externalconnectport"] = externalport;
|
||||||
|
|
||||||
|
if(publishToMasterserverThread == NULL) {
|
||||||
|
publishToServerInfo["serverTitle"] = getHumanPlayerName() + "'s game *FINISHED*";
|
||||||
|
publishToServerInfo["gameCmd"]= "gameOver";
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
return publishToServerInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerInterface::simpleTask() {
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
|
if(difftime(time(NULL),lastMasterserverHeartbeatTime) >= 30) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
lastMasterserverHeartbeatTime = time(NULL);
|
||||||
|
|
||||||
|
bool isNetworkGame = (this->getGameSettings() != NULL && this->getGameSettings()->isNetworkGame());
|
||||||
|
if(isNetworkGame == true) {
|
||||||
|
//string request = Config::getInstance().getString("Masterserver") + "addServerInfo.php?" + newPublishToServerInfo;
|
||||||
|
string request = Config::getInstance().getString("Masterserver") + "addServerInfo.php?";
|
||||||
|
|
||||||
|
std::map<string,string> newPublishToServerInfo = publishToMasterserver();
|
||||||
|
|
||||||
|
CURL *handle = SystemFlags::initHTTP();
|
||||||
|
for(std::map<string,string>::const_iterator iterMap = newPublishToServerInfo.begin();
|
||||||
|
iterMap != newPublishToServerInfo.end(); iterMap++) {
|
||||||
|
|
||||||
|
request += iterMap->first;
|
||||||
|
request += "=";
|
||||||
|
request += SystemFlags::escapeURL(iterMap->second,handle);
|
||||||
|
request += "&";
|
||||||
|
}
|
||||||
|
|
||||||
|
//printf("the request is:\n%s\n",request.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] the request is:\n%s\n",__FILE__,__FUNCTION__,__LINE__,request.c_str());
|
||||||
|
|
||||||
|
std::string serverInfo = SystemFlags::getHTTP(request,handle);
|
||||||
|
SystemFlags::cleanupHTTP(&handle);
|
||||||
|
|
||||||
|
//printf("the result is:\n'%s'\n",serverInfo.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] the result is:\n'%s'\n",__FILE__,__FUNCTION__,__LINE__,serverInfo.c_str());
|
||||||
|
|
||||||
|
// uncomment to enable router setup check of this server
|
||||||
|
if(EndsWith(serverInfo, "OK") == false) {
|
||||||
|
//showMasterserverError=true;
|
||||||
|
//masterServererErrorToShow = (serverInfo != "" ? serverInfo : "No Reply");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Glest{ namespace Game{
|
||||||
// class ServerInterface
|
// class ServerInterface
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
class ServerInterface: public GameNetworkInterface, public ConnectionSlotCallbackInterface {
|
class ServerInterface: public GameNetworkInterface, public ConnectionSlotCallbackInterface, public SimpleTaskCallbackInterface {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConnectionSlot* slots[GameConstants::maxPlayers];
|
ConnectionSlot* slots[GameConstants::maxPlayers];
|
||||||
|
@ -42,6 +42,10 @@ private:
|
||||||
|
|
||||||
time_t gameStartTime;
|
time_t gameStartTime;
|
||||||
|
|
||||||
|
SimpleTaskThread *publishToMasterserverThread;
|
||||||
|
Mutex masterServerThreadAccessor;
|
||||||
|
time_t lastMasterserverHeartbeatTime;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ServerInterface();
|
ServerInterface();
|
||||||
virtual ~ServerInterface();
|
virtual ~ServerInterface();
|
||||||
|
@ -103,6 +107,8 @@ public:
|
||||||
|
|
||||||
Mutex * getServerSynchAccessor() { return &serverSynchAccessor; }
|
Mutex * getServerSynchAccessor() { return &serverSynchAccessor; }
|
||||||
|
|
||||||
|
virtual void simpleTask();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void broadcastMessage(const NetworkMessage* networkMessage, int excludeSlot= -1);
|
void broadcastMessage(const NetworkMessage* networkMessage, int excludeSlot= -1);
|
||||||
|
@ -110,6 +116,8 @@ private:
|
||||||
bool shouldDiscardNetworkMessage(NetworkMessageType networkMessageType,ConnectionSlot* connectionSlot);
|
bool shouldDiscardNetworkMessage(NetworkMessageType networkMessageType,ConnectionSlot* connectionSlot);
|
||||||
void updateSlot(ConnectionSlotEvent *event);
|
void updateSlot(ConnectionSlotEvent *event);
|
||||||
void validateConnectedClients();
|
void validateConnectedClients();
|
||||||
|
|
||||||
|
std::map<string,string> publishToMasterserver();
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
|
@ -44,6 +44,11 @@
|
||||||
$activeSlots = (int) clean_str( $_GET['activeSlots'] );
|
$activeSlots = (int) clean_str( $_GET['activeSlots'] );
|
||||||
$networkSlots = (int) clean_str( $_GET['networkSlots'] );
|
$networkSlots = (int) clean_str( $_GET['networkSlots'] );
|
||||||
$connectedClients = (int) clean_str( $_GET['connectedClients'] );
|
$connectedClients = (int) clean_str( $_GET['connectedClients'] );
|
||||||
|
|
||||||
|
$gameCmd = "";
|
||||||
|
if(isset($_GET["gameCmd"])) {
|
||||||
|
$gameCmd = (string) clean_str( $_GET['gameCmd'] );
|
||||||
|
}
|
||||||
|
|
||||||
define( 'DB_LINK', db_connect() );
|
define( 'DB_LINK', db_connect() );
|
||||||
|
|
||||||
|
@ -57,12 +62,12 @@
|
||||||
// Representation starts here (but it should really be starting much later, there is way too much logic behind this point)
|
// Representation starts here (but it should really be starting much later, there is way too much logic behind this point)
|
||||||
header( 'Content-Type: text/plain; charset=utf-8' );
|
header( 'Content-Type: text/plain; charset=utf-8' );
|
||||||
|
|
||||||
if ( $connectedClients == $networkSlots ) // game servers' slots are all full
|
if ( ($glestVersion <= "3.3.7.2" && $connectedClients == $networkSlots) || $gameCmd == "gameOver") // game servers' slots are all full
|
||||||
{ // delete server; no checks are performed
|
{ // delete server; no checks are performed
|
||||||
mysql_db_query( MYSQL_DATABASE, 'DELETE FROM glestserver WHERE ip=\'' . mysql_real_escape_string( $remote_ip ) . '\' && externalServerPort=\'' . mysql_real_escape_string( $service_port ) . '\';' );
|
mysql_db_query( MYSQL_DATABASE, 'DELETE FROM glestserver WHERE ip=\'' . mysql_real_escape_string( $remote_ip ) . '\' && externalServerPort=\'' . mysql_real_escape_string( $service_port ) . '\';' );
|
||||||
echo 'OK' ;
|
echo 'OK' ;
|
||||||
}
|
}
|
||||||
else if ( $remote_ip == $server[0] && $service_port == $server[1] ) // this server is contained in the database
|
else if ( $remote_ip == $server[0] && $service_port == $server[1] ) // this server is contained in the database
|
||||||
{ // update database info on this game server; no checks are performed
|
{ // update database info on this game server; no checks are performed
|
||||||
mysql_db_query( MYSQL_DATABASE, 'UPDATE glestserver SET ' .
|
mysql_db_query( MYSQL_DATABASE, 'UPDATE glestserver SET ' .
|
||||||
'glestVersion=\'' . mysql_real_escape_string( $glestVersion ) . '\', ' .
|
'glestVersion=\'' . mysql_real_escape_string( $glestVersion ) . '\', ' .
|
||||||
|
|
Loading…
Reference in New Issue