Example #1
0
Stats allStats(int s) { //Generate stats all the same (0 for starting, 1 for player, etc)
Stats stats;

    //Physical
    stats.emplace("strength"  , s);
    stats.emplace("dexterity" , s);
    stats.emplace("endurance" , s);

    //Magical
    stats.emplace("power"     , s);
    stats.emplace("control"   , s);
    stats.emplace("stability" , s);
return stats;
};
Example #2
0
//Multiply elements of *identical* maps together
Stats mergeStatMaps(Stats mapA, Stats mapB) {
    Stats::const_iterator itA, itB;
    itB = mapB.begin();
    Stats result;

    for (itA = mapA.begin(); itA != mapA.end(); itA++) {
        //Take key from A, and multiply values from A and B.
        result.emplace((*itA).first, (*itA).second * (*itB).second );

        itB++;
    }
    return result;
};