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; };
//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; };