- assert (iter.next());
- std::string token = iter.item();
- assert(token == "name");
- iter.value()->get(name);
-
- pixels_per_second = DEFAULT_PIXELS_PER_SECOND;
- assert (iter.next());
- token = iter.item();
- if (token == "speed") {
- iter.value()->get(pixels_per_second);
- iter.next();
- }
- do {
- token = iter.item();
- if(token == "x") {
- iter.value()->get(x);
- } else if(token == "y") {
- iter.value()->get(y);
- points.push_back(Vector(x,y));
+ mode = CIRCULAR;
+ while(iter.next()) {
+ if(iter.item() == "mode") {
+ std::string mode_string;
+ if(!iter.value()->get(mode_string))
+ throw std::runtime_error("Pathmode not a string");
+
+ if(mode_string == "oneshot")
+ mode = ONE_SHOT;
+ else if(mode_string == "pingpong")
+ mode = PING_PONG;
+ else if(mode_string == "circular")
+ mode = CIRCULAR;
+ else {
+ std::ostringstream msg;
+ msg << "Unknown pathmode '" << mode_string << "' found";
+ throw std::runtime_error(msg.str());
+ }
+ continue;