From 5315866f611015b5a11f91820442cd053acd4ad4 Mon Sep 17 00:00:00 2001 From: Aesylwinn Date: Fri, 19 Feb 2016 03:03:10 -0500 Subject: [PATCH] Corrections to condition ranges and several other minor fixes --- apps/opencs/model/world/infoselectwrapper.cpp | 67 +++++++++---------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/apps/opencs/model/world/infoselectwrapper.cpp b/apps/opencs/model/world/infoselectwrapper.cpp index 5271430f5..496f8e17f 100644 --- a/apps/opencs/model/world/infoselectwrapper.cpp +++ b/apps/opencs/model/world/infoselectwrapper.cpp @@ -46,7 +46,7 @@ const char* CSMWorld::ConstInfoSelectWrapper::FunctionEnumStrings[] = "PC Sneak", "PC Acrobatics", "PC Light Armor", - "PC Shorth Blade", + "PC Short Blade", "PC Marksman", "PC Merchantile", "PC Speechcraft", @@ -74,8 +74,8 @@ const char* CSMWorld::ConstInfoSelectWrapper::FunctionEnumStrings[] = "PC Corpus", "Weather", "PC Vampire", - "PC Level", - "PC Attacked", + "Level", + "Attacked", "Talked to PC", "PC Health", "Creature Target", @@ -239,33 +239,27 @@ std::string CSMWorld::ConstInfoSelectWrapper::toString() const { std::ostringstream stream; stream << convertToString(mFunctionName) << " "; - + if (mHasVariable) stream << mVariableName << " "; - + stream << convertToString(mRelationType) << " "; - + switch (mConstSelect.mValue.getType()) { - case ESM::VT_Short: - case ESM::VT_Long: case ESM::VT_Int: stream << mConstSelect.mValue.getInteger(); break; - + case ESM::VT_Float: stream << mConstSelect.mValue.getFloat(); break; - - case ESM::VT_String: - stream << mConstSelect.mValue.getString(); - break; - + default: stream << "(Invalid value type)"; break; } - + return stream.str(); } @@ -377,6 +371,7 @@ void CSMWorld::ConstInfoSelectWrapper::updateComparisonType() case Function_NotClass: case Function_NotRace: case Function_NotCell: + case Function_NotLocal: case Function_PcExpelled: case Function_PcCommonDisease: case Function_PcBlightDisease: @@ -459,7 +454,7 @@ void CSMWorld::ConstInfoSelectWrapper::updateComparisonType() // Numeric case Function_Global: case Function_Local: - case Function_NotLocal: + case Function_Health_Percent: case Function_PcHealthPercent: case Function_PcMagicka: @@ -559,14 +554,13 @@ std::pair CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const switch (mFunctionName) { - // TODO these need to be checked - // Boolean case Function_NotId: case Function_NotFaction: case Function_NotClass: case Function_NotRace: case Function_NotCell: + case Function_NotLocal: case Function_PcExpelled: case Function_PcCommonDisease: case Function_PcBlightDisease: @@ -581,7 +575,7 @@ std::pair CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const case Function_TalkedToPc: case Function_ShouldAttack: case Function_Werewolf: - return std::pair(0,1); + return std::pair(0, 1); // Integer case Function_RankLow: @@ -633,27 +627,29 @@ std::pair CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const case Function_PcPersonality: case Function_PcLuck: case Function_Level: + case Function_PcWerewolfKills: + return std::pair(0, IntMax); + case Function_Fight: case Function_Hello: case Function_Alarm: case Function_Flee: - case Function_PcWerewolfKills: - return std::pair(0, IntMax); + return std::pair(0, 100); case Function_Weather: return std::pair(0, 9); case Function_FriendHit: - return std::pair(0,4); + return std::pair(0, 4); case Function_RankRequirement: return std::pair(0, 3); case Function_CreatureTarget: - return std::pair(0,2); + return std::pair(0, 2); case Function_PcGender: - return std::pair(0,1); + return std::pair(0, 1); case Function_FactionRankDifference: return std::pair(-9, 9); @@ -661,17 +657,16 @@ std::pair CSMWorld::ConstInfoSelectWrapper::getValidIntRange() const // Numeric case Function_Global: case Function_Local: - case Function_NotLocal: return std::pair(IntMin, IntMax); - case Function_Health_Percent: - case Function_PcHealthPercent: - return std::pair(0, 100); - case Function_PcMagicka: case Function_PcFatigue: case Function_PcHealth: - return std::pair(0,0); + return std::pair(0, IntMax); + + case Function_Health_Percent: + case Function_PcHealthPercent: + return std::pair(0, 100); default: throw std::runtime_error("InfoSelectWrapper: function does not exist"); @@ -691,14 +686,14 @@ std::pair CSMWorld::ConstInfoSelectWrapper::getValidFloatRange() c case Function_NotLocal: return std::pair(FloatMin, FloatMax); - case Function_Health_Percent: - case Function_PcHealthPercent: - return std::pair(0, 100); - case Function_PcMagicka: case Function_PcFatigue: case Function_PcHealth: - return std::pair(0,0); + return std::pair(0, FloatMax); + + case Function_Health_Percent: + case Function_PcHealthPercent: + return std::pair(0, 100); default: throw std::runtime_error("InfoSelectWrapper: function does not exist or is not numeric"); @@ -839,7 +834,7 @@ void CSMWorld::InfoSelectWrapper::update() // Write Function bool writeIndex = false; - int functionIndex = static_cast(mFunctionName); + size_t functionIndex = static_cast(mFunctionName); switch (mFunctionName) {