- added new strings to language file

This commit is contained in:
Mark Vejvoda
2011-09-21 08:00:00 +00:00
parent 7d53df698a
commit d52924f214
3 changed files with 65 additions and 17 deletions

View File

@@ -696,9 +696,20 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
world->setThisTeamIndex(newTeam); world->setThisTeamIndex(newTeam);
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface(); GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
if(gameNetworkInterface != NULL) { if(gameNetworkInterface != NULL) {
char szMsg[1024]="";
sprintf(szMsg,"Player %s switched from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,newTeam); Lang &lang= Lang::getInstance();
gameNetworkInterface->sendTextMessage(szMsg,-1, true, ""); const vector<string> languageList = settings->getUniqueNetworkPlayerLanguages();
for(unsigned int i = 0; i < languageList.size(); ++i) {
char szMsg[1024]="";
if(lang.hasString("PlayerSwitchedTeam",languageList[i]) == true) {
sprintf(szMsg,lang.get("PlayerSwitchedTeam",languageList[i]).c_str(),settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,newTeam);
}
else {
sprintf(szMsg,"Player %s switched from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,newTeam);
}
bool localEcho = lang.isLanguageLocal(languageList[i]);
gameNetworkInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
}
} }
} }
} }
@@ -774,9 +785,20 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
world->setThisTeamIndex(vote->newTeam); world->setThisTeamIndex(vote->newTeam);
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface(); GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
if(gameNetworkInterface != NULL) { if(gameNetworkInterface != NULL) {
char szMsg[1024]="";
sprintf(szMsg,"Player %s switched from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam); Lang &lang= Lang::getInstance();
gameNetworkInterface->sendTextMessage(szMsg,-1, true, ""); const vector<string> languageList = settings->getUniqueNetworkPlayerLanguages();
for(unsigned int i = 0; i < languageList.size(); ++i) {
char szMsg[1024]="";
if(lang.hasString("PlayerSwitchedTeam",languageList[i]) == true) {
sprintf(szMsg,lang.get("PlayerSwitchedTeam",languageList[i]).c_str(),settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
}
else {
sprintf(szMsg,"Player %s switched from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
}
bool localEcho = lang.isLanguageLocal(languageList[i]);
gameNetworkInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
}
} }
} }
} }
@@ -788,9 +810,20 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface(); GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
if(gameNetworkInterface != NULL) { if(gameNetworkInterface != NULL) {
char szMsg[1024]="";
sprintf(szMsg,"Player %s was denied the request to switch from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam); Lang &lang= Lang::getInstance();
gameNetworkInterface->sendTextMessage(szMsg,-1, true, ""); const vector<string> languageList = settings->getUniqueNetworkPlayerLanguages();
for(unsigned int i = 0; i < languageList.size(); ++i) {
char szMsg[1024]="";
if(lang.hasString("PlayerSwitchedTeamDenied",languageList[i]) == true) {
sprintf(szMsg,lang.get("PlayerSwitchedTeamDenied",languageList[i]).c_str(),settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
}
else {
sprintf(szMsg,"Player %s was denied the request to switch from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
}
bool localEcho = lang.isLanguageLocal(languageList[i]);
gameNetworkInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
}
} }
} }
} }

View File

@@ -938,10 +938,17 @@ void Game::update() {
if(world.getThisFaction()->getFirstSwitchTeamVote() != NULL) { if(world.getThisFaction()->getFirstSwitchTeamVote() != NULL) {
const SwitchTeamVote *vote = world.getThisFaction()->getFirstSwitchTeamVote(); const SwitchTeamVote *vote = world.getThisFaction()->getFirstSwitchTeamVote();
GameSettings *settings = world.getGameSettingsPtr(); GameSettings *settings = world.getGameSettingsPtr();
char szBuf[1024]="";
sprintf(szBuf,"Allow player [%s] to join your team\n(changing from team# %d to team# %d)?",settings->getNetworkPlayerName(vote->factionIndex).c_str(),vote->oldTeam,vote->newTeam);
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
char szBuf[1024]="";
if(lang.hasString("AllowPlayerJoinTeam") == true) {
sprintf(szBuf,lang.get("AllowPlayerJoinTeam").c_str(),settings->getNetworkPlayerName(vote->factionIndex).c_str(),vote->oldTeam,vote->newTeam);
}
else {
sprintf(szBuf,"Allow player [%s] to join your team\n(changing from team# %d to team# %d)?",settings->getNetworkPlayerName(vote->factionIndex).c_str(),vote->oldTeam,vote->newTeam);
}
switchTeamConfirmMessageBox.setText(szBuf); switchTeamConfirmMessageBox.setText(szBuf);
switchTeamConfirmMessageBox.init(lang.get("Yes"), lang.get("No")); switchTeamConfirmMessageBox.init(lang.get("Yes"), lang.get("No"));
switchTeamConfirmMessageBox.setEnabled(true); switchTeamConfirmMessageBox.setEnabled(true);
@@ -1260,6 +1267,8 @@ void Game::mouseDownLeft(int x, int y) {
showMessageBox(Lang::getInstance().get("ExitGame?"), "", true); showMessageBox(Lang::getInstance().get("ExitGame?"), "", true);
} }
else if(result.first == joinTeamPopupMenuIndex) { else if(result.first == joinTeamPopupMenuIndex) {
Lang &lang= Lang::getInstance();
switchTeamIndexMap.clear(); switchTeamIndexMap.clear();
std::map<int,bool> uniqueTeamNumbersUsed; std::map<int,bool> uniqueTeamNumbersUsed;
std::vector<string> menuItems; std::vector<string> menuItems;
@@ -1272,23 +1281,29 @@ void Game::mouseDownLeft(int x, int y) {
if(world.getThisFaction()->getIndex() != faction->getIndex() && if(world.getThisFaction()->getIndex() != faction->getIndex() &&
world.getThisFaction()->getTeam() != faction->getTeam()) { world.getThisFaction()->getTeam() != faction->getTeam()) {
char szBuf[1024]=""; char szBuf[1024]="";
sprintf(szBuf,"Join player #%d - %s on Team: %d",faction->getIndex(),this->gameSettings.getNetworkPlayerName(i).c_str(),faction->getTeam()); if(lang.hasString("JoinPlayerTeam") == true) {
sprintf(szBuf,lang.get("JoinPlayerTeam").c_str(),faction->getIndex(),this->gameSettings.getNetworkPlayerName(i).c_str(),faction->getTeam());
}
else {
sprintf(szBuf,"Join player #%d - %s on Team: %d",faction->getIndex(),this->gameSettings.getNetworkPlayerName(i).c_str(),faction->getTeam());
}
menuItems.push_back(szBuf); menuItems.push_back(szBuf);
switchTeamIndexMap[menuItems.size()-1] = faction->getTeam(); switchTeamIndexMap[menuItems.size()-1] = faction->getTeam();
} }
} }
if(uniqueTeamNumbersUsed.size() < 8) { if(uniqueTeamNumbersUsed.size() < 8) {
menuItems.push_back("Create New Team"); menuItems.push_back(lang.get("CreateNewTeam"));
switchTeamIndexMap[menuItems.size()-1] = CREATE_NEW_TEAM; switchTeamIndexMap[menuItems.size()-1] = CREATE_NEW_TEAM;
} }
menuItems.push_back("Cancel"); menuItems.push_back(lang.get("Cancel"));
switchTeamIndexMap[menuItems.size()-1] = CANCEL_SWITCH_TEAM; switchTeamIndexMap[menuItems.size()-1] = CANCEL_SWITCH_TEAM;
popupMenuSwitchTeams.setW(400); popupMenuSwitchTeams.setW(400);
popupMenuSwitchTeams.setH(400); popupMenuSwitchTeams.setH(400);
popupMenuSwitchTeams.init("Switch Teams",menuItems); popupMenuSwitchTeams.init(lang.get("SwitchTeams"),menuItems);
popupMenuSwitchTeams.setEnabled(true); popupMenuSwitchTeams.setEnabled(true);
popupMenuSwitchTeams.setVisible(true); popupMenuSwitchTeams.setVisible(true);
} }

View File

@@ -100,7 +100,7 @@ void MenuStateRoot::mouseClick(int x, int y, MouseButton mouseButton){
if(popupMenu.mouseClick(x, y)) { if(popupMenu.mouseClick(x, y)) {
std::pair<int,string> result = popupMenu.mouseClickedMenuItem(x, y); std::pair<int,string> result = popupMenu.mouseClickedMenuItem(x, y);
printf("In popup callback menuItemSelected [%s] menuIndexSelected = %d\n",result.second.c_str(),result.first); //printf("In popup callback menuItemSelected [%s] menuIndexSelected = %d\n",result.second.c_str(),result.first);
} }
else if(mainMessageBox.getEnabled() == false && buttonNewGame.mouseClick(x, y)){ else if(mainMessageBox.getEnabled() == false && buttonNewGame.mouseClick(x, y)){
soundRenderer.playFx(coreData.getClickSoundB()); soundRenderer.playFx(coreData.getClickSoundB());