SteamWar/BauSystem2.0
Archiviert
12
0

Changed behavior of trace deletion while being recorded
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
D4rkr34lm 2024-04-22 22:49:13 +02:00
Ursprung 792b089e4f
Commit e8eeeb729a
3 geänderte Dateien mit 3 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -132,11 +132,6 @@ public class TraceManager implements Listener {
* @param trace the trace to be removed
*/
public boolean remove(Trace trace) {
Optional<Trace> activeTrace = TraceRecorder.instance.getActiveTraceForRegion(trace.getRegion());
if (activeTrace.isPresent() && activeTrace.get() == trace) {
TraceRecorder.instance.stopRecording(trace.getRegion());
}
Map<Integer, Trace> traces = tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap());
Integer traceId = traces.entrySet().stream()
.filter(entry -> entry.getValue() == trace)
@ -153,7 +148,6 @@ public class TraceManager implements Listener {
* Clears all traces
*/
public void clear(Region region) {
TraceRecorder.instance.stopRecording(region);
showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>())
.keySet()
.forEach(player -> {

Datei anzeigen

@ -104,14 +104,11 @@ public class TraceRecorder implements Listener {
*
* @param region region to be recorded
*/
public int startRecording(Region region) {
if (activeTraces.containsKey(region)) {
return -1;
}
public void startRecording(Region region) {
if (activeTraces.containsKey(region)) return;
TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region);
activeTraces.put(region, wrappedTrace);
return TraceManager.instance.add(wrappedTrace.getTrace());
}
/**

Datei anzeigen

@ -89,9 +89,6 @@ public class TraceRecordingWrapper {
protected void finalizeRecording() {
recordsOutputStream.flush();
recordsOutputStream.close();
if (trace.getRecords().isEmpty()) {
TraceManager.instance.remove(trace);
}
TraceManager.instance.add(trace);
}
}