Don't use initializer list

This commit is contained in:
cc9cii 2015-05-10 07:02:08 +10:00
parent d6ecc64168
commit 5fb269336f

View file

@ -590,83 +590,86 @@ namespace CSMWorld
// See the mappings in MWDialogue::SelectWrapper::getArgument // See the mappings in MWDialogue::SelectWrapper::getArgument
// from ESM::Attribute, ESM::Skill and MWMechanics::CreatureStats (for AI) // from ESM::Attribute, ESM::Skill and MWMechanics::CreatureStats (for AI)
const std::map<const std::string, const std::string> sEncToInfoFunc = static std::map<const std::string, std::string> populateEncToInfoFunc()
{ {
{ "00", "Rank Low" }, std::map<const std::string, std::string> funcMap;
{ "01", "Rank High" }, funcMap["00"] = "Rank Low";
{ "02", "Rank Requirement" }, funcMap["01"] = "Rank High";
{ "03", "Reputation" }, funcMap["02"] = "Rank Requirement";
{ "04", "Health Percent" }, funcMap["03"] = "Reputation";
{ "05", "PC Reputation" }, funcMap["04"] = "Health Percent";
{ "06", "PC Level" }, funcMap["05"] = "PC Reputation";
{ "07", "PC Health Percent" }, funcMap["06"] = "PC Level";
{ "08", "PC Magicka" }, // dynamic stat funcMap["07"] = "PC Health Percent";
{ "09", "PC Fatigue" }, // dynamic stat funcMap["08"] = "PC Magicka";
{ "10", "PC Strength" }, // attrib funcMap["09"] = "PC Fatigue";
{ "11", "PC Block" }, funcMap["10"] = "PC Strength";
{ "12", "PC Armoror" }, funcMap["11"] = "PC Block";
{ "13", "PC Medium Armor" }, funcMap["12"] = "PC Armoror";
{ "14", "PC Heavy Armor" }, funcMap["13"] = "PC Medium Armor";
{ "15", "PC Blunt Weapon" }, funcMap["14"] = "PC Heavy Armor";
{ "16", "PC Long Blade" }, funcMap["15"] = "PC Blunt Weapon";
{ "17", "PC Axe" }, funcMap["16"] = "PC Long Blade";
{ "18", "PC Spear" }, funcMap["17"] = "PC Axe";
{ "19", "PC Athletics" }, funcMap["18"] = "PC Spear";
{ "20", "PC Enchant" }, funcMap["19"] = "PC Athletics";
{ "21", "PC Destruction" }, funcMap["20"] = "PC Enchant";
{ "22", "PC Alteration" }, funcMap["21"] = "PC Destruction";
{ "23", "PC Illusion" }, funcMap["22"] = "PC Alteration";
{ "24", "PC Conjuration" }, funcMap["23"] = "PC Illusion";
{ "25", "PC Mysticism" }, funcMap["24"] = "PC Conjuration";
{ "26", "PC Restoration" }, funcMap["25"] = "PC Mysticism";
{ "27", "PC Alchemy" }, funcMap["26"] = "PC Restoration";
{ "28", "PC Unarmored" }, funcMap["27"] = "PC Alchemy";
{ "29", "PC Security" }, funcMap["28"] = "PC Unarmored";
{ "30", "PC Sneak" }, funcMap["29"] = "PC Security";
{ "31", "PC Acrobatics" }, funcMap["30"] = "PC Sneak";
{ "32", "PC Light Armor" }, funcMap["31"] = "PC Acrobatics";
{ "33", "PC Short Blade" }, funcMap["32"] = "PC Light Armor";
{ "34", "PC Marksman" }, funcMap["33"] = "PC Short Blade";
{ "35", "PC Merchantile" }, funcMap["34"] = "PC Marksman";
{ "36", "PC Speechcraft" }, funcMap["35"] = "PC Merchantile";
{ "37", "PC Hand To Hand" }, funcMap["36"] = "PC Speechcraft";
{ "38", "PC Sex" }, funcMap["37"] = "PC Hand To Hand";
{ "39", "PC Expelled" }, funcMap["38"] = "PC Sex";
{ "40", "PC Common Disease" }, funcMap["39"] = "PC Expelled";
{ "41", "PC Blight Disease" }, funcMap["40"] = "PC Common Disease";
{ "42", "PC Clothing Modifier" }, funcMap["41"] = "PC Blight Disease";
{ "43", "PC Crime Level" }, funcMap["42"] = "PC Clothing Modifier";
{ "44", "Same Sex" }, funcMap["43"] = "PC Crime Level";
{ "45", "Same Race" }, funcMap["44"] = "Same Sex";
{ "46", "Same Faction" }, funcMap["45"] = "Same Race";
{ "47", "Faction Rank Difference" }, funcMap["46"] = "Same Faction";
{ "48", "Detected" }, funcMap["47"] = "Faction Rank Difference";
{ "49", "Alarmed" }, funcMap["48"] = "Detected";
{ "50", "Choice" }, funcMap["49"] = "Alarmed";
{ "51", "PC Intelligence" }, // attrib funcMap["50"] = "Choice";
{ "52", "PC Willpower" }, // attrib funcMap["51"] = "PC Intelligence";
{ "53", "PC Agility" }, // attrib funcMap["52"] = "PC Willpower";
{ "54", "PC Speed" }, // attrib funcMap["53"] = "PC Agility";
{ "55", "PC Endurance" }, // attrib funcMap["54"] = "PC Speed";
{ "56", "PC Personality" }, // attrib funcMap["55"] = "PC Endurance";
{ "57", "PC Luck" }, // attrib funcMap["56"] = "PC Personality";
{ "58", "PC Corpus" }, funcMap["57"] = "PC Luck";
{ "59", "Weather" }, funcMap["58"] = "PC Corpus";
{ "60", "PC Vampire" }, funcMap["59"] = "Weather";
{ "61", "Level" }, funcMap["60"] = "PC Vampire";
{ "62", "Attacked" }, funcMap["61"] = "Level";
{ "63", "Talked To PC" }, funcMap["62"] = "Attacked";
{ "64", "PC Health" }, // dynamic stat funcMap["63"] = "Talked To PC";
{ "65", "Creature Target" }, funcMap["64"] = "PC Health";
{ "66", "Friend Hit" }, funcMap["65"] = "Creature Target";
{ "67", "Fight" }, // AI funcMap["66"] = "Friend Hit";
{ "68", "Hello" }, // AI funcMap["67"] = "Fight";
{ "69", "Alarm" }, // AI funcMap["68"] = "Hello";
{ "70", "Flee" }, // AI funcMap["69"] = "Alarm";
{ "71", "Should Attack" }, funcMap["70"] = "Flee";
{ "72", "Werewolf" }, funcMap["71"] = "Should Attack";
{ "73", "PC Werewolf Kills" } funcMap["72"] = "Werewolf";
}; funcMap["73"] = "PC Werewolf Kills";
return funcMap;
}
static const std::map<const std::string, std::string> sEncToInfoFunc = populateEncToInfoFunc();
QVariant InfoConditionAdapter::getData(const Record<Info>& record, QVariant InfoConditionAdapter::getData(const Record<Info>& record,
int subRowIndex, int subColIndex) const int subRowIndex, int subColIndex) const
@ -749,83 +752,86 @@ namespace CSMWorld
} }
} }
const std::map<const std::string, const std::string> sInfoFuncToEnc = static std::map<const std::string, std::string> populateInfoFuncToEnc()
{ {
{ "Alarm", "69" }, // AI std::map<const std::string, std::string> encMap;
{ "Alarmed", "49" }, encMap["Alarm"] = "69"; // AI
{ "Attacked", "62" }, encMap["Alarmed"] = "49";
{ "Choice", "50" }, encMap["Attacked"] = "62";
{ "Creature Target", "65" }, encMap["Choice"] = "50";
{ "Detected", "48" }, encMap["Creature Target"] = "65";
{ "Faction Rank Difference", "47" }, encMap["Detected"] = "48";
{ "Fight", "67" }, // AI encMap["Faction Rank Difference"] ="47";
{ "Flee", "70" }, // AI encMap["Fight"] = "67"; // AI
{ "Friend Hit", "66" }, encMap["Flee"] = "70"; // AI
{ "Health Percent", "04" }, encMap["Friend Hit"] = "66";
{ "Hello", "68" }, // AI encMap["Health Percent"] = "04";
{ "Level", "61" }, encMap["Hello"] = "68"; // AI
{ "PC Acrobatics", "31" }, encMap["Level"] = "61";
{ "PC Agility", "53" }, // attrib encMap["PC Acrobatics"] = "31";
{ "PC Alchemy", "27" }, encMap["PC Agility"] = "53"; // attrib
{ "PC Alteration", "22" }, encMap["PC Alchemy"] = "27";
{ "PC Armoror", "12" }, encMap["PC Alteration"] = "22";
{ "PC Athletics", "19" }, encMap["PC Armoror"] = "12";
{ "PC Axe", "17" }, encMap["PC Athletics"] = "19";
{ "PC Blight Disease", "41" }, encMap["PC Axe"] = "17";
{ "PC Block", "11" }, encMap["PC Blight Disease"] = "41";
{ "PC Blunt Weapon", "15" }, encMap["PC Block"] = "11";
{ "PC Clothing Modifier", "42" }, encMap["PC Blunt Weapon"] = "15";
{ "PC Common Disease", "40" }, encMap["PC Clothing Modifier"] = "42";
{ "PC Conjuration", "24" }, encMap["PC Common Disease"] = "40";
{ "PC Corpus", "58" }, encMap["PC Conjuration"] = "24";
{ "PC Crime Level", "43" }, encMap["PC Corpus"] = "58";
{ "PC Destruction", "21" }, encMap["PC Crime Level"] = "43";
{ "PC Enchant", "20" }, encMap["PC Destruction"] = "21";
{ "PC Endurance", "55" }, // attrib encMap["PC Enchant"] = "20";
{ "PC Expelled", "39" }, encMap["PC Endurance"] = "55"; // attrib
{ "PC Fatigue", "09" }, // dynamic stat encMap["PC Expelled"] = "39";
{ "PC Hand To Hand", "37" }, encMap["PC Fatigue"] = "09"; // dynamic stat
{ "PC Health", "64" }, // dynamic stat encMap["PC Hand To Hand"] = "37";
{ "PC Health Percent", "07" }, encMap["PC Health"] = "64"; // dynamic stat
{ "PC Heavy Armor", "14" }, encMap["PC Health Percent"] = "07";
{ "PC Illusion", "23" }, encMap["PC Heavy Armor"] = "14";
{ "PC Intelligence", "51" }, // attrib encMap["PC Illusion"] = "23";
{ "PC Level", "06" }, encMap["PC Intelligence"] = "51"; // attrib
{ "PC Light Armor", "32" }, encMap["PC Level"] = "06";
{ "PC Long Blade", "16" }, encMap["PC Light Armor"] = "32";
{ "PC Luck", "57" }, // attrib encMap["PC Long Blade"] = "16";
{ "PC Magicka", "08" }, // dynamic stat encMap["PC Luck"] = "57"; // attrib
{ "PC Marksman", "34" }, encMap["PC Magicka"] = "08"; // dynamic stat
{ "PC Medium Armor", "13" }, encMap["PC Marksman"] = "34";
{ "PC Merchantile", "35" }, encMap["PC Medium Armor"] = "13";
{ "PC Mysticism", "25" }, encMap["PC Merchantile"] = "35";
{ "PC Personality", "56" }, // attrib encMap["PC Mysticism"] = "25";
{ "PC Reputation", "05" }, encMap["PC Personality"] = "56"; // attrib
{ "PC Restoration", "26" }, encMap["PC Reputation"] = "05";
{ "PC Security", "29" }, encMap["PC Restoration"] = "26";
{ "PC Sex", "38" }, encMap["PC Security"] = "29";
{ "PC Short Blade", "33" }, encMap["PC Sex"] = "38";
{ "PC Sneak", "30" }, encMap["PC Short Blade"] = "33";
{ "PC Spear", "18" }, encMap["PC Sneak"] = "30";
{ "PC Speechcraft", "36" }, encMap["PC Spear"] = "18";
{ "PC Speed", "54" }, // attrib encMap["PC Speechcraft"] = "36";
{ "PC Strength", "10" }, // attrib encMap["PC Speed"] = "54"; // attrib
{ "PC Unarmored", "28" }, encMap["PC Strength"] = "10"; // attrib
{ "PC Vampire", "60" }, encMap["PC Unarmored"] = "28";
{ "PC Werewolf Kills", "73" }, encMap["PC Vampire"] = "60";
{ "PC Willpower", "52" }, // attrib encMap["PC Werewolf Kills"] = "73";
{ "Rank Requirement", "02" }, encMap["PC Willpower"] = "52"; // attrib
{ "Rank High", "01" }, encMap["Rank Requirement"] = "02";
{ "Rank Low", "00" }, encMap["Rank High"] = "01";
{ "Reputation", "03" }, encMap["Rank Low"] = "00";
{ "Same Faction", "46" }, encMap["Reputation"] = "03";
{ "Same Race", "45" }, encMap["Same Faction"] = "46";
{ "Same Sex", "44" }, encMap["Same Race"] = "45";
{ "Should Attack", "71" }, encMap["Same Sex"] = "44";
{ "Talked To PC", "63" }, encMap["Should Attack"] = "71";
{ "Weather", "59" }, encMap["Talked To PC"] = "63";
{ "Werewolf", "72" } encMap["Weather"] = "59";
}; encMap["Werewolf"] = "72";
return encMap;
}
static const std::map<const std::string, std::string> sInfoFuncToEnc = populateInfoFuncToEnc();
void InfoConditionAdapter::setData(Record<Info>& record, void InfoConditionAdapter::setData(Record<Info>& record,
const QVariant& value, int subRowIndex, int subColIndex) const const QVariant& value, int subRowIndex, int subColIndex) const
@ -867,7 +873,7 @@ namespace CSMWorld
if (conditions[subRowIndex].mSelectRule[1] == '1') if (conditions[subRowIndex].mSelectRule[1] == '1')
{ {
// throws an exception if the function is not found // throws an exception if the function is not found
const std::map<const std::string, const std::string>::const_iterator it = sInfoFuncToEnc.find( const std::map<const std::string, std::string>::const_iterator it = sInfoFuncToEnc.find(
value.toString().toUtf8().constData()); value.toString().toUtf8().constData());
if (it != sInfoFuncToEnc.end()) if (it != sInfoFuncToEnc.end())
{ {