From: spixx Date: Sun, 26 Nov 2006 14:28:59 +0000 (+0000) Subject: Removed glibmm dependency. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a4205fb0191cc9a6a9090e0f6276248724e4f940;p=lsystem3d.git Removed glibmm dependency. --- diff --git a/src/rule.cpp b/src/rule.cpp index 564aa2c..24cc047 100644 --- a/src/rule.cpp +++ b/src/rule.cpp @@ -19,9 +19,10 @@ -#include +#include -#include +#include +#include #include "rule.h" @@ -112,7 +113,8 @@ void Rule::fromString(string ruleString) { i++; } - setProbability(Glib::Ascii::strtod(string(ruleString, 2, i - 2))); + + setProbability(strtod(string(ruleString, 2, i - 2).c_str(), NULL)); // ignore the '=' i += 2; @@ -136,13 +138,14 @@ string Rule::toString() // probability factor - if (_probability != 0.0) + if (_probability > 0.0 && _probability < 1.0) { - // TODO: precision - string probabilityString(Glib::Ascii::dtostr(getProbability()), 0, 4); + ostringstream probabilityString; + probabilityString << getProbability(); + // TODO: precision rulesString += '('; - rulesString += probabilityString; + rulesString += string(probabilityString.str(), 0, 4); rulesString += ')'; }