예제 #1
0
파일: CSStats.cpp 프로젝트: Smeky/TestTD
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
파일: stat.hpp 프로젝트: Adrian-Revk/openmw
            /// 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);
 }