Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 12, 2008, 3:34:55 PM (17 years ago)
Author:
landauf
Message:

extracted all config-value related macros from CoreIncludes.h and moved them to ConfigValueIncludes.h.

ConfigValueContainer can now handle std::vector<x> where 'x' is is any type supported by MultiTypeMath (all primitives, pointer, string, vector2, vector3, quaternion, colourvalue, radian, degree).

the vectors size is currently limited to 256 elements. this is just a practical limit, it can be raised if it's necessary. the reason for the limit is: you can add new elements to a vector by simply typing 'set classname varname index value' into the console or adding a new entry in the config-file. if 'index' is bigger than the vectors size, all elements up to 'index' are inserted. if the user accidentally enters a big number, he could end up with >4*109 elements in his config-file, resulting in 10-100gb on the hdd and a completely filled memory. and that's not exactly what i want ;)

Location:
code/branches/core2/src/orxonox/objects
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/orxonox/objects/Fighter.cc

    r790 r1030  
    3737#include "util/tinyxml/tinyxml.h"
    3838#include "util/String2Number.h"
    39 #include "../core/CoreIncludes.h"
     39#include "core/CoreIncludes.h"
     40#include "core/ConfigValueIncludes.h"
    4041#include "../Orxonox.h"
    4142#include "../particle/ParticleInterface.h"
  • code/branches/core2/src/orxonox/objects/Projectile.cc

    r995 r1030  
    3030#include "core/CoreIncludes.h"
    3131#include "core/Executor.h"
     32#include "core/ConfigValueIncludes.h"
    3233
    3334#include "SpaceShip.h"
  • code/branches/core2/src/orxonox/objects/SpaceShip.cc

    r955 r1030  
    3939#include "util/String2Number.h"
    4040#include "util/Math.h"
    41 #include "../core/CoreIncludes.h"
    42 #include "../core/Debug.h"
     41#include "core/CoreIncludes.h"
     42#include "core/ConfigValueIncludes.h"
     43#include "core/Debug.h"
    4344#include "../Orxonox.h"
    4445#include "../particle/ParticleInterface.h"
  • code/branches/core2/src/orxonox/objects/test3.cc

    r871 r1030  
    3030#include "test3.h"
    3131#include "core/CoreIncludes.h"
     32#include "core/ConfigValueIncludes.h"
    3233
    3334namespace orxonox
     
    5657        SetConfigValue(value_vector3_, Vector3(13, 26, 39));
    5758        SetConfigValue(value_colourvalue_, ColourValue(1.0, 0.5, 0.25, 0.887));
     59        SetConfigValueVector(vector_int_, std::vector<int>(1, 13));
     60        SetConfigValueVector(vector_string_, std::vector<std::string>(3, "nothing"));
     61        SetConfigValueVector(vector_vector3_, std::vector<Vector3>(1, Vector3(3, 2, 1)));
    5862    }
    5963
     
    6468    void Test3::configOutput()
    6569    {
    66         std::cout << "int:         " << this->value_int_ << std::endl;
    67         std::cout << "uint:        " << this->value_uint_ << std::endl;
    68         std::cout << "char:        " << (int)this->value_char_ << std::endl;
    69         std::cout << "uchar:       " << (int)this->value_uchar_ << std::endl;
    70         std::cout << "float:       " << this->value_float_ << std::endl;
    71         std::cout << "double:      " << this->value_double_ << std::endl;
    72         std::cout << "bool:        " << this->value_bool_ << std::endl;
    73         std::cout << "string:      " << this->value_string_ << std::endl;
    74         std::cout << "constchar:   " << this->value_constchar_ << std::endl;
    75         std::cout << "vector2:     " << this->value_vector2_ << std::endl;
    76         std::cout << "vector3:     " << this->value_vector3_ << std::endl;
    77         std::cout << "colourvalue: " << this->value_colourvalue_ << std::endl;
     70        std::cout << "int:             " << this->value_int_ << std::endl;
     71        std::cout << "uint:            " << this->value_uint_ << std::endl;
     72        std::cout << "char:            " << (int)this->value_char_ << std::endl;
     73        std::cout << "uchar:           " << (int)this->value_uchar_ << std::endl;
     74        std::cout << "float:           " << this->value_float_ << std::endl;
     75        std::cout << "double:          " << this->value_double_ << std::endl;
     76        std::cout << "bool:            " << this->value_bool_ << std::endl;
     77        std::cout << "string:         >" << this->value_string_ << "<" << std::endl;
     78        std::cout << "constchar:      >" << this->value_constchar_ << "<" << std::endl;
     79        std::cout << "vector2:         " << this->value_vector2_ << std::endl;
     80        std::cout << "vector3:         " << this->value_vector3_ << std::endl;
     81        std::cout << "colourvalue:     " << this->value_colourvalue_ << std::endl;
     82        std::cout << std::endl;
     83        for (unsigned int i = 0; i < this->vector_int_.size(); i++)
     84        std::cout << "vector<int>:     " << i << ": " << this->vector_int_[i] << std::endl;
     85        for (unsigned int i = 0; i < this->vector_string_.size(); i++)
     86        std::cout << "vector<string>:  " << i << ": " << this->vector_string_[i] << std::endl;
     87        for (unsigned int i = 0; i < this->vector_vector3_.size(); i++)
     88        std::cout << "vector<vector3>: " << i << ": " << this->vector_vector3_[i] << std::endl;
    7889    }
    7990
  • code/branches/core2/src/orxonox/objects/test3.h

    r871 r1030  
    11#ifndef _Test3_H__
    22#define _Test3_H__
     3
     4#include <vector>
    35
    46#include "core/BaseObject.h"
     
    3638            Vector3             value_vector3_;
    3739            ColourValue         value_colourvalue_;
     40
     41            std::vector<int>         vector_int_;
     42            std::vector<std::string> vector_string_;
     43            std::vector<Vector3>     vector_vector3_;
    3844    };
    3945}
Note: See TracChangeset for help on using the changeset viewer.