mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 11:43:19 +08:00
refactor: Modernize switch; use switch-expressions and no break; (#3133)
Replaces the switch cases that can be replaces with switch expressions and removes `break;` where it isn't needed. https://dart.dev/language/branches#switch-statements
This commit is contained in:
@ -95,26 +95,19 @@ class WorkerOvermind extends Component
|
||||
pathFinderData: game.pathFinderData,
|
||||
);
|
||||
|
||||
final List<List<IntVector2>> paths;
|
||||
switch (isolateHud.computeType) {
|
||||
case ComputeType.isolate:
|
||||
paths = await isolateCompute(
|
||||
final paths = switch (isolateHud.computeType) {
|
||||
ComputeType.isolate => await isolateCompute(
|
||||
_calculateWork,
|
||||
calculateWorkData,
|
||||
);
|
||||
break;
|
||||
case ComputeType.synchronous:
|
||||
paths = _calculateWork(
|
||||
),
|
||||
ComputeType.synchronous => _calculateWork(
|
||||
calculateWorkData,
|
||||
);
|
||||
break;
|
||||
case ComputeType.compute:
|
||||
paths = await compute(
|
||||
),
|
||||
ComputeType.compute => await compute(
|
||||
_calculateWork,
|
||||
calculateWorkData,
|
||||
);
|
||||
break;
|
||||
}
|
||||
),
|
||||
};
|
||||
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
idleWorkers[i].issueWork(
|
||||
|
||||
Reference in New Issue
Block a user