コード例 #1
0
ファイル: actorsprite.cpp プロジェクト: B-Rich/mana
static EffectDescription *getEffectDescription(int effectId)
{
    if (!effects_initialized)
    {
        XML::Document doc(EFFECTS_FILE);
        xmlNodePtr root = doc.rootNode();

        if (!root || !xmlStrEqual(root->name, BAD_CAST "effects"))
        {
            logger->log("Error loading being effects file: "
                    EFFECTS_FILE);
            return NULL;
        }

        for_each_xml_child_node(node, root)
        {
            int id;

            if (xmlStrEqual(node->name, BAD_CAST "effect"))
            {
                EffectDescription *EffectDescription =
                    getEffectDescription(node, &id);
                effects[id] = EffectDescription;
            }
            else if (xmlStrEqual(node->name, BAD_CAST "default"))
            {
                EffectDescription *effectDescription =
                    getEffectDescription(node, &id);

                if (default_effect)
                    delete default_effect;

                default_effect = effectDescription;
            }
        }
コード例 #2
0
ファイル: actorsprite.cpp プロジェクト: EvolOnline/ManaPlus
static EffectDescription *getEffectDescription(int effectId)
{
    if (!effects_initialized)
    {
        XML::Document doc(EFFECTS_FILE);
        XmlNodePtr root = doc.rootNode();

        if (!root || !xmlNameEqual(root, "being-effects"))
        {
            logger->log1("Error loading being effects file: "
                    EFFECTS_FILE);
            return nullptr;
        }

        for_each_xml_child_node(node, root)
        {
            int id;

            if (xmlNameEqual(node, "effect"))
            {
                EffectDescription *EffectDescription =
                    getEffectDescription(node, &id);
                effects[id] = EffectDescription;
            }
            else if (xmlNameEqual(node, "default"))
            {
                EffectDescription *effectDescription =
                    getEffectDescription(node, &id);

                delete default_effect;

                default_effect = effectDescription;
            }
        }