• R/O
  • HTTP
  • SSH
  • HTTPS

KCD: Commit

main code repository.


Commit MetaInfo

Revision828ad00c41c9af47c87bbbfb9d128bedb97ddd5c (tree)
Time2018-08-14 02:04:08
Authormasakih <masakih@user...>
Commitermasakih

Log Message

処理を分かりやすくした

Change Summary

Incremental Difference

--- a/KCD/UpgradableShipsWindowController.swift
+++ b/KCD/UpgradableShipsWindowController.swift
@@ -53,12 +53,12 @@ final class UpgradableShipsWindowController: NSWindowController {
5353
5454 @objc dynamic var filterPredicate: NSPredicate? {
5555
56- var filterPredicate: NSPredicate?
56+ var levelOnePredicate: NSPredicate?
5757 var excludeShip: NSPredicate?
5858
5959 if showLevelOneShipInUpgradableList == false {
6060
61- filterPredicate = NSPredicate(#keyPath(Ship.lv), notEqual: 1)
61+ levelOnePredicate = NSPredicate(#keyPath(Ship.lv), notEqual: 1)
6262 }
6363
6464 if showsExcludedShipInUpgradableList == false,
@@ -67,22 +67,16 @@ final class UpgradableShipsWindowController: NSWindowController {
6767 excludeShip = .not(NSPredicate(#keyPath(Ship.id), valuesIn: excludeShiIDs))
6868 }
6969
70- if let filterPredicate = filterPredicate,
71- let excludeShip = excludeShip {
70+ switch (levelOnePredicate, excludeShip) {
7271
73- return NSCompoundPredicate(andPredicateWithSubpredicates: [filterPredicate, excludeShip])
74- }
75-
76- if let filterPredicate = filterPredicate {
72+ case let (p0?, p1?): return p0.and(p1)
7773
78- return filterPredicate
79- }
80- if let excludeShip = excludeShip {
74+ case let (p0?, _): return p0
8175
82- return excludeShip
76+ case let (_, p1?): return p1
77+
78+ default: return nil
8379 }
84-
85- return nil
8680 }
8781
8882 @objc var showLevelOneShipInUpgradableList: Bool {
Show on old repository browser