Skip to content
Snippets Groups Projects
Commit 3eeec671 authored by ODL guest ODL guest's avatar ODL guest ODL guest
Browse files

Merge branch 'master' of git.fossgalaxy.com:ce810/ggj2017

parents d414b04e 7977f3f8
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ import javax.swing.JFrame; ...@@ -14,6 +14,7 @@ import javax.swing.JFrame;
import javax.swing.JToolBar; import javax.swing.JToolBar;
import com.fossgalaxy.games.rts.App; import com.fossgalaxy.games.rts.App;
import com.fossgalaxy.games.rts.GameDef;
import com.fossgalaxy.games.rts.GameState; import com.fossgalaxy.games.rts.GameState;
import com.fossgalaxy.games.rts.ai.Controller; import com.fossgalaxy.games.rts.ai.Controller;
import com.fossgalaxy.games.rts.entity.Entity; import com.fossgalaxy.games.rts.entity.Entity;
...@@ -21,6 +22,7 @@ import com.fossgalaxy.games.rts.entity.EntityType; ...@@ -21,6 +22,7 @@ import com.fossgalaxy.games.rts.entity.EntityType;
import com.fossgalaxy.games.rts.io.SettingsIO; import com.fossgalaxy.games.rts.io.SettingsIO;
import com.fossgalaxy.games.rts.order.Order; import com.fossgalaxy.games.rts.order.Order;
import com.fossgalaxy.games.rts.order.OrderProcessor; import com.fossgalaxy.games.rts.order.OrderProcessor;
import com.fossgalaxy.games.rts.rules.Rule;
import com.fossgalaxy.games.rts.ui.GameAction; import com.fossgalaxy.games.rts.ui.GameAction;
import com.fossgalaxy.games.rts.ui.GameModel; import com.fossgalaxy.games.rts.ui.GameModel;
import com.fossgalaxy.games.rts.ui.GameView; import com.fossgalaxy.games.rts.ui.GameView;
...@@ -40,6 +42,8 @@ public class JamApp ...@@ -40,6 +42,8 @@ public class JamApp
//create the initial game state //create the initial game state
SettingsIO io = new SettingsIO(); SettingsIO io = new SettingsIO();
GameState state = io.buildGame("map.json"); GameState state = io.buildGame("map.json");
GameDef def = io.getGameDef();
//create the players //create the players
//TODO clone, without it all moves WILL be applied twice. //TODO clone, without it all moves WILL be applied twice.
...@@ -53,6 +57,10 @@ public class JamApp ...@@ -53,6 +57,10 @@ public class JamApp
//create the thing that's doing the turn tracking. //create the thing that's doing the turn tracking.
OrderProcessor processor = new OrderProcessor(state, 2); OrderProcessor processor = new OrderProcessor(state, 2);
int MAX_TURNS = 100; int MAX_TURNS = 100;
for (Rule rule : def.getRules()) {
processor.addRule(rule);
}
//turn loop //turn loop
//TODO this might be better inside the turn processor? //TODO this might be better inside the turn processor?
...@@ -69,7 +77,13 @@ public class JamApp ...@@ -69,7 +77,13 @@ public class JamApp
processor.doOrderBulk(orders); processor.doOrderBulk(orders);
processor.finishTurn(); processor.finishTurn();
if (processor.getWinner() != Rule.NO_WINNER) {
break;
}
} }
System.out.println("Game over, player won: "+processor.getWinner());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment