public void createBountyIsland(Territory terr) { assert (terr.getXChunkCoord() == 0 && terr.getYChunkCoord() == 0); assert (this.world.getIslandList().getTotal() == 0); assert (this.player == null); this.cRect = ChunkMap.getCenterDomain(terr); int islandId = this.terrToChunkMap(terr, IslandList.INVALID_ISLAND_ID, true); this.chunkMapToSquids(islandId); this.world.getIslandList().scanAdd(); }
public int terrToChunkMap(Territory terr, int terrId, boolean relativeTo0x0) { int xOffset = relativeTo0x0 ? 0 : terr.getXChunkCoord(); int yOffset = relativeTo0x0 ? 0 : terr.getYChunkCoord(); int thisIslandId = IslandList.INVALID_ISLAND_ID; if (this.inWorld()) { thisIslandId = this.world.getIslandList().addIsland(player, terrId); } else { thisIslandId = terrId; } CanonDecoder c = new CanonDecoder( Types.findByTypeName("puzzlePiece"), terr.getCanon(), terr.getRot(), new BoardCoord( this.cRect.getTl().getX() + xOffset, this.cRect.getTl().getY() + yOffset)); int indexWithinTerr = 0; while (c.isValid()) { ChunkCoord cc = new ChunkCoord((int) c.getPos().getX(), (int) c.getPos().getY()); Chunk ch = this.cMap.getChunk(cc); ch.setIslandId(thisIslandId); ch.setTerr(terr); ch.setIndexWithinTerr(indexWithinTerr); ch.setSideOrientation(c.getOrientation()); c.getNext(); ++indexWithinTerr; } if (this.inWorld()) { this.world .getIslandList() .setBoardCoordRect( thisIslandId, this.cMap.getChunkCoordRect(thisIslandId).getBoardCoordRect()); } return thisIslandId; }