mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 04:56:39 +00:00 
			
		
		
		
	Merge pull request #2935 from akortunov/factionfix
Fix faction requirement calculations
This commit is contained in:
		
						commit
						927f835b7f
					
				
					 7 changed files with 29 additions and 16 deletions
				
			
		| 
						 | 
					@ -32,6 +32,7 @@
 | 
				
			||||||
    Bug #5479: NPCs who should be walking around town are standing around without walking
 | 
					    Bug #5479: NPCs who should be walking around town are standing around without walking
 | 
				
			||||||
    Bug #5484: Zero value items shouldn't be able to be bought or sold for 1 gold
 | 
					    Bug #5484: Zero value items shouldn't be able to be bought or sold for 1 gold
 | 
				
			||||||
    Bug #5490: Hits to carried left slot aren't redistributed if there's no shield equipped
 | 
					    Bug #5490: Hits to carried left slot aren't redistributed if there's no shield equipped
 | 
				
			||||||
 | 
					    Bug #5499: Faction advance is available when requirements not met
 | 
				
			||||||
    Feature #390: 3rd person look "over the shoulder"
 | 
					    Feature #390: 3rd person look "over the shoulder"
 | 
				
			||||||
    Feature #2386: Distant Statics in the form of Object Paging
 | 
					    Feature #2386: Distant Statics in the form of Object Paging
 | 
				
			||||||
    Feature #5297: Add a search function to the "Datafiles" tab of the OpenMW launcher
 | 
					    Feature #5297: Add a search function to the "Datafiles" tab of the OpenMW launcher
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -740,9 +740,9 @@ void Record<ESM::Faction>::print()
 | 
				
			||||||
            std::cout << "    Attribute2 Requirement: "
 | 
					            std::cout << "    Attribute2 Requirement: "
 | 
				
			||||||
                      << mData.mData.mRankData[i].mAttribute2 << std::endl;
 | 
					                      << mData.mData.mRankData[i].mAttribute2 << std::endl;
 | 
				
			||||||
            std::cout << "    One Skill at Level: "
 | 
					            std::cout << "    One Skill at Level: "
 | 
				
			||||||
                      << mData.mData.mRankData[i].mSkill1 << std::endl;
 | 
					                      << mData.mData.mRankData[i].mPrimarySkill << std::endl;
 | 
				
			||||||
            std::cout << "    Two Skills at Level: "
 | 
					            std::cout << "    Two Skills at Level: "
 | 
				
			||||||
                      << mData.mData.mRankData[i].mSkill2 << std::endl;
 | 
					                      << mData.mData.mRankData[i].mFavouredSkill << std::endl;
 | 
				
			||||||
            std::cout << "    Faction Reaction: "
 | 
					            std::cout << "    Faction Reaction: "
 | 
				
			||||||
                      << mData.mData.mRankData[i].mFactReaction << std::endl;
 | 
					                      << mData.mData.mRankData[i].mFactReaction << std::endl;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1143,8 +1143,8 @@ namespace CSMWorld
 | 
				
			||||||
            case 0: return QString(faction.mRanks[subRowIndex].c_str());
 | 
					            case 0: return QString(faction.mRanks[subRowIndex].c_str());
 | 
				
			||||||
            case 1: return rankData.mAttribute1;
 | 
					            case 1: return rankData.mAttribute1;
 | 
				
			||||||
            case 2: return rankData.mAttribute2;
 | 
					            case 2: return rankData.mAttribute2;
 | 
				
			||||||
            case 3: return rankData.mSkill1;
 | 
					            case 3: return rankData.mPrimarySkill;
 | 
				
			||||||
            case 4: return rankData.mSkill2;
 | 
					            case 4: return rankData.mFavouredSkill;
 | 
				
			||||||
            case 5: return rankData.mFactReaction;
 | 
					            case 5: return rankData.mFactReaction;
 | 
				
			||||||
            default: throw std::runtime_error("Rank subcolumn index out of range");
 | 
					            default: throw std::runtime_error("Rank subcolumn index out of range");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -1165,8 +1165,8 @@ namespace CSMWorld
 | 
				
			||||||
            case 0: faction.mRanks[subRowIndex] = value.toString().toUtf8().constData(); break;
 | 
					            case 0: faction.mRanks[subRowIndex] = value.toString().toUtf8().constData(); break;
 | 
				
			||||||
            case 1: rankData.mAttribute1 = value.toInt(); break;
 | 
					            case 1: rankData.mAttribute1 = value.toInt(); break;
 | 
				
			||||||
            case 2: rankData.mAttribute2 = value.toInt(); break;
 | 
					            case 2: rankData.mAttribute2 = value.toInt(); break;
 | 
				
			||||||
            case 3: rankData.mSkill1 = value.toInt(); break;
 | 
					            case 3: rankData.mPrimarySkill = value.toInt(); break;
 | 
				
			||||||
            case 4: rankData.mSkill2 = value.toInt(); break;
 | 
					            case 4: rankData.mFavouredSkill = value.toInt(); break;
 | 
				
			||||||
            case 5: rankData.mFactReaction = value.toInt(); break;
 | 
					            case 5: rankData.mFactReaction = value.toInt(); break;
 | 
				
			||||||
            default: throw std::runtime_error("Rank index out of range");
 | 
					            default: throw std::runtime_error("Rank index out of range");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -620,10 +620,10 @@ namespace MWGui
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        text += "\n";
 | 
					                        text += "\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        if (rankData.mSkill1 > 0)
 | 
					                        if (rankData.mPrimarySkill > 0)
 | 
				
			||||||
                            text += "\n#{sNeedOneSkill} " + MyGUI::utility::toString(rankData.mSkill1);
 | 
					                            text += "\n#{sNeedOneSkill} " + MyGUI::utility::toString(rankData.mPrimarySkill);
 | 
				
			||||||
                        if (rankData.mSkill2 > 0)
 | 
					                        if (rankData.mFavouredSkill > 0)
 | 
				
			||||||
                            text += " #{sand} #{sNeedTwoSkills} " + MyGUI::utility::toString(rankData.mSkill2);
 | 
					                            text += " #{sand} #{sNeedTwoSkills} " + MyGUI::utility::toString(rankData.mFavouredSkill);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -409,13 +409,24 @@ bool MWMechanics::NpcStats::hasSkillsForRank (const std::string& factionId, int
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const ESM::RankData& rankData = faction.mData.mRankData[rank];
 | 
					    const ESM::RankData& rankData = faction.mData.mRankData[rank];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (*iter<rankData.mSkill1)
 | 
					    if (*iter<rankData.mPrimarySkill)
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (skills.size() < 2)
 | 
					    if (skills.size() < 2)
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return *++iter>=rankData.mSkill2;
 | 
					    iter++;
 | 
				
			||||||
 | 
					    if (*iter<rankData.mFavouredSkill)
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (skills.size() < 3)
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    iter++;
 | 
				
			||||||
 | 
					    if (*iter<rankData.mFavouredSkill)
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool MWMechanics::NpcStats::isWerewolf() const
 | 
					bool MWMechanics::NpcStats::isWerewolf() const
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,7 @@ namespace ESM
 | 
				
			||||||
        for (int i=0; i<10; ++i)
 | 
					        for (int i=0; i<10; ++i)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            mData.mRankData[i].mAttribute1 = mData.mRankData[i].mAttribute2 = 0;
 | 
					            mData.mRankData[i].mAttribute1 = mData.mRankData[i].mAttribute2 = 0;
 | 
				
			||||||
            mData.mRankData[i].mSkill1 = mData.mRankData[i].mSkill2 = 0;
 | 
					            mData.mRankData[i].mPrimarySkill = mData.mRankData[i].mFavouredSkill = 0;
 | 
				
			||||||
            mData.mRankData[i].mFactReaction = 0;
 | 
					            mData.mRankData[i].mFactReaction = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            mRanks[i].clear();
 | 
					            mRanks[i].clear();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,10 +19,11 @@ struct RankData
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int mAttribute1, mAttribute2; // Attribute level
 | 
					    int mAttribute1, mAttribute2; // Attribute level
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int mSkill1, mSkill2; // Skill level (faction skills given in
 | 
					    // Skill level (faction skills given in
 | 
				
			||||||
    // skillID below.) You need one skill at
 | 
					    // skillID below.) You need one skill at
 | 
				
			||||||
    // level 'skill1' and two skills at level
 | 
					    // level 'mPrimarySkill' and two skills at level
 | 
				
			||||||
    // 'skill2' to advance to this rank.
 | 
					    // 'mFavouredSkill' to advance to this rank.
 | 
				
			||||||
 | 
					    int mPrimarySkill, mFavouredSkill;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int mFactReaction; // Reaction from faction members
 | 
					    int mFactReaction; // Reaction from faction members
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue