- fixed local chat echo in clientinterface so that messages intended to be shown locally are properly displayed in the console

- added a success / failure message for downloaded map attempts
This commit is contained in:
Mark Vejvoda 2010-12-30 20:48:39 +00:00
parent 973b546b04
commit c59807c4cf
2 changed files with 20 additions and 17 deletions

View File

@ -86,7 +86,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
mainMessageBoxState=0; mainMessageBoxState=0;
ftpMessageBox.registerGraphicComponent(containerName,"ftpMessageBox"); ftpMessageBox.registerGraphicComponent(containerName,"ftpMessageBox");
ftpMessageBox.init(lang.get("Yes"),lang.get("no")); ftpMessageBox.init(lang.get("Yes"),lang.get("No"));
ftpMessageBox.setEnabled(false); ftpMessageBox.setEnabled(false);
NetworkManager &networkManager= NetworkManager::getInstance(); NetworkManager &networkManager= NetworkManager::getInstance();
@ -1184,13 +1184,6 @@ void MenuStateConnectedGame::update() {
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis()); if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start(); if(chrono.getMillis() > 0) chrono.start();
//call the chat manager
chatManager.updateNetwork();
//console732
console.update();
//intro //intro
if(clientInterface->getIntroDone()) { if(clientInterface->getIntroDone()) {
labelInfo.setText(lang.get("WaitingHost")); labelInfo.setText(lang.get("WaitingHost"));
@ -1215,6 +1208,13 @@ void MenuStateConnectedGame::update() {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
} }
} }
//call the chat manager
chatManager.updateNetwork();
//console732
console.update();
} }
catch(const runtime_error &ex) { catch(const runtime_error &ex) {
char szBuf[1024]=""; char szBuf[1024]="";
@ -1407,7 +1407,7 @@ void MenuStateConnectedGame::keyUp(char key) {
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys)); Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
if(chatManager.getEditEnabled()){ if(chatManager.getEditEnabled()) {
//send key to the chat manager //send key to the chat manager
chatManager.keyUp(key); chatManager.keyUp(key);
} }
@ -1418,8 +1418,6 @@ void MenuStateConnectedGame::keyUp(char key) {
} }
void MenuStateConnectedGame::setActiveInputLabel(GraphicLabel *newLable) { void MenuStateConnectedGame::setActiveInputLabel(GraphicLabel *newLable) {
if(newLable != NULL) { if(newLable != NULL) {
string text= newLable->getText(); string text= newLable->getText();
size_t found = text.find_last_of("_"); size_t found = text.find_last_of("_");
@ -1638,15 +1636,20 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string mapFilename, FTP_Cli
getMissingMapFromFTPServerInProgress = false; getMissingMapFromFTPServerInProgress = false;
printf("Got FTP Callback for [%s] result = %d\n",mapFilename.c_str(),result); printf("Got FTP Callback for [%s] result = %d\n",mapFilename.c_str(),result);
if(result == ftp_crt_SUCCESS) { NetworkManager &networkManager= NetworkManager::getInstance();
NetworkManager &networkManager= NetworkManager::getInstance(); ClientInterface* clientInterface= networkManager.getClientInterface();
ClientInterface* clientInterface= networkManager.getClientInterface(); const GameSettings *gameSettings = clientInterface->getGameSettings();
const GameSettings *gameSettings = clientInterface->getGameSettings();
if(result == ftp_crt_SUCCESS) {
char szMsg[1024]=""; char szMsg[1024]="";
sprintf(szMsg,"Player: %s SUCCESSFULLY downloaded the map: %s",getHumanPlayerName().c_str(),gameSettings->getMap().c_str()); sprintf(szMsg,"Player: %s SUCCESSFULLY downloaded the map: %s",getHumanPlayerName().c_str(),gameSettings->getMap().c_str());
clientInterface->sendTextMessage(szMsg,-1, true); clientInterface->sendTextMessage(szMsg,-1, true);
} }
else {
char szMsg[1024]="";
sprintf(szMsg,"Player: %s FAILED to download the map: %s",getHumanPlayerName().c_str(),gameSettings->getMap().c_str());
clientInterface->sendTextMessage(szMsg,-1, true);
}
} }
}}//end namespace }}//end namespace

View File

@ -144,7 +144,7 @@ void ClientInterface::update() {
} }
//clear chat variables //clear chat variables
clearChatInfo(); //!!!clearChatInfo();
} }
std::string ClientInterface::getServerIpAddress() { std::string ClientInterface::getServerIpAddress() {
@ -154,7 +154,7 @@ std::string ClientInterface::getServerIpAddress() {
void ClientInterface::updateLobby() { void ClientInterface::updateLobby() {
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//clear chat variables //clear chat variables
clearChatInfo(); //!!!clearChatInfo();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
NetworkMessageType networkMessageType = getNextMessageType(true); NetworkMessageType networkMessageType = getNextMessageType(true);