MCPcopy Create free account
hub / github.com/catabriga/graphwar / startGameMessage

Method startGameMessage

src/Graphwar/GameData.java:782–853  ·  view source on GitHub ↗
(String[] info)

Source from the content-addressed store, hash-verified

780 }
781
782 private void startGameMessage(String[] info) throws Exception
783 {
784 graphwar.getGlobalClient().hideRoom();
785
786 stopComputers();
787
788 this.gameState = Constants.GAME;
789
790 this.drawingFunction = false;
791 this.exploding = false;
792
793 int numCircles = Integer.parseInt(info[1]);
794
795 int[] circles = new int[numCircles*3];
796
797 for(int i=0; i<numCircles*3; i++)
798 {
799 circles[i] = Integer.parseInt(info[2+i]);
800 }
801
802 obstacle = new Obstacle(numCircles, circles);
803
804 ListIterator<Player> itr = players.listIterator();
805
806 int i = 3*numCircles+2; // Index of first soldier coordinate
807 while(itr.hasNext())
808 {
809 Player player = itr.next();
810
811 int numSoldiers = player.getNumSoldiers();
812
813 for(int s=0; s<numSoldiers; s++)
814 {
815 int x = Integer.parseInt(info[i]);
816 int y = Integer.parseInt(info[i+1]);
817 i += 2;
818
819 player.startSoldier(s, x, y);
820 }
821
822 player.restartTurn();
823 }
824
825 int startPlayer = Math.abs(Integer.parseInt(info[i]));
826
827 startPlayer = startPlayer%players.size();
828
829 currentTurn = startPlayer;
830
831 timeTurnStarted = System.currentTimeMillis();
832
833 Player currentPlayer = players.get(currentTurn);
834 if(currentPlayer.isLocalPlayer())
835 {
836 if(currentPlayer instanceof ComputerPlayer)
837 {
838 ((ComputerPlayer) currentPlayer).thinkFunction();
839 }

Callers 1

handleMessageMethod · 0.95

Calls 14

stopComputersMethod · 0.95
getNumSoldiersMethod · 0.95
startSoldierMethod · 0.95
restartTurnMethod · 0.95
isLocalPlayerMethod · 0.95
getGlobalClientMethod · 0.80
thinkFunctionMethod · 0.80
setScreenMethod · 0.80
getUIMethod · 0.80
refreshFunctionMethod · 0.80
getScreenMethod · 0.80
refreshBackMethod · 0.80

Tested by

no test coverage detected