Skip to content
This repository has been archived by the owner on Mar 29, 2020. It is now read-only.

Commit

Permalink
Search up the family tree for primogeniture heirs if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Idhrendur committed Apr 9, 2012
1 parent f733c45 commit 451cf3c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Data Files/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ Revision Log Message
56 Children in sorted order in family trees
57 Primogeniture heirs
58 More character information
59 Temporary government of tribal despotism
59 Temporary government of tribal despotism
60 Search up the family tree for primogeniture heirs if needed
6 changes: 6 additions & 0 deletions Source/CK2World/CK2Character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ bool CK2Character::isFemale()
}


CK2Character* CK2Character::getFather()
{
return father;
}


CK2Character* CK2Character::getPrimogenitureHeir()
{
for (list<CK2Character*>::iterator i = children.begin(); i != children.end(); i++)
Expand Down
1 change: 1 addition & 0 deletions Source/CK2World/CK2Character.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CK2Character
bool isDead();
date getDeathDate();
bool isFemale();
CK2Character* getFather();
CK2Character* getPrimogenitureHeir();
private:
string name;
Expand Down
13 changes: 11 additions & 2 deletions Source/CK2World/CK2Title.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,20 @@ void CK2Title::init(Object* obj, map<int, CK2Character*>& characters)
holder = characters[ atoi( holderObjs[0]->getLeaf().c_str() ) ];
}

heir = false;
heir = NULL;
successionLaw = obj->getLeaf("succession");
if (successionLaw == "primogeniture")
{
heir = holder->getPrimogenitureHeir();
CK2Character* tempHolder = holder;
do
{
heir = tempHolder->getPrimogenitureHeir();
tempHolder = tempHolder->getFather();
if (tempHolder == NULL)
{
break;
}
} while (heir == NULL);
}

vector<Object*> historyObjs = obj->getValue("history");
Expand Down

0 comments on commit 451cf3c

Please sign in to comment.