Пример #1
0
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 );
}
Пример #2
0
            /// Set base and adjust modified accordingly.
            void setBase (const T& value)
            {
                mStatic.setBase (value);

                if (mCurrent>getModified())
                    mCurrent = getModified();
            }
Пример #3
0
 void CreatureStats::setAiSetting (AiSetting index, int base)
 {
     Stat<int> stat = getAiSetting(index);
     stat.setBase(base);
     setAiSetting(index, stat);
 }