Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5155 in orxonox.OLD


Ignore:
Timestamp:
Aug 27, 2005, 3:39:26 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now one should be able to create entities on the Fly

Location:
trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/functor_list.h

    r5153 r5155  
    9797#define l_XML_ELEM_FUNC                         //!< The function to parse an XML_ELEM
    9898#define l_XML_ELEM_NAME    "XML"                //!< The name of an XML_ELEM
    99 //#define l_XML_ELEM_PARAM   Parameter        //!< the type of the parameter XML_ELEM
     99//#define l_XML_ELEM_PARAM   Parameter            //!< the type of the parameter XML_ELEM
    100100#define l_XML_ELEM_DEFAULT NULL                 //!< The dafault Value for an XML_ELEM
    101101
  • trunk/src/glmenu/glmenu_imagescreen.cc

    r5090 r5155  
    2222#include "material.h"
    2323#include "factory.h"
     24#include "load_param.h"
    2425
    2526CREATE_FACTORY(GLMenuImageScreen);
  • trunk/src/lib/particles/particle_system.cc

    r4863 r5155  
    2323#include "field.h"
    2424
     25#include "load_param.h"
    2526#include "compiler.h"
    2627#include "material.h"
  • trunk/src/lib/physics/physics_connection.cc

    r4836 r5155  
    2525
    2626#include "factory.h"
     27#include "load_param.h"
    2728
    2829using namespace std;
  • trunk/src/util/loading/factory.cc

    r4836 r5155  
    1616
    1717#include "factory.h"
     18
     19#include "shell_command.h"
    1820#include "game_loader.h"
    19 
    2021using namespace std;
    2122
     
    6869
    6970  if( Factory::first == NULL)
     71  {
    7072    Factory::first = factory;
     73    ShellCommand<Factory>::registerCommand("create", CL_FACTORY, &Factory::fabricate);
     74  }
    7175  else
    7276  {
     
    7983  }
    8084}
     85
     86void Factory::fabricate(const char* className, const char* entityName)
     87{
     88  if (className == NULL)
     89    return;
     90  Factory* fac = Factory::first;
     91
     92  while (fac != NULL)
     93  {
     94    if (!strcmp(className, fac->getName()))
     95    {
     96      PRINTF(3)("Create a new Object of type %s\n", fac->getName());
     97      BaseObject* object = fac->fabricate(NULL);
     98      if (object != NULL)
     99      {
     100        object->setName(entityName);
     101      }
     102      break;
     103    }
     104    fac = fac->next;
     105  }
     106}
  • trunk/src/util/loading/factory.h

    r4932 r5155  
    2626
    2727#include "tinyxml.h"
    28 #include "load_param.h"
    2928#include "base_object.h"
    3029#include "debug.h"
     
    4443  ~Factory ();
    4544
    46 
     45  void fabricate(const char* className, const char* entityName);
    4746  virtual BaseObject* fabricate(const TiXmlElement* root) = NULL;
    4847
  • trunk/src/util/shell_command.cc

    r5154 r5155  
    139139  while(elem != NULL)
    140140  {
    141     printf("%s\n", elem->getName());
     141    printf("%s::%s\n", elem->className, elem->getName());
    142142    if (!strncasecmp (executionString, elem->className, strlen(elem->className)) &&
    143143         (*(executionString+strlen(elem->className)) == ' ' ||
     
    170170        while(*commandBegin == ' ')
    171171          commandBegin++;
    172         tList<BaseObject>* list =  ClassList::getList(elem->classID);
     172        tList<BaseObject>* list = ClassList::getList(elem->classID);
    173173        if (list == NULL)
    174174          break;
  • trunk/src/util/shell_command.h

    r5153 r5155  
    1010
    1111#include "helper_functions.h"
    12 #include "functor_list.h"
    1312#include "substring.h"
     13#include "functor_list.h"
    1414
    1515#include <stdarg.h>
  • trunk/src/world_entities/player.cc

    r5145 r5155  
    8383{
    8484  this->init();
    85   this->loadParams(root);
     85  if (root != NULL)
     86    this->loadParams(root);
    8687
    8788  //weapons:
  • trunk/src/world_entities/skybox.cc

    r4998 r5155  
    2323#include "factory.h"
    2424
     25#include "load_param.h"
    2526#include "material.h"
    2627#include "vector.h"
Note: See TracChangeset for help on using the changeset viewer.