- Fixed a bug preventing the AI profile from being correctly restored between matches in a duel.

This commit is contained in:
Agetian
2013-04-10 05:55:43 +00:00
parent a731f7d630
commit 3c5701eab5

View File

@@ -147,12 +147,13 @@ public class MatchController {
continue; continue;
String currentAiProfile = Singletons.getModel().getPreferences().getPref(FPref.UI_CURRENT_AI_PROFILE); String currentAiProfile = Singletons.getModel().getPreferences().getPref(FPref.UI_CURRENT_AI_PROFILE);
String lastProfileChosen = this.getPlayedGames().isEmpty() ? currentAiProfile : p.getLobbyPlayer().getAiProfile();
// TODO: implement specific AI profiles for quest mode. // TODO: implement specific AI profiles for quest mode.
boolean wantRandomProfile = currentAiProfile.equals(AiProfileUtil.AI_PROFILE_RANDOM_DUEL) boolean wantRandomProfile = currentAiProfile.equals(AiProfileUtil.AI_PROFILE_RANDOM_DUEL)
|| (this.getPlayedGames().isEmpty() && currentAiProfile.equals(AiProfileUtil.AI_PROFILE_RANDOM_MATCH)); || (this.getPlayedGames().isEmpty() && currentAiProfile.equals(AiProfileUtil.AI_PROFILE_RANDOM_MATCH));
String profileToSet = wantRandomProfile ? AiProfileUtil.getRandomProfile() : currentAiProfile; String profileToSet = wantRandomProfile ? AiProfileUtil.getRandomProfile() : lastProfileChosen;
p.getLobbyPlayer().setAiProfile(profileToSet); p.getLobbyPlayer().setAiProfile(profileToSet);
System.out.println(String.format("AI profile %s was chosen for the lobby player %s.", p.getLobbyPlayer().getAiProfile(), p.getLobbyPlayer().getName())); System.out.println(String.format("AI profile %s was chosen for the lobby player %s.", p.getLobbyPlayer().getAiProfile(), p.getLobbyPlayer().getName()));