00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 package com.realtime.crossfire.jxclient.map;
00023
00024 import com.realtime.crossfire.jxclient.faces.Face;
00025 import org.jetbrains.annotations.NotNull;
00026 import org.jetbrains.annotations.Nullable;
00027
00032 public class CfMapPatch {
00033
00037 public static final int SIZE_LOG = 5;
00038
00042 public static final int SIZE = 1<<SIZE_LOG;
00043
00048 @NotNull
00049 private final CfMapSquare[][] square = new CfMapSquare[SIZE][SIZE];
00050
00059 public CfMapPatch(@NotNull final CfMap map, final int x0, final int y0) {
00060 for (int y = 0; y < SIZE; y++) {
00061 for (int x = 0; x < SIZE; x++) {
00062 square[x][y] = new CfMapSquare(map, x0+x, y0+y);
00063 }
00064 }
00065 }
00066
00072 public void dirty(final int x, final int y) {
00073 square[x][y].dirty();
00074 }
00075
00082 public void clearSquare(final int x, final int y) {
00083 square[x][y].clear();
00084 }
00085
00093 public boolean setDarkness(final int x, final int y, final int darkness) {
00094 return square[x][y].setDarkness(darkness);
00095 }
00096
00104 public int getDarkness(final int x, final int y) {
00105 return square[x][y].getDarkness();
00106 }
00107
00117 public int setSmooth(final int x, final int y, final int layer, final int smooth) {
00118 return square[x][y].setSmooth(layer, smooth);
00119 }
00120
00128 public int getSmooth(final int x, final int y, final int layer) {
00129 return square[x][y].getSmooth(layer);
00130 }
00131
00139 public boolean setColor(final int x, final int y, final int color) {
00140 return square[x][y].setColor(color);
00141 }
00142
00149 public int getColor(final int x, final int y) {
00150 return square[x][y].getColor();
00151 }
00152
00160 @Nullable
00161 public Face getFace(final int x, final int y, final int layer) {
00162 return square[x][y].getFace(layer);
00163 }
00164
00176 public void setHeadMapSquare(final int x, final int y, final int layer, @Nullable final CfMapSquare mapSquare, final boolean setAlways) {
00177 square[x][y].setHeadMapSquare(layer, mapSquare, setAlways);
00178 }
00179
00188 @Nullable
00189 public CfMapSquare getHeadMapSquare(final int x, final int y, final int layer) {
00190 return square[x][y].getHeadMapSquare(layer);
00191 }
00192
00199 public boolean isFogOfWar(final int x, final int y) {
00200 return square[x][y].isFogOfWar();
00201 }
00202
00209 public boolean resetFogOfWar(final int x, final int y) {
00210 return square[x][y].resetFogOfWar();
00211 }
00212
00219 @NotNull
00220 public CfMapSquare getSquare(final int x, final int y) {
00221 return square[x][y];
00222 }
00223
00224 }