示例#1
0
void loadSkillList(SkillList& l)
{
    std::ifstream file("rc/data/skilllist.csv");
    std::string line;
    std::string value;
    std::string* listValue;
    int index = 0;

    while(std::getline(file, line))
    {
        Skill skill;
        listValue = new std::string[6];
        std::stringstream lineStream(line);

        while(std::getline(lineStream, value, ','))
        {
            listValue[index] = value;
            index++;
        }

        skill.setName(listValue[0]);
        skill.setBasePower(atoi(listValue[1].c_str()));
        skill.setTargetNeeded((atoi(listValue[2].c_str()) == 1) ? true : false);
        skill.setTargetType(static_cast<TargetType>(atoi(listValue[3].c_str())));
        skill.setCooldown(atoi(listValue[4].c_str()));
        skill.setDescription(listValue[5]);

        l.push_back(skill);

        index = 0;
        delete [] listValue;
    }
}
示例#2
0
void Test_Skill::setName()
{
    Skill testSkill;

    string name = "SkillName";
    testSkill.setName(name);

    QVERIFY(testSkill.getName() == name);
}