void CSStats::readFromXML( const std::string& entityID, const pugi::xml_node& node ) { CStats component; for( pugi::xml_node statNode : node ) { Stat stat; pugi::xml_attribute idAtt = statNode.attribute( "id" ); if( !idAtt ) { DOS_ERROR( true, "Unable to load entity Stat. ID is missing" ); continue; } stat.setID( idAtt.as_int() ); pugi::xml_attribute valueAtt = statNode.attribute( "value" ); if( !valueAtt ) { DOS_ERROR( true, "Unable to load entity Stat. Value is missing" ); continue; } stat.setBase( valueAtt.as_float() ); component.stats.push_back( stat ); } COMPONENT_MANAGER.addProperty( component, entityID ); }
/// Set base and adjust modified accordingly. void setBase (const T& value) { mStatic.setBase (value); if (mCurrent>getModified()) mCurrent = getModified(); }
void CreatureStats::setAiSetting (AiSetting index, int base) { Stat<int> stat = getAiSetting(index); stat.setBase(base); setAiSetting(index, stat); }