Skip to content

Commit e5b830c

Browse files
committed
Merge branch 'release/v0.6.21-alpha'
2 parents 9ee1562 + c48fde1 commit e5b830c

File tree

8 files changed

+32
-35
lines changed

8 files changed

+32
-35
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ apply plugin: 'distribution'
3838
sourceCompatibility = JavaVersion.VERSION_1_8
3939
targetCompatibility = JavaVersion.VERSION_1_8
4040

41-
version = '0.6.20-alpha'
41+
version = '0.6.21-alpha'
4242

4343
class HttpBuilder extends HTTPBuilder {
4444

downlords-faf-client.install4j

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@
470470
</applications>
471471
</installerGui>
472472
<mediaSets>
473-
<windows name="Windows" id="26" customizedId="" mediaFileName="" installDir="${compiler:sys.fullName}" overridePrincipalLanguage="false" jreBitType="32" runPostProcessor="false" postProcessor="" failOnPostProcessorError="false" useLegacyMediaFileIds="false" legacyMediaFileIds="" downloadURL="" includeAllDownloadableComponents="false" includedJRE="windows-x86-1.8.0_92" manualJREEntry="false" bundleType="2" jreURL="https://github.com/micheljung/jre-bundles/raw/master/windows-x86-1.8.0_92.tar.gz" jreShared="false" directDownload="true" installOnlyIfNecessary="false" customInstallBaseDir="" contentFilesType="1" verifyIntegrity="true">
473+
<windows name="Windows" id="26" customizedId="" mediaFileName="" installDir="${compiler:sys.fullName}" overridePrincipalLanguage="false" jreBitType="32" runPostProcessor="false" postProcessor="" failOnPostProcessorError="false" useLegacyMediaFileIds="false" legacyMediaFileIds="" downloadURL="" includeAllDownloadableComponents="false" includedJRE="windows-x86-1.8.0_102" manualJREEntry="false" bundleType="2" jreURL="https://github.com/micheljung/jre-bundles/blob/master/windows-x86-1.8.0_102.tar.gz" jreShared="false" directDownload="true" installOnlyIfNecessary="false" customInstallBaseDir="" contentFilesType="1" verifyIntegrity="true">
474474
<excludedComponents />
475475
<includedDownloadableComponents />
476476
<excludedLaunchers />
@@ -485,22 +485,6 @@
485485
<customAttributes />
486486
</autoUpdate>
487487
</windows>
488-
<macosFolder name="Mac OS X Folder" id="158" customizedId="" mediaFileName="" installDir="${compiler:sys.fullName}" overridePrincipalLanguage="false" jreBitType="all" runPostProcessor="false" postProcessor="" failOnPostProcessorError="false" useLegacyMediaFileIds="false" legacyMediaFileIds="" downloadURL="" includeAllDownloadableComponents="false" includedJRE="macosx-amd64-1.8.0_92" manualJREEntry="false" bundleType="2" jreURL="https://github.com/micheljung/jre-bundles/blob/master/macosx-amd64-1.8.0_92.tar.gz" jreShared="false" directDownload="false" installOnlyIfNecessary="false" appleJre="false" requiredVmIdPrefix="" customInstallBaseDir="" contentFilesType="1" installerName="${i18n:InstallerName(${compiler:sys.fullName})}" volumeName="${compiler:sys.shortName}" compressDmg="false" signLaunchers="false">
489-
<excludedComponents />
490-
<includedDownloadableComponents />
491-
<excludedLaunchers />
492-
<excludedBeans />
493-
<overriddenPrincipalLanguage id="en" customLocalizationFile="" />
494-
<exclude>
495-
<entry location="lib/uid.exe" fileType="regular" />
496-
</exclude>
497-
<variables />
498-
<autoUpdate useMinUpdatableVersion="false" minUpdatableVersion="" useMaxUpdatableVersion="false" maxUpdatableVersion="">
499-
<commentFiles />
500-
<customAttributes />
501-
</autoUpdate>
502-
<topLevelFiles />
503-
</macosFolder>
504488
</mediaSets>
505489
<buildIds buildAll="true" />
506490
<buildOptions verbose="false" faster="false" disableSigning="false" disableJreBundling="false" debug="false" />

src/main/java/com/faforever/client/game/GameInfoBean.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public class GameInfoBean {
2828
private static final Pattern MAX_RATING_PATTERN = Pattern.compile("<\\s*(" + RATING_NUMBER + ")");
2929
private static final Pattern ABOUT_RATING_PATTERN = Pattern.compile("~\\s*(" + RATING_NUMBER + ")");
3030
private static final Pattern BETWEEN_RATING_PATTERN = Pattern.compile("(" + RATING_NUMBER + ")\\s*-\\s*(" + RATING_NUMBER + ")");
31-
private static final Pattern INTEGER_PATTERN_MATCHER = Pattern.compile("\\d+");
3231

3332
private final StringProperty host;
3433
private final StringProperty title;
@@ -144,10 +143,9 @@ public void updateFromGameInfo(GameInfoMessage gameInfoMessage) {
144143
}
145144

146145
private int parseRating(String string) {
147-
Matcher matcher = INTEGER_PATTERN_MATCHER.matcher(string);
148-
if (matcher.matches()) {
146+
try {
149147
return Integer.parseInt(string);
150-
} else {
148+
} catch (NumberFormatException e) {
151149
int rating;
152150
String[] split = string.replace("k", "").split("\\.");
153151
rating = Integer.parseInt(split[0]) * 1000;

src/main/java/com/faforever/client/game/GameServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ public CompletionStage<Void> startSearchRanked1v1(Faction faction) {
316316
.thenRun(() -> localRelayServer.start(connectivityService))
317317
.thenCompose(aVoid -> fafService.startSearchRanked1v1(faction, port))
318318
.thenAccept((gameLaunchInfo) -> {
319+
// TODO this should be sent by the server!
320+
gameLaunchInfo.setArgs(new ArrayList<>(gameLaunchInfo.getArgs()));
321+
gameLaunchInfo.getArgs().add("/team 1");
322+
gameLaunchInfo.getArgs().add("/players 2");
323+
319324
searchExpansionFuture.cancel(true);
320325
startGame(gameLaunchInfo, faction, RatingMode.RANKED_1V1, localRelayServer.getPort());
321326
})

src/main/java/com/faforever/client/remote/domain/GameLaunchMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public GameLaunchMessage() {
1313
}
1414

1515
/**
16-
* Stores game launch arguments, like "/ratingcolor d8d8d8d8 /numgames 236".
16+
* Stores game launch arguments, like "/ratingcolor d8d8d8d8", "/numgames 236".
1717
*/
1818
public List<String> getArgs() {
1919
return args;

src/main/java/com/faforever/client/update/ClientUpdateServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public ClientUpdateServiceImpl() {
4747
currentVersion = new ComparableVersion(
4848
defaultString(getClass().getPackage().getImplementationVersion(), DEVELOPMENT_VERSION_STRING)
4949
);
50+
logger.info("Current version: {}", currentVersion);
5051
}
5152

5253
@Override

src/main/resources/theme/map_tile.fxml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<?import javafx.scene.control.*?>
3+
<?import javafx.scene.control.Label?>
44
<?import javafx.scene.image.ImageView?>
5-
<?import javafx.scene.layout.*?>
5+
<?import javafx.scene.layout.ColumnConstraints?>
6+
<?import javafx.scene.layout.GridPane?>
7+
<?import javafx.scene.layout.RowConstraints?>
8+
69
<GridPane xmlns:fx="http://javafx.com/fxml/1" fx:id="mapTileRoot" onMouseClicked="#onShowMapDetail" prefWidth="200.0"
710
styleClass="tile,pointable" xmlns="http://javafx.com/javafx/8.0.60"
811
fx:controller="com.faforever.client.map.MapTileController">
@@ -23,7 +26,7 @@
2326
<Label fx:id="nameLabel" text="Label" GridPane.columnSpan="2147483647" GridPane.rowIndex="1"/>
2427
<Label fx:id="downloadsLabel" text="1" GridPane.columnIndex="0" GridPane.halignment="RIGHT" GridPane.rowIndex="3">
2528
<graphic>
26-
<Label styleClass="fontawesome" text=""/>
29+
<Label styleClass="fontawesome" text=""/>
2730
</graphic>
2831
</Label>
2932
<Label fx:id="playsLabel" text="1" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3">

src/test/java/com/faforever/client/game/GameServiceImplTest.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.springframework.context.ApplicationContext;
3030

3131
import java.net.InetSocketAddress;
32-
import java.util.Arrays;
3332
import java.util.Collections;
3433
import java.util.List;
3534
import java.util.concurrent.CompletableFuture;
@@ -40,8 +39,12 @@
4039
import java.util.function.Consumer;
4140

4241
import static com.faforever.client.fa.RatingMode.GLOBAL;
42+
import static com.faforever.client.fa.RatingMode.RANKED_1V1;
43+
import static com.faforever.client.game.Faction.AEON;
44+
import static com.faforever.client.game.Faction.CYBRAN;
4345
import static com.faforever.client.remote.domain.GameState.CLOSED;
4446
import static com.faforever.client.remote.domain.GameState.PLAYING;
47+
import static java.util.Arrays.asList;
4548
import static java.util.concurrent.CompletableFuture.completedFuture;
4649
import static org.hamcrest.CoreMatchers.is;
4750
import static org.hamcrest.CoreMatchers.notNullValue;
@@ -59,6 +62,7 @@
5962
import static org.mockito.Mockito.doAnswer;
6063
import static org.mockito.Mockito.mock;
6164
import static org.mockito.Mockito.never;
65+
import static org.mockito.Mockito.timeout;
6266
import static org.mockito.Mockito.verify;
6367
import static org.mockito.Mockito.when;
6468

@@ -235,12 +239,12 @@ public void testAddOnGameStartedListener() throws Exception {
235239

236240
NewGameInfo newGameInfo = NewGameInfoBuilder.create().defaultValues().get();
237241
GameLaunchMessage gameLaunchMessage = GameLaunchMessageBuilder.create().defaultValues().get();
238-
gameLaunchMessage.setArgs(Arrays.asList("/foo bar", "/bar foo"));
242+
gameLaunchMessage.setArgs(asList("/foo bar", "/bar foo"));
239243
InetSocketAddress externalSocketAddress = new InetSocketAddress(123);
240244

241245
when(localRelayServer.getPort()).thenReturn(gpgPort);
242246
when(forgedAllianceService.startGame(
243-
gameLaunchMessage.getUid(), gameLaunchMessage.getMod(), null, Arrays.asList("/foo", "bar", "/bar", "foo"), GLOBAL, gpgPort)
247+
gameLaunchMessage.getUid(), gameLaunchMessage.getMod(), null, asList("/foo", "bar", "/bar", "foo"), GLOBAL, gpgPort)
244248
).thenReturn(process);
245249
when(connectivityService.getExternalSocketAddress()).thenReturn(externalSocketAddress);
246250
when(gameUpdateService.updateInBackground(any(), any(), any(), any())).thenReturn(completedFuture(null));
@@ -270,7 +274,7 @@ public void testAddOnGameStartedListener() throws Exception {
270274

271275
gameTerminatedLatch.await(TIMEOUT, TIME_UNIT);
272276
verify(forgedAllianceService).startGame(
273-
gameLaunchMessage.getUid(), gameLaunchMessage.getMod(), null, Arrays.asList("/foo", "bar", "/bar", "foo"), GLOBAL,
277+
gameLaunchMessage.getUid(), gameLaunchMessage.getMod(), null, asList("/foo", "bar", "/bar", "foo"), GLOBAL,
274278
gpgPort);
275279
verify(replayService).startReplayServer(gameLaunchMessage.getUid());
276280
}
@@ -301,7 +305,7 @@ public void testOnGames() throws Exception {
301305
assertThat(instance.getGameInfoBeans(), empty());
302306

303307
GameInfoMessage multiGameInfoMessage = new GameInfoMessage();
304-
multiGameInfoMessage.setGames(Arrays.asList(
308+
multiGameInfoMessage.setGames(asList(
305309
GameInfoMessageBuilder.create(1).defaultValues().get(),
306310
GameInfoMessageBuilder.create(2).defaultValues().get()
307311
));
@@ -388,20 +392,22 @@ public void testOnGameInfoRemove() {
388392
@Test
389393
public void testStartSearchRanked1v1() throws Exception {
390394
GameLaunchMessage gameLaunchMessage = new GameLaunchMessage();
395+
gameLaunchMessage.setMod("ladder1v1");
391396
gameLaunchMessage.setUid(123);
392397
gameLaunchMessage.setArgs(Collections.emptyList());
393-
when(fafService.startSearchRanked1v1(Faction.CYBRAN, GAME_PORT)).thenReturn(CompletableFuture.completedFuture(gameLaunchMessage));
398+
when(fafService.startSearchRanked1v1(CYBRAN, GAME_PORT)).thenReturn(CompletableFuture.completedFuture(gameLaunchMessage));
394399
when(gameUpdateService.updateInBackground(GameType.LADDER_1V1.getString(), null, Collections.emptyMap(), Collections.emptySet())).thenReturn(CompletableFuture.completedFuture(null));
395400
when(applicationContext.getBean(SearchExpansionTask.class)).thenReturn(searchExpansionTask);
396401
when(scheduledExecutorService.scheduleWithFixedDelay(any(), anyLong(), anyLong(), any())).thenReturn(mock(ScheduledFuture.class));
397402
when(localRelayServer.getPort()).thenReturn(111);
398403

399-
CompletableFuture<Void> future = instance.startSearchRanked1v1(Faction.CYBRAN).toCompletableFuture();
404+
CompletableFuture<Void> future = instance.startSearchRanked1v1(CYBRAN).toCompletableFuture();
400405

401406
verify(searchExpansionTask).setMaxRadius(SEARCH_MAX_RADIUS);
402407
verify(searchExpansionTask).setRadiusIncrement(SEARCH_RADIUS_INCREMENT);
403408
verify(scheduledExecutorService).scheduleWithFixedDelay(searchExpansionTask, SEARCH_EXPANSION_DELAY, SEARCH_EXPANSION_DELAY, TimeUnit.MILLISECONDS);
404-
verify(fafService).startSearchRanked1v1(Faction.CYBRAN, GAME_PORT);
409+
verify(fafService).startSearchRanked1v1(CYBRAN, GAME_PORT);
410+
verify(forgedAllianceService, timeout(5)).startGame(eq(123), eq("ladder1v1"), eq(CYBRAN), eq(asList("/team", "1", "/players", "2")), eq(RANKED_1V1), anyInt());
405411
assertThat(future.get(TIMEOUT, TIME_UNIT), is(nullValue()));
406412
}
407413

@@ -432,7 +438,7 @@ public void testStartSearchRanked1v1GameRunningDoesNothing() throws Exception {
432438
instance.hostGame(newGameInfo);
433439
gameRunningLatch.await(TIMEOUT, TIME_UNIT);
434440

435-
instance.startSearchRanked1v1(Faction.AEON);
441+
instance.startSearchRanked1v1(AEON);
436442

437443
assertThat(instance.searching1v1Property().get(), is(false));
438444
}

0 commit comments

Comments
 (0)