OSDN Git Service

Fleetを7隻に対応
authormasakih <masakih@users.sourceforge.jp>
Thu, 23 Nov 2017 13:22:39 +0000 (22:22 +0900)
committermasakih <masakih@users.sourceforge.jp>
Thu, 23 Nov 2017 13:22:39 +0000 (22:22 +0900)
KCD/Deck.swift
KCD/Fleet.swift

index 2801a1d..f2047fe 100644 (file)
@@ -85,4 +85,9 @@ extension Deck {
         
         return range.flatMap { self[$0] }
     }
+    
+    subscript(_ range: CountableRange<Int>) -> [Ship] {
+        
+        return range.flatMap { self[$0] }
+    }
 }
index 4532234..b39089f 100644 (file)
@@ -17,7 +17,8 @@ final class Fleet: NSObject {
     
     private let deckObserveKeys = [
         "selection.ship_0", "selection.ship_1", "selection.ship_2",
-        "selection.ship_3", "selection.ship_4", "selection.ship_5"
+        "selection.ship_3", "selection.ship_4", "selection.ship_5",
+        "selection.ship_6"
     ]
     
     init?(number: Int) {
@@ -83,7 +84,7 @@ final class Fleet: NSObject {
         
         if context == &pDeckContext {
             
-            ships = (0..<6).flatMap { self[$0] }
+            ships = (0..<Deck.maxShipCount).flatMap { self[$0] }
             
             return
         }