35 laPropertyList::laPropertyList(
void)
37 strcpy(_strName,
"END");
43 laPropertyList::~laPropertyList(
void)
48 void laPropertyList::discard()
57 for(std::map<std::string, char*>::iterator i1=_mapText.begin(); i1!=_mapText.end(); i1++)
58 delete [] (i1->second);
61 for(std::map<std::string, class laAnimatedModel*>::iterator i2=_mapModel.begin(); i2!=_mapModel.end(); i2++)
66 for(std::map<std::string, class fxParticleSystem*>::iterator i3=_mapFx.begin(); i3!=_mapFx.end(); i3++)
71 for(std::map<std::string, class laPropertyList*>::iterator i4=_mapChildren.begin(); i4!=_mapChildren.end(); i4++)
73 (i4->second)->discard();
82 if(_bReadName) fp->readSectionSeparator(_strName);
86 if( !strcmp(_strName,
"END") )
90 char strEndTag[32], strName[64];
91 sprintf(strEndTag,
"/%s", _strName);
94 _read_components(fp, strEndTag);
97 void laPropertyList::_read_components(
laFileParser* fp,
char* strEndTag)
100 char strTag[32], strName[64];
104 fp->readSectionSeparator(strTag);
107 if( !strcmp(strTag, strEndTag) )
break;
109 laTypedObject t(strTag);
110 if( (t.type() != M_TYPE_COMMENT) && ( t.type() !=M_TYPE_PLIST) )
111 fp->readLabel( strName );
113 fp->readObj( &t, M_FALSE );
118 _mapBool[strName] = *t.getBool();
122 _mapInt[strName] = *t.getInt();
126 _mapDouble[strName] = *t.getDouble();
130 _mapPoint[strName] = *t.getPoint();
134 _mapColor[strName] = *t.getColor();
138 _mapAttack[strName] = *t.attack();
146 _mapText[strName] = t.getText();
150 _mapModel[strName] = t.getModel();
151 _vModel.push_back( t.getModel() );
155 _mapFx[strName] = t.getFx();
156 _vFx.push_back( t.getFx() );
161 _mapChildren[strTag] = t.getPList();
162 _mapChildren[strTag]->_pParent =
this;
168 char *strInclude = t.getText();
170 _read_components(&fp,
"END");
177 M_BOOL laPropertyList::getBool(std::string name)
179 std::map<std::string, M_BOOL>::iterator i;
180 i = _mapBool.find(name);
183 if( i==_mapBool.end() )
throw laError_PropertyNotDefined(name);
188 int laPropertyList::getInt(std::string name)
190 std::map<std::string, int>::iterator i;
191 i = _mapInt.find(name);
194 if( i==_mapInt.end() )
throw laError_PropertyNotDefined(name);
199 double laPropertyList::getDouble(std::string name)
201 std::map<std::string, double>::iterator i;
202 i = _mapDouble.find(name);
205 if( i==_mapDouble.end() )
throw laError_PropertyNotDefined(name);
210 char* laPropertyList::getText(std::string name)
212 std::map<std::string, char*>::iterator i;
213 i = _mapText.find(name);
216 if( i==_mapText.end() )
throw laError_PropertyNotDefined(name);
221 laColor laPropertyList::getColor(std::string name)
223 std::map<std::string, laColor>::iterator i;
224 i = _mapColor.find(name);
227 if( i==_mapColor.end() )
throw laError_PropertyNotDefined(name);
232 laPoint3 laPropertyList::getPoint(std::string name)
234 std::map<std::string, laPoint3>::iterator i;
235 i = _mapPoint.find(name);
238 if( i==_mapPoint.end() )
throw laError_PropertyNotDefined(name);
243 rpgAttack laPropertyList::attack(std::string name)
245 std::map<std::string, rpgAttack>::iterator i;
246 i = _mapAttack.find(name);
249 if( i==_mapAttack.end() )
throw laError_PropertyNotDefined(name);
267 std::map<std::string, laAnimatedModel*>::iterator i;
268 i = _mapModel.find(name);
271 if( i==_mapModel.end() )
throw laError_PropertyNotDefined(name);
276 fxParticleSystem* laPropertyList::getFx(std::string name)
278 std::map<std::string, fxParticleSystem*>::iterator i;
279 i = _mapFx.find(name);
282 if( i==_mapFx.end() )
throw laError_PropertyNotDefined(name);
287 laPropertyList* laPropertyList::getChild(std::string name)
289 std::map<std::string, laPropertyList*>::iterator i;
290 i = _mapChildren.find(name);
293 if( i==_mapChildren.end() )
throw laError_PropertyNotDefined(name);
300 ASSERT( i < getModelCnt(),
"Invalid model" );
304 fxParticleSystem* laPropertyList::getFx(
unsigned i)
306 ASSERT( i < getFxCnt(),
"Invalid model" );
311 laPropertyList* laPropertyList::getTopmost()
316 return _pParent->getTopmost();