mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 19:52:25 +01:00
- bugfix for playername index offset on client
This commit is contained in:
parent
54ce27d19c
commit
ae010f85ab
@ -1021,6 +1021,7 @@ void MenuStateConnectedGame::update() {
|
||||
//needToSetChangedGameSettings = false;
|
||||
//lastSetChangedGameSettings = time(NULL);
|
||||
clientInterface->sendSwitchSetupRequest("",clientInterface->getPlayerIndex(),-1,-1,getHumanPlayerName(),switchSetupRequestFlagType);
|
||||
|
||||
switchSetupRequestFlagType=ssrft_None;
|
||||
}
|
||||
|
||||
@ -1262,7 +1263,7 @@ void MenuStateConnectedGame::keyUp(char key) {
|
||||
|
||||
void MenuStateConnectedGame::setActiveInputLabel(GraphicLabel *newLable) {
|
||||
|
||||
/*
|
||||
|
||||
if(newLable != NULL) {
|
||||
string text= newLable->getText();
|
||||
size_t found = text.find_last_of("_");
|
||||
@ -1280,13 +1281,13 @@ void MenuStateConnectedGame::setActiveInputLabel(GraphicLabel *newLable) {
|
||||
activeInputLabel->setText(text);
|
||||
}
|
||||
activeInputLabel = newLable;
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
string MenuStateConnectedGame::getHumanPlayerName() {
|
||||
string result = defaultPlayerName;
|
||||
|
||||
/*
|
||||
|
||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||
ClientInterface* clientInterface= networkManager.getClientInterface();
|
||||
for(int j=0; j<GameConstants::maxPlayers; ++j) {
|
||||
@ -1305,7 +1306,7 @@ string MenuStateConnectedGame::getHumanPlayerName() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2406,7 +2406,7 @@ string MenuStateCustomGame::getCurrentMapFile(){
|
||||
}
|
||||
|
||||
void MenuStateCustomGame::setActiveInputLabel(GraphicLabel *newLable) {
|
||||
/*
|
||||
|
||||
if(newLable != NULL) {
|
||||
string text= newLable->getText();
|
||||
size_t found = text.find_last_of("_");
|
||||
@ -2424,7 +2424,7 @@ void MenuStateCustomGame::setActiveInputLabel(GraphicLabel *newLable) {
|
||||
activeInputLabel->setText(text);
|
||||
}
|
||||
activeInputLabel = newLable;
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
string MenuStateCustomGame::getHumanPlayerName(int index) {
|
||||
@ -2433,7 +2433,7 @@ string MenuStateCustomGame::getHumanPlayerName(int index) {
|
||||
//printf("\nIn [%s::%s Line: %d] index = %d\n",__FILE__,__FUNCTION__,__LINE__,index);
|
||||
//fflush(stdout);
|
||||
|
||||
/*
|
||||
|
||||
if(index < 0) {
|
||||
for(int j = 0; j < GameConstants::maxPlayers; ++j) {
|
||||
if(listBoxControls[j].getSelectedItemIndex() >= 0) {
|
||||
@ -2461,7 +2461,7 @@ string MenuStateCustomGame::getHumanPlayerName(int index) {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ void ClientInterface::updateLobby() {
|
||||
playerIndex= networkMessageIntro.getPlayerIndex();
|
||||
serverName= networkMessageIntro.getName();
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex);
|
||||
|
||||
//check consistency
|
||||
if(networkMessageIntro.getVersionString() != getNetworkVersionString()) {
|
||||
@ -471,7 +471,7 @@ void ClientInterface::updateLobby() {
|
||||
//set the faction index
|
||||
if(gameSettings.getStartLocationIndex(i) == playerIndex) {
|
||||
gameSettings.setThisFactionIndex(i);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] gameSettings.getThisFactionIndex(i) = %d, playerIndex = %d, i = %d\n",__FILE__,__FUNCTION__,__LINE__,gameSettings.getThisFactionIndex(),playerIndex,i);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -487,9 +487,10 @@ void ClientInterface::updateLobby() {
|
||||
case nmtPlayerIndexMessage:
|
||||
{
|
||||
PlayerIndexMessage playerIndexMessage(-1);
|
||||
if(receiveMessage(&playerIndexMessage))
|
||||
{
|
||||
if(receiveMessage(&playerIndexMessage)) {
|
||||
playerIndex= playerIndexMessage.getPlayerIndex();
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got nmtPlayerIndexMessage, playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -791,7 +792,11 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||
}
|
||||
|
||||
void ClientInterface::sendTextMessage(const string &text, int teamIndex, bool echoLocal){
|
||||
NetworkMessageText networkMessageText(text, getHumanPlayerName(), teamIndex);
|
||||
|
||||
string humanPlayerName = getHumanPlayerName();
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] humanPlayerName = [%s] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,humanPlayerName.c_str(),playerIndex);
|
||||
|
||||
NetworkMessageText networkMessageText(text, humanPlayerName, teamIndex);
|
||||
sendMessage(&networkMessageText);
|
||||
|
||||
if(echoLocal == true) {
|
||||
@ -1015,9 +1020,9 @@ bool ClientInterface::shouldDiscardNetworkMessage(NetworkMessageType networkMess
|
||||
string ClientInterface::getHumanPlayerName(int index) {
|
||||
string result = Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str());
|
||||
|
||||
if(index >= 0 || playerIndex >= 0) {
|
||||
if(index >= 0 || playerIndex > 0) {
|
||||
if(index < 0) {
|
||||
index = playerIndex;
|
||||
index = playerIndex-1;
|
||||
}
|
||||
if(gameSettings.getNetworkPlayerName(index) != "") {
|
||||
result = gameSettings.getNetworkPlayerName(index);
|
||||
|
Loading…
x
Reference in New Issue
Block a user