@@ -98,6 +98,14 @@ public GameWorld(LiveMap gm, RobotControlProvider cp, GameMaker.MatchMaker match
9898 // Write match header at beginning of match
9999 this .matchMaker .makeMatchHeader (this .gameMap );
100100
101+ this .allRuinsByLoc = gm .getRuinArray ();
102+ this .allRuins = new ArrayList <MapLocation >();
103+ for (int i = 0 ; i < numSquares ; i ++){
104+ if (this .allRuinsByLoc [i ]){
105+ this .allRuins .add (indexToLocation (i ));
106+ }
107+ }
108+
101109 this .patternArray = gm .getPatternArray ();
102110 this .resourcePatternCenters = new ArrayList <MapLocation >();
103111 this .resourcePatternCentersByLoc = new Team [numSquares ];
@@ -107,21 +115,11 @@ public GameWorld(LiveMap gm, RobotControlProvider cp, GameMaker.MatchMaker match
107115 setPaint (indexToLocation (i ), initialPaint [i ]);
108116 }
109117
110- this .allRuinsByLoc = gm .getRuinArray ();
111- this .allRuins = new ArrayList <MapLocation >();
112- for (int i = 0 ; i < numSquares ; i ++){
113- if (this .allRuinsByLoc [i ]){
114- this .allRuins .add (indexToLocation (i ));
115- }
116- }
117118
118- for (MapLocation ruin : this .allRuins ){
119- this .allRuinsByLoc [locationToIndex (ruin )] = true ;
120- }
121119
122120 RobotInfo [] initialBodies = gm .getInitialBodies ();
123121 this .towerLocations = new ArrayList <MapLocation >();
124- this .towersByLoc = new Team [numSquares ]; //idk if both of these are used but I instantiated for now
122+ this .towersByLoc = new Team [numSquares ];
125123 for (int i = 0 ; i < numSquares ; i ++){
126124 towersByLoc [i ] = Team .NEUTRAL ;
127125 }
@@ -407,6 +405,7 @@ public boolean getWall(MapLocation loc) {
407405 }
408406
409407 public void setPaint (MapLocation loc , int paint ) {
408+ if (!isPaintable (loc )) return ;
410409 if (teamFromPaint (this .colorLocations [locationToIndex (loc )]) != Team .NEUTRAL ){
411410 this .getTeamInfo ().addPaintedSquares (-1 , teamFromPaint (this .colorLocations [locationToIndex (loc )]));
412411 }
@@ -432,6 +431,7 @@ public int getMarker(Team team, MapLocation loc) {
432431 }
433432
434433 public void setMarker (Team team , MapLocation loc , int marker ) {
434+ if (!isPaintable (loc )) return ;
435435 if (marker == 0 ){
436436 this .matchMaker .addUnmarkAction (loc );
437437 }
@@ -444,13 +444,9 @@ public void setMarker(Team team, MapLocation loc, int marker) {
444444 public void markPattern (int pattern , Team team , MapLocation center , int rotationAngle , boolean reflect , boolean isTowerPattern ) {
445445 for (int dx = -GameConstants .PATTERN_SIZE / 2 ; dx < (GameConstants .PATTERN_SIZE + 1 ) / 2 ; dx ++) {
446446 for (int dy = -GameConstants .PATTERN_SIZE / 2 ; dy < (GameConstants .PATTERN_SIZE + 1 ) / 2 ; dy ++) {
447- // don't try marking a center ruin
448- if (dx == 0 && dy == 0 && isTowerPattern )
449- continue ;
450447 int symmetry = 4 * (reflect ? 1 : 0 ) + rotationAngle ;
451448 int dx2 ;
452449 int dy2 ;
453-
454450 switch (symmetry ) {
455451 case 0 :
456452 dx2 = dx ;
@@ -565,6 +561,10 @@ public boolean isPassable(MapLocation loc) {
565561 return !(this .walls [locationToIndex (loc )] || this .hasRuin (loc ));
566562 }
567563
564+ public boolean isPaintable (MapLocation loc ){
565+ return isPassable (loc );
566+ }
567+
568568 public ArrayList <MapLocation > getRuinArray () {
569569 return allRuins ;
570570 }
0 commit comments