Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4223 in orxonox.OLD


Ignore:
Timestamp:
May 19, 2005, 7:45:28 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: merged back the Trunk into the Physics-branche
merged with command:
svn merge -r 4178:HEAD ../trunk/ physics
no conflicts in relevant files

Location:
orxonox/branches/physics/src
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/Makefile.am

    r4185 r4223  
    8383                 lib/lang/base_object.cc \
    8484                 lib/util/ini_parser.cc \
     85                 lib/util/substring.cc \
    8586                 util/common/list.cc \
    8687                 util/resource_manager.cc \
     
    167168                 util/physics/fields/twirl.h \
    168169                 lib/util/ini_parser.h \
     170                 lib/util/substring.h \
    169171                 lib/math/vector.h \
    170172                 lib/math/curve.h \
  • orxonox/branches/physics/src/Makefile.in

    r4185 r4223  
    8787        particle_system.$(OBJEXT) particle_emitter.$(OBJEXT) \
    8888        base_entity.$(OBJEXT) base_object.$(OBJEXT) \
    89         ini_parser.$(OBJEXT) list.$(OBJEXT) resource_manager.$(OBJEXT) \
    90         i_physics.$(OBJEXT) physics_engine.$(OBJEXT) \
    91         physics_connection.$(OBJEXT) field.$(OBJEXT) gravity.$(OBJEXT) \
    92         point_gravity.$(OBJEXT) twirl.$(OBJEXT) vector.$(OBJEXT) \
    93         curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT) tinyxml.$(OBJEXT) \
     89        ini_parser.$(OBJEXT) substring.$(OBJEXT) list.$(OBJEXT) \
     90        resource_manager.$(OBJEXT) i_physics.$(OBJEXT) \
     91        physics_engine.$(OBJEXT) physics_connection.$(OBJEXT) \
     92        field.$(OBJEXT) gravity.$(OBJEXT) point_gravity.$(OBJEXT) \
     93        twirl.$(OBJEXT) vector.$(OBJEXT) curve.$(OBJEXT) \
     94        glmenu_imagescreen.$(OBJEXT) tinyxml.$(OBJEXT) \
    9495        tinystr.$(OBJEXT) tinyxmlerror.$(OBJEXT) \
    9596        tinyxmlparser.$(OBJEXT) benchmark.$(OBJEXT)
     
    143144@AMDEP_TRUE@    ./$(DEPDIR)/satellite.Po ./$(DEPDIR)/skybox.Po \
    144145@AMDEP_TRUE@    ./$(DEPDIR)/skysphere.Po \
    145 @AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/terrain.Po \
     146@AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po \
     147@AMDEP_TRUE@    ./$(DEPDIR)/substring.Po ./$(DEPDIR)/terrain.Po \
    146148@AMDEP_TRUE@    ./$(DEPDIR)/test_bullet.Po ./$(DEPDIR)/test_gun.Po \
    147149@AMDEP_TRUE@    ./$(DEPDIR)/text_engine.Po ./$(DEPDIR)/texture.Po \
     
    331333                 lib/lang/base_object.cc \
    332334                 lib/util/ini_parser.cc \
     335                 lib/util/substring.cc \
    333336                 util/common/list.cc \
    334337                 util/resource_manager.cc \
     
    415418                 util/physics/fields/twirl.h \
    416419                 lib/util/ini_parser.h \
     420                 lib/util/substring.h \
    417421                 lib/math/vector.h \
    418422                 lib/math/curve.h \
     
    468472          esac; \
    469473        done; \
    470         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
     474        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
    471475        cd $(top_srcdir) && \
    472           $(AUTOMAKE) --foreign  src/Makefile
     476          $(AUTOMAKE) --gnu  src/Makefile
    473477.PRECIOUS: Makefile
    474478Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    586590@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
    587591@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@
     592@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/substring.Po@am__quote@
    588593@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terrain.Po@am__quote@
    589594@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bullet.Po@am__quote@
     
    14021407@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    14031408@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ini_parser.obj `if test -f 'lib/util/ini_parser.cc'; then $(CYGPATH_W) 'lib/util/ini_parser.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/ini_parser.cc'; fi`
     1409
     1410substring.o: lib/util/substring.cc
     1411@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT substring.o -MD -MP -MF "$(DEPDIR)/substring.Tpo" -c -o substring.o `test -f 'lib/util/substring.cc' || echo '$(srcdir)/'`lib/util/substring.cc; \
     1412@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/substring.Tpo" "$(DEPDIR)/substring.Po"; else rm -f "$(DEPDIR)/substring.Tpo"; exit 1; fi
     1413@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/util/substring.cc' object='substring.o' libtool=no @AMDEPBACKSLASH@
     1414@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/substring.Po' tmpdepfile='$(DEPDIR)/substring.TPo' @AMDEPBACKSLASH@
     1415@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1416@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o substring.o `test -f 'lib/util/substring.cc' || echo '$(srcdir)/'`lib/util/substring.cc
     1417
     1418substring.obj: lib/util/substring.cc
     1419@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT substring.obj -MD -MP -MF "$(DEPDIR)/substring.Tpo" -c -o substring.obj `if test -f 'lib/util/substring.cc'; then $(CYGPATH_W) 'lib/util/substring.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/substring.cc'; fi`; \
     1420@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/substring.Tpo" "$(DEPDIR)/substring.Po"; else rm -f "$(DEPDIR)/substring.Tpo"; exit 1; fi
     1421@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/util/substring.cc' object='substring.obj' libtool=no @AMDEPBACKSLASH@
     1422@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/substring.Po' tmpdepfile='$(DEPDIR)/substring.TPo' @AMDEPBACKSLASH@
     1423@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1424@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o substring.obj `if test -f 'lib/util/substring.cc'; then $(CYGPATH_W) 'lib/util/substring.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/substring.cc'; fi`
    14041425
    14051426list.o: util/common/list.cc
  • orxonox/branches/physics/src/game_loader.cc

    r4178 r4223  
    7474   this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
    7575*/
    76 ErrorMessage GameLoader::loadCampaign(char* name)
     76ErrorMessage GameLoader::loadCampaign(const char* name)
    7777{
    7878  ErrorMessage errorCode;
    79   char* campaignName;
    80   if (ResourceManager::isFile(name))
    81     {
    82       this->currentCampaign = this->fileToCampaign(name);
    83     }
    84   else
    85     {
    86       campaignName = new char[strlen(ResourceManager::getInstance()->getDataDir())+strlen(name)];
    87       sprintf(campaignName, "%s%s", ResourceManager::getInstance()->getDataDir(), name);
     79  char* campaignName = ResourceManager::getFullName(name);
     80  if (campaignName)
     81    {
    8882      this->currentCampaign = this->fileToCampaign(campaignName);
    8983      delete campaignName;
  • orxonox/branches/physics/src/game_loader.h

    r4178 r4223  
    3939
    4040  ErrorMessage init();
    41   ErrorMessage loadCampaign(char* name);
     41  ErrorMessage loadCampaign(const char* name);
    4242  ErrorMessage start();
    4343  ErrorMessage stop();
  • orxonox/branches/physics/src/lib/Makefile.in

    r4178 r4223  
    183183          esac; \
    184184        done; \
    185         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/Makefile'; \
     185        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/Makefile'; \
    186186        cd $(top_srcdir) && \
    187           $(AUTOMAKE) --foreign  src/lib/Makefile
     187          $(AUTOMAKE) --gnu  src/lib/Makefile
    188188.PRECIOUS: Makefile
    189189Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/physics/src/lib/graphics/Makefile.in

    r4178 r4223  
    177177          esac; \
    178178        done; \
    179         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/Makefile'; \
     179        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/Makefile'; \
    180180        cd $(top_srcdir) && \
    181           $(AUTOMAKE) --foreign  src/lib/graphics/Makefile
     181          $(AUTOMAKE) --gnu  src/lib/graphics/Makefile
    182182.PRECIOUS: Makefile
    183183Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/physics/src/lib/graphics/importer/Makefile.in

    r4178 r4223  
    235235          esac; \
    236236        done; \
    237         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile'; \
     237        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile'; \
    238238        cd $(top_srcdir) && \
    239           $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile
     239          $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile
    240240.PRECIOUS: Makefile
    241241Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/physics/src/lib/gui/Makefile.in

    r4178 r4223  
    179179          esac; \
    180180        done; \
    181         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/Makefile'; \
     181        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/Makefile'; \
    182182        cd $(top_srcdir) && \
    183           $(AUTOMAKE) --foreign  src/lib/gui/Makefile
     183          $(AUTOMAKE) --gnu  src/lib/gui/Makefile
    184184.PRECIOUS: Makefile
    185185Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/physics/src/lib/gui/console/Makefile.in

    r4178 r4223  
    205205          esac; \
    206206        done; \
    207         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile'; \
     207        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile'; \
    208208        cd $(top_srcdir) && \
    209           $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile
     209          $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile
    210210.PRECIOUS: Makefile
    211211Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/physics/src/lib/gui/gui/Makefile.in

    r4178 r4223  
    265265          esac; \
    266266        done; \
    267         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile'; \
     267        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile'; \
    268268        cd $(top_srcdir) && \
    269           $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile
     269          $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile
    270270.PRECIOUS: Makefile
    271271Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/physics/src/lib/util/substring.cc

    r4178 r4223  
    2222#include "substring.h"
    2323
     24#include <string.h>
     25#include <assert.h>
     26
    2427SubString::SubString( const char* string)
    2528{
    26         n = 0;
     29  n = 0;
    2730       
    28         assert( string != NULL);
     31  assert( string != NULL);
    2932       
    30         for( int i = 0; i < strlen(string); i++) if( string[i] == ',') n++;
     33  for( int i = 0; i < strlen(string); i++) if( string[i] == ',') n++;
    3134
    32         n += 1;
     35  n += 1;
    3336       
    34         strings = new char*[n];
     37  strings = new char*[n];
     38
     39  assert (strings != NULL);
    3540       
    36         assert( strings != NULL);
     41  int i = 0;
     42  int l = 0;
    3743       
    38         int i = 0;
    39         int l = 0;
     44  const char* offset = string;
     45  char* end = strchr( string, ',');
     46  while( end != NULL)
     47    {
     48      assert( i < n);
     49      l = end - offset;
     50      strings[i] = new char[l + 1];
     51      assert( strings[i] != NULL);
     52      strncpy( strings[i], offset, l);
     53      strings[i][l] = 0;
     54      i++;
     55      end++;
     56      offset = end;
     57      end = strchr( offset, ',');
     58    }
    4059       
    41         const char* offset = string;
    42         char* end = strchr( string, ',');
    43         while( end != NULL)
    44         {
    45                 assert( i < n);
    46                 l = end - offset;
    47                 strings[i] = new char[l + 1];
    48                 assert( strings[i] != NULL);
    49                 strncpy( strings[i], offset, l);
    50                 strings[i][l] = 0;
    51                 i++;
    52                 end++;
    53                 offset = end;
    54                 end = strchr( offset, ',');
    55         }
    56        
    57         strings[i] = new char[l + 1];
    58         l = strlen( offset);
    59         strncpy( strings[i], offset, l);
    60         strings[i][l] = 0;
     60  strings[i] = new char[l + 1];
     61  l = strlen( offset);
     62  strncpy( strings[i], offset, l);
     63  strings[i][l] = 0;
    6164}
    6265
     
    6669SubString::~SubString()
    6770{
    68         for( int i = 0; i < n; i++)
    69         {
    70                 delete strings[i];
    71         }
     71  for( int i = 0; i < n; i++)
     72    {
     73      delete strings[i];
     74    }
    7275       
    73         delete strings;
     76  delete strings;
    7477}
    7578
     
    7881   \returns the amount of substrings
    7982*/
    80 int SubString::getN()
     83int SubString::getCount()
    8184{
    82         return n;
     85  return n;
    8386}
    8487
     
    9093const char* SubString::getString( int i)
    9194{
    92         if( i < n && i >= 0) return strings[i];
    93         else return NULL;
     95  if( i < n && i >= 0) return strings[i];
     96  else return NULL;
    9497}
  • orxonox/branches/physics/src/lib/util/substring.h

    r4178 r4223  
    11/*!
    2     \file substring.h
    3     \brief a small class to get the parts of a string separated by commas
     2  \file substring.h
     3  \brief a small class to get the parts of a string separated by commas
    44*/
    55
     
    77#define _SUBSTRING_H
    88
    9 #include "stdincl.h"
    10 
    119class SubString
    1210{
    13         public:
     11 public:
    1412       
    15                 SubString( const char* string);
    16                 ~SubString();
     13  SubString( const char* string);
     14  ~SubString();
    1715               
    18                 int getN();
    19                 const char* getString( int i);
     16  int getCount();
     17  const char* getString( int i);
    2018               
    21         private:
    22                 char** strings;
    23                 int n;
     19 private:
     20  char** strings;
     21  int n;
    2422};
    2523
  • orxonox/branches/physics/src/story_entities/world.cc

    r4193 r4223  
    365365 
    366366  // find Track
    367   /*element = root->FirstChildElement( "Track");
     367  element = root->FirstChildElement( "Track");
    368368  if( element == NULL)
    369369    {
     
    375375      PRINTF0("============>>>>>>>>>>>>>>>>Loading Track\n");
    376376
    377       trackManager->loadTrack( element);
     377      trackManager->load( element);
    378378      trackManager->finalize();
    379379      PRINTF0("============>>>>>>>>>>>>>>>>Done loading Track\n");
    380     }*/
     380    }
    381381 
    382382  // free the XML data
     
    395395 
    396396  // stuff beyond this point remains to be loaded properly
    397  
     397  /*
    398398      // initializing the TrackManager
    399399  this->trackManager = TrackManager::getInstance();
     
    403403      trackManager->addPoint(Vector(250, -35, 5));
    404404      trackManager->addPoint(Vector(320,-33,-.55));
    405       trackManager->setDuration(2);
     405      trackManager->setDuration(1);
    406406      trackManager->setSavePoint();
    407407
     
    410410      trackManager->addPoint(Vector(550, 20, -10));
    411411      trackManager->addPoint(Vector(570, 20, -10));
    412       trackManager->setDuration(5);
     412      trackManager->setDuration(2);
    413413     
    414       int fork11, fork12;
    415       trackManager->fork(2, &fork11, &fork12);
    416       trackManager->workOn(fork11);
     414      trackManager->forkS("testFork1,testFork2");
     415      trackManager->workOn("testFork1");
    417416      trackManager->addPoint(Vector(640, 25, -30));
    418417      trackManager->addPoint(Vector(700, 40, -120));
     
    423422      trackManager->addPoint(Vector(1050, 65, -10));
    424423      trackManager->addPoint(Vector(1100, 65, -20));
    425       trackManager->setDuration(10);
    426 
    427       trackManager->workOn(fork12);
     424      trackManager->setDuration(4);
     425
     426      trackManager->workOn("testFork2");
    428427      trackManager->addPoint(Vector(640, 25, 20));
    429428      trackManager->addPoint(Vector(670, 50, 120));
     
    435434      trackManager->addPoint(Vector(970, 24, 40));
    436435      trackManager->addPoint(Vector(1000, 40, -7));
    437       trackManager->setDuration(10);
     436      trackManager->setDuration(4);
    438437     
    439 
    440       trackManager->join(2, fork11, fork12);
    441 
    442       trackManager->workOn(5);
     438     
     439      trackManager->joinS("testFork1,testFork2");
     440       
    443441      trackManager->addPoint(Vector(1200, 60, -50));
    444442      trackManager->addPoint(Vector(1300, 50, -50));
     
    451449      trackManager->addPoint(Vector(1800, 100, -40));
    452450      trackManager->setDuration(10);
    453 
     451  */
    454452      trackManager->finalize();
    455453
     
    483481  glNewList (objectList, GL_COMPILE);
    484482 
    485   //  trackManager->drawGraph(.01);
     483  trackManager->drawGraph(.01);
    486484  trackManager->debug(2);
    487485  glEndList();
  • orxonox/branches/physics/src/subprojects/Makefile.in

    r4178 r4223  
    177177          esac; \
    178178        done; \
    179         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/Makefile'; \
     179        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/Makefile'; \
    180180        cd $(top_srcdir) && \
    181           $(AUTOMAKE) --foreign  src/subprojects/Makefile
     181          $(AUTOMAKE) --gnu  src/subprojects/Makefile
    182182.PRECIOUS: Makefile
    183183Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/physics/src/subprojects/testmain/Makefile.in

    r4178 r4223  
    197197          esac; \
    198198        done; \
    199         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/subprojects/testmain/Makefile'; \
     199        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/subprojects/testmain/Makefile'; \
    200200        cd $(top_srcdir) && \
    201           $(AUTOMAKE) --foreign  src/subprojects/testmain/Makefile
     201          $(AUTOMAKE) --gnu  src/subprojects/testmain/Makefile
    202202.PRECIOUS: Makefile
    203203Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/branches/physics/src/track_manager.cc

    r4178 r4223  
    2525#include "text_engine.h"
    2626#include "t_animation.h"
     27#include "substring.h"
    2728
    2829#include <stdarg.h>
     
    401402   \brief loads a trackElement from a TiXmlElement
    402403   \param root the TiXmlElement to load the Data from
    403 
    404404*/
    405405bool TrackManager::load( TiXmlElement* root)
    406406{
     407  TiXmlElement* element;
     408  TiXmlNode* container;
     409  double x, y, z, d;
     410       
     411  element = root->FirstChildElement();
     412       
     413  while( element != NULL)
     414    {
     415      if( !strcmp( element->Value(), "Point"))
     416        {
     417          container = element->FirstChild();
     418          if( container->ToText())
     419            {
     420              assert( container->Value() != NULL);
     421              if( sscanf( container->Value(), "%lf,%lf,%lf", &x, &y, &z) == 3)
     422                {
     423                  PRINTF(0)("Loaded Point: %lf,%lf,%lf (%s)\n", x, y, z, container->Value());
     424                  addPoint( Vector( x, y, z));
     425                }
     426              else
     427                {
     428                  PRINTF(0)("Invalid Point in Track (skipped)\n");
     429                }                       
     430            }
     431        }
     432      else if( !strcmp( element->Value(), "Duration"))
     433        {
     434          container = element->FirstChild();
     435          if( container->ToText())
     436            {
     437              assert( container->Value() != NULL);
     438              if( sscanf( container->Value(), "%lf", &d) == 1)
     439                {
     440                  PRINTF(5)("Loaded Duration: %lf (%s)\n", d, container->Value());
     441                  setDuration( d);
     442                }
     443              else
     444                {
     445                  PRINTF(2)("Invalid Duration in Track (skipped)\n");
     446                }                       
     447            }
     448        }
     449      else if( !strcmp( element->Value(), "SavePoint"))
     450        {
     451          PRINTF(5)("Loaded Savepoint\n");
     452          setSavePoint();
     453        }
     454      else if( !strcmp( element->Value(), "Fork"))
     455        {
     456          container = element->FirstChild();
     457          if( container->ToText())
     458            {
     459              assert( container->Value() != NULL);
     460              PRINTF(4)("Loaded Fork: %s\n", container->Value());
     461              forkS(container->Value());
     462            }
     463        }
     464      else if( !strcmp( element->Value(), "Join"))
     465        {
     466          container = element->FirstChild();
     467          if( container->ToText())
     468            {
     469              assert( container->Value() != NULL);
     470              PRINTF0("Loaded Join: %s\n", container->Value());
     471              joinS(container->Value());
     472            }
     473        }
     474      else if( !strcmp( element->Value(), "WorkOn"))
     475        {
     476          container = element->FirstChild();
     477          if( container->ToText())
     478            {
     479              assert( container->Value() != NULL);
     480              PRINTF(4)("Loaded WorkOn: %s\n", container->Value());
     481              workOn( container->Value());
     482            }
     483        }
     484               
     485      element = element->NextSiblingElement();
     486    }
    407487
    408488}
     
    620700/**
    621701   \brief adds some interessting non-linear movments through the level.
    622    \param count The Count of childrens the current HotPoint will have.
     702   \param count The Count of children the fork will produce
    623703
    624704   If no HotPoint was defined the last added Point will be rendered into a fork. \n
     
    628708{
    629709  int* trackIDs = new int[count];
    630   this->forkV(count, trackIDs);
     710  this->forkV(count, trackIDs, NULL);
    631711  va_list ID;
    632712  va_start (ID, count);
     
    640720
    641721/**
     722   \param string the String to parse.
     723   \see TrackManager::fork(unsigned int count, ...)
     724
     725   does the same as fork, but has an array of strings as an input.
     726*/
     727void TrackManager::forkS(unsigned int count, ...)
     728{
     729  int* trackIDs = new int[count];
     730  this->forkV(count, trackIDs, NULL);
     731  va_list name;
     732  va_start (name, count);
     733  for(int i = 0; i < count; i++)
     734    {
     735      this->firstTrackElem->findByID(trackIDs[i])->setName(va_arg(name, const char*));
     736    }
     737  va_end(name); 
     738  delete []trackIDs;
     739}
     740
     741/**
     742   \see TrackManager::fork(unsigned int count, ...)
     743*/
     744void TrackManager::forkS(const char* forkString)
     745{
     746  SubString strings(forkString);
     747
     748  int* trackIDs = new int[strings.getCount()];
     749  this->forkV(strings.getCount(), trackIDs, NULL);
     750
     751  for(int i = 0; i < strings.getCount(); i++)
     752    {
     753      this->firstTrackElem->findByID(trackIDs[i])->setName(strings.getString(i));
     754    } 
     755}
     756
     757/**
    642758   \brief adds some interessting non-linear movments through the level.
    643759   \param count The Count of childrens the current HotPoint will have.
    644760   \param trackIDs A Pointer to an Array of ints which will hold the trackID's (the user will have to reserve space for this).
    645    \param trackElem The TrackElement to appy this to. (if NULL chose this->currentTrackElement)
     761   \param trackElem The TrackElement to appy this to. (if NULL choose this->currentTrackElement)
    646762   \see TrackManager::fork(unsigned int count, ...)
    647763*/
    648 void TrackManager::forkV(unsigned int count, int* trackIDs, TrackElement* trackElem)
     764void TrackManager::forkV(unsigned int count, int* trackIDs, char** trackNames, TrackElement* trackElem)
    649765{
    650766  if (!trackElem)
     
    738854   \brief Joins some Tracks together again.
    739855   \param count The count of trackElements to join
    740 
    741856   \see void TrackManager::join(unsigned int count, ...)
     857
    742858   The difference to void TrackManager::join(unsigned int count, ...) is, that this function takes
    743859   the Names of the TrackElements as inputs and not their ID
    744860*/
    745 void TrackManager::joinc(unsigned int count, ...)
     861void TrackManager::joinS(unsigned int count, ...)
    746862{
    747863  int* trackIDs = new int [count];
     
    750866  for(int i = 0; i < count; i++)
    751867    {
    752       char* name = va_arg (NAME, char*);
     868      const char* name = va_arg (NAME, char*);
    753869      TrackElement* tmpElem = this->firstTrackElem->findByName(name);
    754870      if (tmpElem)
     
    762878}
    763879
     880/**
     881   \see void TrackManager::join(unsigned int count, ...)
     882*/
     883void TrackManager::joinS(const char* joinString)
     884{
     885  SubString strings(joinString);
     886
     887  int* trackIDs = new int[strings.getCount()];
     888  this->joinV(strings.getCount(), trackIDs);
     889
     890  for(int i = 0; i < strings.getCount(); i++)
     891    {
     892      TrackElement* tmpElem = this->firstTrackElem->findByName(strings.getString(i));
     893      if (tmpElem)
     894        trackIDs[i] = tmpElem->ID;
     895      else
     896        PRINTF(1)("Trying to join a Track, of which the name does not exist: %s\n", strings.getString(i));
     897    }
     898
     899  this->joinV(strings.getCount(), trackIDs);
     900  delete []trackIDs;
     901}
    764902
    765903/**
     
    777915    if (!this->firstTrackElem->findByID(trackIDs[i]))
    778916      {
    779         PRINTF(1)("Error trying to Connect Paths that do not exist yet: %d\n Not Joining Anything", trackIDs[i]);
     917        PRINTF(1)("Trying to Connect Paths that do not exist yet: %d\n Not Joining Anything\n", trackIDs[i]);
    780918        return;
    781919      }
  • orxonox/branches/physics/src/track_manager.h

    r4178 r4223  
    167167  int setSavePoint(TrackElement* trackElem = NULL);
    168168  void fork(unsigned int count, ...);
    169   void forkV(unsigned int count, int* trackIDs, TrackElement* trackElem = NULL);
     169  void forkS(unsigned int count, ...);
     170  void forkS(const char* forkString);
     171  void forkV(unsigned int count, int* trackIDs, char** trackNames, TrackElement* trackElem = NULL);
    170172  void condition(unsigned int trackID, CONDITION cond, void* subject);
    171173  void condition(CONDITION cond, void* subject, TrackElement* trackElem = NULL);
    172174  void join(unsigned int count, ...);
    173   void joinc(unsigned int count, ...);
     175  void joinS(const char* joinString);
     176  void joinS(unsigned int cound, ...);
    174177  void joinV(unsigned int count, int* trackIDs);
    175178  void finalize(void);
  • orxonox/branches/physics/src/util/resource_manager.cc

    r4178 r4223  
    648648char* ResourceManager::getFullName(const char* fileName)
    649649{
    650   char* retName = new char[strlen(ResourceManager::getInstance()->getDataDir()) + strlen(fileName)+1];
     650  char* retName = new char[strlen(ResourceManager::getInstance()->getDataDir())
     651                           + strlen(fileName) + 1];
    651652  sprintf(retName, "%s%s", ResourceManager::getInstance()->getDataDir(), fileName);
    652653  if (ResourceManager::isFile(retName))
Note: See TracChangeset for help on using the changeset viewer.