BodyList Class Reference

#include <body_list.h>

List of all members.

Public Member Functions

 BodyList ()
void FreeMem ()
BodyGetBody (const std::string &body)

Private Member Functions

void Load (const std::string &name)

Private Attributes

std::map< std::string, Body * > list


Detailed Description

Definition at line 34 of file body_list.h.


Constructor & Destructor Documentation

BodyList::BodyList (  ) 

Definition at line 35 of file body_list.cpp.

00036 {
00037 }


Member Function Documentation

void BodyList::FreeMem (  ) 

Definition at line 39 of file body_list.cpp.

00040 {
00041   // The bodies member variable are freed from here, because the playing bodies only contains
00042   // to member/movement/clothes of the bodies in the body_list
00043 
00044   std::map<std::string, Body*>::iterator it = list.begin();
00045   while(it != list.end())
00046   {
00047     // Clean the movements list
00048     std::map<std::string, Movement*>::iterator it3 = it->second->mvt_lst.begin();
00049     while(it3 != it->second->mvt_lst.end())
00050     {
00051       delete it3->second;
00052       it3++;
00053     }
00054 
00055     delete it->second;
00056     it++;
00057   }
00058   list.clear();
00059 }

Here is the caller graph for this function:

Body * BodyList::GetBody ( const std::string &  body  ) 

Definition at line 79 of file body_list.cpp.

00080 {
00081   if(list[name] == NULL)
00082     Load(name);
00083 
00084   if(list[name] == NULL)
00085   {
00086     std::cerr << "Unable to load body \"" << name << "\"" << std::endl;
00087     return NULL;
00088   }
00089   return new Body(list[name]);
00090 }

Here is the call graph for this function:

Here is the caller graph for this function:

void BodyList::Load ( const std::string &  name  )  [private]

Definition at line 61 of file body_list.cpp.

00062 {
00063   std::string fn = Config::GetInstance()->GetDataDir() + PATH_SEPARATOR + "body" + PATH_SEPARATOR + name + PATH_SEPARATOR + CONFIG_FN;
00064 
00065   XmlReader doc;
00066   if (!doc.Load(fn)) {
00067      std::cerr << "Unable to find file " << fn << std::endl;
00068      return;
00069   }
00070 
00071   Profile *res = resource_manager.LoadXMLProfile( fn, true);
00072 
00073   Body* body = new Body(doc.GetRoot(), res);
00074   list[name] = body;
00075 
00076   resource_manager.UnLoadXMLProfile( res);
00077 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

std::map<std::string, Body*> BodyList::list [private]

Definition at line 36 of file body_list.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 13:36:43 2007 for Wormux by  doxygen 1.4.7