Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5644 in orxonox.OLD for trunk


Ignore:
Timestamp:
Nov 19, 2005, 5:08:53 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: better loadparam start and end-cycle.

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_command_class.cc

    r5642 r5644  
    221221}
    222222
     223/**
     224 * displays help about ShellCommandClass
     225 * @param className: the Class of Commands to show help about
     226 */
    223227void ShellCommandClass::help(const char* className)
    224228{
  • trunk/src/lib/util/multi_type.h

    r5643 r5644  
    2222  MT_EXT1            = 32,                 //!< An external Type.
    2323  MT_EXT2            = 64,                 //!< An external Type.
    24 
    2524} MT_Type;
    2625
  • trunk/src/util/loading/load_param.h

    r5556 r5644  
    7575 * called element, and that you must say true at the Fith parameter, or it will fail
    7676 * also you will have to close the Cycle again with LOAD_PARAM_END_CYCLE
    77  */
    78 #define LOAD_PARAM_START_CYCLE   const TiXmlElement* element; \
    79                                  element = root->FirstChildElement(); \
    80                                  while( element != NULL) \
    81 {
    82 /**
    83    * closes a LoadParam Loop
    84    * @see LOAD_PARAM_START_CYCLE
    85  */
    86 #define LOAD_PARAM_END_CYCLE        element = element->NextSiblingElement(); \
    87 }
     77 * @param ROOT The root XLM-element to search element under.
     78 * @param ELEMENT the element to search
     79 */
     80#define LOAD_PARAM_START_CYCLE(ROOT, ELEMENT) \
     81  const TiXmlElement* ELEMENT; \
     82  ELEMENT= ROOT->FirstChildElement(); \
     83  while( ELEMENT != NULL) \
     84  {
     85/**
     86 * closes a LoadParam Loop
     87 * @see LOAD_PARAM_START_CYCLE
     88 * @param ELEMENT the Element to step through.
     89 */
     90#define LOAD_PARAM_END_CYCLE(ELEMENT) \
     91  ELEMENT = ELEMENT->NextSiblingElement(); \
     92  }
    8893
    8994
  • trunk/src/util/track/track_manager.cc

    r5344 r5644  
    398398  double x, y, z, d;
    399399
    400   LOAD_PARAM_START_CYCLE
     400  LOAD_PARAM_START_CYCLE(root, element)
    401401
    402402      LoadParam<TrackManager>(element, "WorkOn", this, &TrackManager::workOnS, true)
     
    445445        }
    446446      */
    447       LOAD_PARAM_END_CYCLE;
     447      LOAD_PARAM_END_CYCLE(element);
    448448}
    449449
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r5441 r5644  
    122122      .describe("how many slots(cannons) the WeaponManager can handle");
    123123
    124   LOAD_PARAM_START_CYCLE;
     124  LOAD_PARAM_START_CYCLE(root, element);
    125125
    126126  LoadParam<WeaponManager>(element, "weapons", this, &WeaponManager::loadWeapons)
     
    128128      // LoadParam<WeaponManager>(root, "Weapon", this, &WeaponManager::addWeapon);
    129129
    130   LOAD_PARAM_END_CYCLE;
     130  LOAD_PARAM_END_CYCLE(element);
    131131}
    132132
     
    137137void WeaponManager::loadWeapons(const TiXmlElement* root)
    138138{
    139   LOAD_PARAM_START_CYCLE;
     139  LOAD_PARAM_START_CYCLE(root, element);
    140140
    141141  Weapon* newWeapon = dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(element));
     
    143143
    144144
    145   LOAD_PARAM_END_CYCLE;
     145  LOAD_PARAM_END_CYCLE(element);
    146146}
    147147
Note: See TracChangeset for help on using the changeset viewer.