From 0123cdeacc9acc7ca16fa8b0a9dee7a5d916b7df Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 5 Apr 2007 05:50:53 +0000 Subject: Selector states. Togglable edge and state labels. Builder fixes. GUI/input/etc fixes. git-svn-id: http://svn.drobilla.net/lad/machina@398 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/Node.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/engine/Node.cpp') diff --git a/src/engine/Node.cpp b/src/engine/Node.cpp index e51e33d..b55619d 100644 --- a/src/engine/Node.cpp +++ b/src/engine/Node.cpp @@ -33,6 +33,22 @@ Node::Node(BeatCount duration, bool initial) } +void +Node::set_selector(bool yn) +{ + _is_selector = yn; + + if (yn) { + double prob_sum = 0; + for (Edges::iterator i = _outgoing_edges.begin(); i != _outgoing_edges.end(); ++i) + prob_sum += (*i)->probability(); + + for (Edges::iterator i = _outgoing_edges.begin(); i != _outgoing_edges.end(); ++i) + (*i)->set_probability((*i)->probability() / prob_sum); + } +} + + void Node::set_enter_action(SharedPtr action) { -- cgit v1.2.1