Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5539 in orxonox.OLD


Ignore:
Timestamp:
Nov 11, 2005, 12:49:20 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: some minor typo's in the MultiType class

Location:
trunk/src/lib/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/multi_type.cc

    r5538 r5539  
    1717
    1818#include "multi_type.h"
    19 #include "stdincl.h"
     19#include <stddef.h>
     20#include <stdlib.h>
     21#include <string.h>
     22#include <stdio.h>
    2023
    2124using namespace std;
     
    3740
    3841
    39 MultiType::MultiType(float value)
     42MultiType::MultiType(double value)
    4043{
    4144  this->init();
     
    8790  else if (this->type & MT_FLOAT) return (this->value.Float == 0.0f)? false : true;
    8891  else if (this->type & MT_CHAR) return (this->value.Char == '\0')? false : true;
    89   else if (this->type & MT_STRING) return (!strncmp(this->value.String, "true", 4) || !strncmp(this->value.String, "TRUE", 4) || !strncmp(this->value.String, "1", 1))? true : false;
     92  else if (this->type & MT_STRING) return (!strncmp(this->value.String, "true", 4) || !strncmp(this->value.String, "TRUE", 4) || !strncmp(this->value.String, "1", 1))? true : false; //! @TODO make this better.
    9093
    9194  return false;
     
    117120{
    118121 // default case:
    119   if (this->type & MT_FLOAT) return this->value.Float;
    120     return this->value.Int;
    121   if (this->type & MT_BOOL) return (this->value.Bool)? 1.0f : 0.0f;
     122  if (this->type & MT_FLOAT)
     123    return this->value.Float;
     124  if (this->type & MT_BOOL) return (this->value.Bool == true)? 1.0f : 0.0f;
    122125  else if (this->type & MT_INT) return (float) this->value.Int;
    123126  else if (this->type & MT_CHAR) return (float) this->value.Char;
     
    125128    char* endPtr = NULL;
    126129    double result = strtod(this->value.String, &endPtr);
    127 
    128130    if ( endPtr >= this->value.String && endPtr < this->value.String + strlen(this->value.String))
    129131      return 0.0f;
  • trunk/src/lib/util/multi_type.h

    r5537 r5539  
    3232   MultiType(bool value);
    3333   MultiType(int value);
    34    MultiType(float value);
     34   MultiType(double value);
    3535   MultiType(char value);
    3636   MultiType(const char* value);
Note: See TracChangeset for help on using the changeset viewer.