Skip to content

Commit

Permalink
Fix coop replay parsing
Browse files Browse the repository at this point in the history
Fixes coop replay parsing
Reads in mapName from replay bytes if game type is coop.
Updates FAF to correct version for replay.
Parse replay bytes for map name for all replays

Fixes #1676
  • Loading branch information
Sheikah45 committed Nov 6, 2020
1 parent 42bf30b commit 6b46756
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public CompletableFuture<Void> update(FeaturedMod featuredMod, Integer version,

if (!NAMES_OF_FEATURED_BASE_MODS.contains(featuredMod.getTechnicalName())) {
future = future.thenCompose(aVoid -> modService.getFeaturedMod(FAF.getTechnicalName()))
.thenCompose(baseMod -> updateFeaturedMod(baseMod, null))
.thenCompose(baseMod -> updateFeaturedMod(baseMod, version))
.thenAccept(patchResults::add);
}

Expand Down
18 changes: 1 addition & 17 deletions src/main/java/com/faforever/client/replay/ReplayService.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.jgit.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
Expand Down Expand Up @@ -509,22 +508,7 @@ private void runFafReplayFile(Path path) throws IOException {
String gameType = replayInfo.getFeaturedMod();
Integer replayId = replayInfo.getUid();
Map<String, Integer> modVersions = replayInfo.getFeaturedModVersions();
String mapName = replayInfo.getMapname();

// For some reason in the coop replay the map name is null in the metadata
// So we just take it directly from the replay data.
if (StringUtils.isEmptyOrNull(mapName)) {
mapName = parseMapFolderName(rawReplayBytes);
}

// For map generator games the map name is "None" because replay server gets map name by from DB based on filename
// from replay data, and DB does not contain generated maps.
if (StringUtils.equalsIgnoreCase(mapName, "None")) {
String maybeMapGen = parseMapName(rawReplayBytes).replaceAll(".scmap", "");
if (mapGeneratorService.isGeneratedMap(maybeMapGen)) {
mapName = maybeMapGen;
}
}
String mapName = parseMapFolderName(rawReplayBytes);

Set<String> simMods = replayInfo.getSimMods() != null ? replayInfo.getSimMods().keySet() : emptySet();

Expand Down

0 comments on commit 6b46756

Please sign in to comment.