Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 20, 2008, 4:31:03 PM (16 years ago)
Author:
rgrieder
Message:
  • classed FloatParser to ExprParser class
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/input/src/orxonox/Orxonox.cc

    r1112 r1118  
    5454//#include "util/Sleep.h"
    5555#include "util/ArgReader.h"
    56 #include "util/FloatParser.h"
     56#include "util/ExprParser.h"
    5757
    5858// core
     
    130130    static void calculate(std::string calculation)
    131131    {
    132       char** useless = 0;
    133       double result = 0.0;
    134       bool success = parse_float((char* const)calculation.c_str(), useless, &result);
    135       if (success)
    136       {
    137         if (result == 42.0)
     132      ExprParser expr(calculation);
     133      if (expr.getSuccess())
     134      {
     135        if (expr.getResult() == 42.0)
    138136          std::cout << "Greetings from the restaurant at the end of the universe." << std::endl;
    139         std::cout << "Result is: " << result << std::endl;
     137        // FIXME: insert modifier to display in full precision
     138        std::cout << "Result is: " << expr.getResult() << std::endl;
     139        if (expr.getRemains() != "")
     140          std::cout << "Warning: Expression could not be parsed to the end! Remains: '"
     141              << expr.getRemains() << "'" << std::endl;
    140142      }
    141143      else
Note: See TracChangeset for help on using the changeset viewer.