From 51db9fba843c0d63b0070ead48febe866e163c3b Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Sun, 25 Jan 2015 01:36:32 -0500 Subject: [PATCH] =?UTF-8?q?Les=20calculs=20peuvent=20maintenant=20prendre?= =?UTF-8?q?=20en=20compte=20les=20valeurs=20de=20l'historique=20'resX'=20a?= =?UTF-8?q?vec=20X=20de=201=20=C3=A0=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pandacraftutils/modules/CalculatorManager.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CalculatorManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CalculatorManager.java index f727838..46bc429 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CalculatorManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CalculatorManager.java @@ -55,12 +55,17 @@ public class CalculatorManager implements Listener { { try { message = message.substring(1); - - // TODO prendre en compte les variables "resX" + + int i = history.size(); + for(HistoryElement el : history) + { + message = message.replace("res"+i, el.value); + i--; + } - StringBuffer expression = new StringBuffer(); + StringBuffer expression = new StringBuffer(); // permet de stocker la version reformaté de l'expression mathématique HistoryElement calcul = new HistoryElement(); calcul.value = StringUtil.formatDouble(JArithmeticInterpreter.getResultFromExpression(message, expression));