diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-02-17 15:35:18 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-02-17 15:35:18 -0500 |
commit | 006e76d24c1d6ea465fef2a5958133b712a7ca3d (patch) | |
tree | 8b59d3a530941a944500fe2c1b92b57f254ecd4a /src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition | |
parent | b80b3ab6838595aa016b285c4d5f77c15a5446f6 (diff) | |
download | fourpuzzle-006e76d24c1d6ea465fef2a5958133b712a7ca3d.tar.gz fourpuzzle-006e76d24c1d6ea465fef2a5958133b712a7ca3d.tar.bz2 fourpuzzle-006e76d24c1d6ea465fef2a5958133b712a7ca3d.zip |
Engine: Abstracted Comparsion
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition')
2 files changed, 7 insertions, 14 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableNumberPrecondition.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableNumberPrecondition.java index ab8d977..c3016e0 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableNumberPrecondition.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableNumberPrecondition.java | |||
@@ -33,13 +33,8 @@ public class VariableNumberPrecondition implements Precondition { | |||
33 | { | 33 | { |
34 | int n1 = Game.getSaveFile().getVariables().get(variableID); | 34 | int n1 = Game.getSaveFile().getVariables().get(variableID); |
35 | int n2 = number; | 35 | int n2 = number; |
36 | 36 | ||
37 | switch (comparison) | 37 | return comparison.compare(n1, n2); |
38 | { | ||
39 | case Less: return (n1 < n2); | ||
40 | case Greater: return (n1 > n2); | ||
41 | case Equal: return (n1 == n2); | ||
42 | } | ||
43 | } | 38 | } |
44 | 39 | ||
45 | return false; | 40 | return false; |
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableVariablePrecondition.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableVariablePrecondition.java index 91a31ba..da16d09 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableVariablePrecondition.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableVariablePrecondition.java | |||
@@ -31,14 +31,12 @@ public class VariableVariablePrecondition implements Precondition { | |||
31 | { | 31 | { |
32 | if (Game.getSaveFile().getVariables().containsKey(variableID)) | 32 | if (Game.getSaveFile().getVariables().containsKey(variableID)) |
33 | { | 33 | { |
34 | int n1 = Game.getSaveFile().getVariables().get(variableID); | 34 | if (Game.getSaveFile().getVariables().containsKey(variableID2)) |
35 | int n2 = Game.getSaveFile().getVariables().get(variableID2); | ||
36 | |||
37 | switch (comparison) | ||
38 | { | 35 | { |
39 | case Less: return (n1 < n2); | 36 | int n1 = Game.getSaveFile().getVariables().get(variableID); |
40 | case Greater: return (n1 > n2); | 37 | int n2 = Game.getSaveFile().getVariables().get(variableID2); |
41 | case Equal: return (n1 == n2); | 38 | |
39 | return comparison.compare(n1, n2); | ||
42 | } | 40 | } |
43 | } | 41 | } |
44 | 42 | ||