Skip to content

Commit e0dbd7d

Browse files
author
Builder
committed
Merge branch 'config-checker' into 'master'
fix(sdk): remove Title field from config helper See merge request codingame/game-engine!182
2 parents 8054cf5 + 27d043a commit e0dbd7d

File tree

5 files changed

+7
-45
lines changed

5 files changed

+7
-45
lines changed

playground/misc/misc-3-release-notes.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
99
- Included missing `addAgent` polymorphism – custom nickname with default avatar.
1010
- Improved display of player output in local test page.
1111
- Better handling of errors from initializing modules.
12+
- Unused `title` property no longer mandatory in `config.ini`.
1213
- `setFrameDuration()` now throws an exception on non-positive values.
1314

1415
## 3.3.1
@@ -37,7 +38,7 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
3738
### ⚠️ Known issues
3839

3940
- Maven modules not available as dependencies
40-
- `setFrameDuration()` does not work in the `init()`
41+
- `setFrameDuration()` does not work in the `init()`.
4142

4243
## 3.1.0
4344

@@ -47,11 +48,11 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
4748

4849
### 🐞 Bug fix
4950

50-
- Fixed an issue with sprites
51+
- Fixed an issue with sprites.
5152

5253
### ⚠️ Known issues
5354

54-
- `setFrameDuration()` does not work in the `init()`
55+
- `setFrameDuration()` does not work in the `init()`.
5556

5657
## 3.0.0
5758
*January 11, 2019*
@@ -77,7 +78,7 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
7778

7879
### ⚠️ Known issues
7980

80-
- `setFrameDuration()` does not work in the `init()`
81+
- `setFrameDuration()` does not work in the `init()`.
8182

8283
## 2.15
8384
*November 29, 2018*
@@ -113,7 +114,7 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
113114

114115
### 🎁 New feature
115116

116-
- Local test page design now matches the website one
117+
- Local test page design now matches the website one.
117118

118119
## 2.8
119120
*August 9, 2018*

runner/src/main/java/com/codingame/gameengine/runner/ConfigHelper.java

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ enum GameType {
3939
}
4040

4141
public static class GameConfig {
42-
private String title;
4342
private boolean leaguesDetected;
4443
private GameType gameType;
4544
private Map<String, QuestionConfig> questionsConfig = new HashMap<>();
@@ -67,14 +66,6 @@ public boolean isLeaguesDetected() {
6766
public void setLeaguesDetected(boolean leaguesDetected) {
6867
this.leaguesDetected = leaguesDetected;
6968
}
70-
71-
public String getTitle() {
72-
return title;
73-
}
74-
75-
public void setTitle(String title) {
76-
this.title = title;
77-
}
7869
}
7970

8071
class TestCase {
@@ -117,7 +108,6 @@ public void setIsValidator(Boolean isValidator) {
117108
}
118109

119110
public static class QuestionConfig {
120-
private String title;
121111
private boolean configDetected;
122112
private Map<Integer, String> statementsLanguageMap = new HashMap<Integer, String>();
123113
private Map<Integer, String> welcomeLanguageMap = new HashMap<Integer, String>();
@@ -185,14 +175,6 @@ public List<TestCase> getTestCases() {
185175
return testCases;
186176
}
187177

188-
public String getTitle() {
189-
return title;
190-
}
191-
192-
public void setTitle(String title) {
193-
this.title = title;
194-
}
195-
196178
public Map<Integer, String> getStatementsLanguageMap() {
197179
return statementsLanguageMap;
198180
}
@@ -266,8 +248,6 @@ public void setConfigDetected(boolean configDetected) {
266248
}
267249

268250
public void merge(QuestionConfig defaultConfig) {
269-
this.title = ObjectUtils.firstNonNull(title, defaultConfig.title);
270-
271251
this.statementsLanguageMap = firstNonNullOrEmptyMap(
272252
statementsLanguageMap,
273253
defaultConfig.statementsLanguageMap
@@ -383,7 +363,6 @@ public GameConfig findConfig(Path rootDir) throws IOException {
383363
try (FileInputStream is = new FileInputStream(p.toFile())) {
384364
config.load(is);
385365

386-
String title = config.getProperty("title");
387366
String minPlayers = config.getProperty("min_players");
388367
String maxPlayers = config.getProperty("max_players");
389368
String criteria = config.getProperty("criteria");
@@ -392,7 +371,6 @@ public GameConfig findConfig(Path rootDir) throws IOException {
392371
String sortingOrder = config.getProperty("sorting_order");
393372
String questionType = config.getProperty("type");
394373

395-
questionConfig.setTitle(title);
396374
questionConfig.setMinPlayers(minPlayers != null ? Integer.valueOf(minPlayers) : null);
397375
questionConfig.setMaxPlayers(maxPlayers != null ? Integer.valueOf(maxPlayers) : null);
398376
questionConfig.setCriteria(criteria);
@@ -454,7 +432,6 @@ public GameConfig findConfig(Path rootDir) throws IOException {
454432
});
455433

456434
QuestionConfig defaultConfig = questionsConfig.get("");
457-
gameConfig.setTitle(defaultConfig.getTitle());
458435

459436
// If there is more than 1 element in leagues, then we have a real league system and the empty string key in leagues
460437
// represents the default value. So if we have a real league system, we will remove the default config and override
@@ -463,11 +440,6 @@ public GameConfig findConfig(Path rootDir) throws IOException {
463440
questionsConfig.remove("");
464441
for (String leagueKey : questionsConfig.keySet()) {
465442
QuestionConfig questionConfig = questionsConfig.get(leagueKey);
466-
// If not set, we force the title of the league with the concatenation of the main title and the league dir. name
467-
ObjectUtils.firstNonNull(
468-
questionConfig.title,
469-
String.format("%s - %s", defaultConfig.title, leagueKey)
470-
);
471443
questionConfig.merge(defaultConfig);
472444
questionConfig.configDetected = isPresentConfigIni(gameConfig, questionConfig);
473445
}
@@ -519,7 +491,6 @@ public GameConfig findConfig(Path rootDir) throws IOException {
519491
}
520492

521493
private boolean isPresentConfigIni(GameConfig gameConfig, QuestionConfig questionConfig) {
522-
return gameConfig.getTitle() != null
523-
|| questionConfig.minPlayers != null || questionConfig.maxPlayers != null;
494+
return questionConfig.minPlayers != null || questionConfig.maxPlayers != null;
524495
}
525496
}

runner/src/main/java/com/codingame/gameengine/runner/Renderer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,6 @@ private void checkConfigIni(GameConfig gameConfig, QuestionConfig questionConfig
484484
throws MissingConfigException {
485485
if (!questionConfig.isConfigDetected()) {
486486
throw new MissingConfigException(tag + "Missing config.ini file");
487-
} else if (gameConfig.getTitle() == null || gameConfig.getTitle().isEmpty()) {
488-
throw new MissingConfigException(tag + "Missing title property in config.ini.");
489487
} else if (questionConfig.getMinPlayers() == null) {
490488
throw new MissingConfigException(tag + "Missing min_players property in config.ini.");
491489
} else if (questionConfig.getMaxPlayers() == null) {
@@ -640,7 +638,6 @@ public void handleRequest(HttpServerExchange exchange) throws Exception {
640638

641639
exchange.getRequestReceiver().receiveFullString((e, data) -> {
642640
ConfigResponseDto configResponseDto = new Gson().fromJson(data, ConfigResponseDto.class);
643-
config.put("title", configResponseDto.title);
644641
config.put("min_players", String.valueOf(configResponseDto.minPlayers));
645642
config.put("max_players", String.valueOf(configResponseDto.maxPlayers));
646643
config.put("type", configResponseDto.type);

runner/src/main/java/com/codingame/gameengine/runner/dto/ConfigResponseDto.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.codingame.gameengine.runner.dto;
22

33
public class ConfigResponseDto {
4-
public String title;
54
public int minPlayers;
65
public int maxPlayers;
76
public String type;

runner/src/main/resources/view/test.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@
6565
<div class="form-popup">
6666
<form id="config-form" name="form">
6767
<p><span ng-bind="formStatement"></span></p>
68-
<p>
69-
<label for="title">Title*</label>
70-
</p>
71-
<p>
72-
<input required type="text" ng-model="config.title" />
73-
</p>
7468
<div ng-if="config.type != 'solo' && config.type != 'opti'">
7569
<p>
7670
<label for="min_players">Min players*</label>

0 commit comments

Comments
 (0)