diff options
author | Pacien TRAN-GIRARD | 2016-03-07 16:28:51 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-03-07 16:28:51 +0100 |
commit | be399f170a086000ffa774c9dcfb9a5eb6233ab2 (patch) | |
tree | 9902c4a52105b1ad5745a15358872c93d465b45d /src/ch | |
parent | 1998636c6b0a3177da22760ef9ae19897f804bba (diff) | |
download | xblast-be399f170a086000ffa774c9dcfb9a5eb6233ab2.tar.gz |
Fix Bomb secondary constructor for decreasing fuse lengths sequences
Diffstat (limited to 'src/ch')
-rw-r--r-- | src/ch/epfl/xblast/server/Bomb.java | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/ch/epfl/xblast/server/Bomb.java b/src/ch/epfl/xblast/server/Bomb.java index 38bd4c5..889dde0 100644 --- a/src/ch/epfl/xblast/server/Bomb.java +++ b/src/ch/epfl/xblast/server/Bomb.java | |||
@@ -11,6 +11,7 @@ import java.util.List; | |||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * @author Pacien TRAN-GIRARD (261948) | ||
14 | * @author Timothée FLOURE (257420) | 15 | * @author Timothée FLOURE (257420) |
15 | */ | 16 | */ |
16 | public final class Bomb { | 17 | public final class Bomb { |
@@ -58,12 +59,7 @@ public final class Bomb { | |||
58 | * @throws NullPointerException if ownerId, position or fuseLengths is null | 59 | * @throws NullPointerException if ownerId, position or fuseLengths is null |
59 | */ | 60 | */ |
60 | public Bomb(PlayerID ownerId, Cell position, int fuseLength, int range) { | 61 | public Bomb(PlayerID ownerId, Cell position, int fuseLength, int range) { |
61 | if (fuseLength == 0) { | 62 | this(ownerId, position, Sq.iterate(fuseLength, fl -> fl - 1 ), range); |
62 | throw new IllegalArgumentException(); | ||
63 | } else { | ||
64 | fuseLengths = Sq.iterate(fuseLength, fuseLengths -> fuseLength - 1 ); | ||
65 | } | ||
66 | this.Bomb(ownerId, position, fuseLengths, range); | ||
67 | } | 63 | } |
68 | 64 | ||
69 | /** | 65 | /** |