Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8300 in orxonox.OLD for branches/script_engine


Ignore:
Timestamp:
Jun 9, 2006, 4:20:36 PM (18 years ago)
Author:
bensch
Message:

script_engine: fixed the LoadParam-Bug that prevented loading of two Parameters

Location:
branches/script_engine/src/lib/util
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/lib/util/executor/executor.h

    r8271 r8300  
    3333 *  Objects of any Class (Templated)
    3434 *  Default Values
    35  *  Functions with up to 5 parameters (more seems useless)
     35 *  Functions with up to 5 parameters (more seems overhead, split up the function)
    3636 *  Functions with many types (@see functor_list.h)
    3737 */
  • branches/script_engine/src/lib/util/executor/executor_functional.cc

    r8035 r8300  
    1515
    1616#include "executor.h"
    17 
    18 std::string ExecutorFunctional_returningString_from;
    19 std::string ExecutorFunctional_returningString_default;
     17std::string ExecutorFunctional_returningString_from[5];
    2018
    2119
     
    3230template<> float fromString<float>(const std::string& input, float defaultValue) { return isFloat(input, defaultValue); };
    3331template<> char fromString<char>(const std::string& input, char defaultValue) { return isInt(input, defaultValue); };
    34 template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { return ExecutorFunctional_returningString_from = isString(input, defaultValue); };
     32template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { return (input.size() > 0) ? input : defaultValue; };
    3533
    3634
     
    4846template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getFloat(); };
    4947template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getChar(); };
    50 template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return ExecutorFunctional_returningString_default = defaultValues[i].getString(); };
     48template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return ExecutorFunctional_returningString_from[i] = defaultValues[i].getString(); };
    5149
    5250
  • branches/script_engine/src/lib/util/loading/load_param.cc

    r7721 r8300  
    2929 */
    3030CLoadParam::CLoadParam(const TiXmlElement* root, const std::string& paramName, BaseObject* object, Executor* executor, bool inLoadCycle)
    31   :  paramName(paramName), object(object)
    32 {
    33   this->object = object;
     31  :  object(object), paramName(paramName)
     32{
    3433  this->inLoadCycle = inLoadCycle;
    3534
  • branches/script_engine/src/lib/util/substring.h

    r7477 r8300  
    7070  inline unsigned int size() const { return this->strings.size(); };
    7171  /** @param i the i'th String @returns the i'th string from the subset of Strings */
    72 const std::string& operator[](unsigned int i) const { return (i < this->strings.size()) ? this->strings[i] : emptyString;return this->getString(i); };
     72  inline const std::string& operator[](unsigned int i) const { return (i < this->strings.size()) ? this->strings[i] : emptyString; };
    7373  /** @param i the i'th String @returns the i'th string from the subset of Strings */
    74   const std::string& getString(unsigned int i) const { return (*this)[i]; };
     74  inline const std::string& getString(unsigned int i) const { return (*this)[i]; };
    7575
    7676  // the almighty algorithm.
Note: See TracChangeset for help on using the changeset viewer.