hotfixes - so we can at least run it #9

Merged
lgc merged 3 commits from hotfixes into main 2024-11-27 12:01:15 +00:00
1 changed files with 9 additions and 2 deletions
Showing only changes of commit 11c7dda19b - Show all commits

View File

@ -7,8 +7,15 @@ public class GameController {
public void startLocalGame(Class<? extends LocalPlayer> localPlayerClass, Class<? extends AiPlayer> enemyClass, int size) throws InstantiationException, IllegalAccessException { public void startLocalGame(Class<? extends LocalPlayer> localPlayerClass, Class<? extends AiPlayer> enemyClass, int size) throws InstantiationException, IllegalAccessException {
LocalPlayer localPlayer = localPlayerClass.newInstance(); LocalPlayer localPlayer;
AiPlayer aiPlayer = enemyClass.newInstance(); AiPlayer aiPlayer;
try {
localPlayer = localPlayerClass.getDeclaredConstructor().newInstance();
aiPlayer = enemyClass.getDeclaredConstructor().newInstance();
} catch (Exception e) {
e.printStackTrace();
return;
}
localPlayer.setEnemy(aiPlayer); localPlayer.setEnemy(aiPlayer);
aiPlayer.setEnemy(localPlayer); aiPlayer.setEnemy(localPlayer);
} }