Skip to content

Commit e0d3df6

Browse files
shift_x and shift_y added to map.config, wtf?
1 parent 58db611 commit e0d3df6

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

map.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ WORKER_MAX_CARRYING_RESOURCE_AMOUNT = 10;
2020
# SCORPION = Soldier, ANT = Worker :)
2121
INIT_SCORPIONS = 0
2222
INIT_ANTS = 4
23+
SHIFT_X = 0
24+
SHIFT_Y = 0
2325

2426
# server runtime configs
2527
READ_MAP_FROM_FILE = true

src/main/java/ir/sharif/aichallenge/server/logic/config/ConfigReader.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public static void readConfigFile() {
4545
ConstConfigs.MAX_MESSAGE_LENGTH = Integer.parseInt(props.getProperty("MAX_MESSAGE_LENGTH"));
4646
ConstConfigs.GAME_MAXIMUM_TURN_COUNT = Integer.parseInt(props.getProperty("GAME_MAXIMUM_TURN_COUNT"));
4747
ConstConfigs.RATE_DEATH_RESOURCE = Float.parseFloat(props.getProperty("RATE_DEATH_RESOURCE"));
48-
// ConstConfigs.MAP_WIDTH = Integer.parseInt(props.getProperty("MAP_WIDTH"));
49-
// ConstConfigs.MAP_HEIGHT = Integer.parseInt(props.getProperty("MAP_HEIGHT"));
5048
ConstConfigs.BASE_MAX_ATTACK_DISTANCE = Integer.parseInt(props.getProperty("BASE_MAX_ATTACK_DISTANCE"));
5149
ConstConfigs.BASE_ATTACK_DAMAGE = Integer.parseInt(props.getProperty("BASE_ATTACK_DAMAGE"));
5250
ConstConfigs.BASE_INIT_HEALTH = Integer.parseInt(props.getProperty("BASE_INIT_HEALTH"));
@@ -58,6 +56,16 @@ public static void readConfigFile() {
5856
} catch (Exception ignored) {
5957
AntGenerator.PROCESS_TIMEOUT_SECONDS = 30;
6058
}
59+
try {
60+
ConstConfigs.SHIFT_X = Integer.parseInt(props.getProperty("SHIFT_X"));
61+
} catch (Exception ignore) {
62+
63+
}
64+
try {
65+
ConstConfigs.SHIFT_Y = Integer.parseInt(props.getProperty("SHIFT_Y"));
66+
} catch (Exception ignore) {
67+
68+
}
6169
} catch (Exception e) {
6270
e.printStackTrace();
6371
Log.e("ConfigReader", "error in config props");

src/main/java/ir/sharif/aichallenge/server/logic/config/ConstConfigs.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class ConstConfigs {
1414
public static int ANT_MAX_ATTACK_DISTANCE = 2;
1515
public static int ANT_ATTACK_DAMAGE = 2;
1616

17-
1817
public static int CHAT_LIMIT = 2;
1918
public static int MAX_MESSAGE_LENGTH = 10;
2019

@@ -34,4 +33,6 @@ public class ConstConfigs {
3433
public static int WORKER_MAX_CARRYING_RESOURCE_AMOUNT = 10;
3534

3635
public static boolean READ_MAP_FROM_FILE = false;
36+
public static int SHIFT_X = 0;
37+
public static int SHIFT_Y = 0;
3738
}

src/main/java/ir/sharif/aichallenge/server/logic/dto/graphics/GraphicGameConfigDTO.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public class GraphicGameConfigDTO {
1414
public String team0_name = Configs.FIRST_TEAM_NAME;
1515
public String team1_name = Configs.SECOND_TEAM_NAME;
1616
public int winner;
17+
public int shift_x;
18+
public int shift_y;
1719

1820
public GraphicGameConfigDTO(GameMap map) {
1921
this.map_height = map.getYAxisLength();
@@ -28,5 +30,7 @@ public GraphicGameConfigDTO(GameMap map) {
2830
this.cells_type[index++] = new CellTypeDTO(y, x, map.getCell(x, y).getCellType());
2931
}
3032
}
33+
shift_x = ConstConfigs.SHIFT_X;
34+
shift_y = ConstConfigs.SHIFT_Y;
3135
}
3236
}

0 commit comments

Comments
 (0)