void FillCharactersList(ref ViewingCharacter)
{
int tempnum1;
int tempnum2;
int tempnum3;
int tempnum4;
int tempnum5;
ref tempchar;
string tempstring1;
string tempstring2;
string tempstring3;
If (CheckAttribute(MainChar,"tempCharactersList"))
{
DeleteAttribute(MainChar,"tempCharactersList");
if (TRACELOG == 1) { Trace("deleted existing list"); }
}
ListMax = 1;
// ******* STEP 1/5: ADD MAIN CHARACTER *******
MainChar.tempCharactersList.member1.idx = sti(MainChar.index);
if (TRACELOG == 1) { Trace("added mainchar"); }
ListMax++;
// ******* STEP 3/5: ADD COMPANIONS AND THEIR OFFICERS *******
for (tempnum1 = 1; tempnum1 < 4; tempnum1++)
{
tempnum2 = GetCompanionIndex(MainChar,tempnum1);
if(tempnum2>=0 && IsTrader(&characters[tempnum2]) == true) continue;//MAXIMUS: such companion will not be added // KK
if(CheckAttribute(newFriend,"index") && tempnum2==sti(newFriend.index)) continue;//MAXIMUS: companion will not be added <----------------------------------THIS LINE
if (tempnum2 >= 0)
{
tempstring1 = "member" + ListMax;
MainChar.tempCharactersList.(tempstring1).idx = tempnum2;
if (TRACELOG == 1) { Trace("added list member " + ListMax + ": idx " + tempnum2 + " type 2"); }
ListMax++;
tempchar = GetCharacter(tempnum2);
for (tempnum3 = 1; tempnum3 < 4; tempnum3++)
{
tempnum4 = GetOfficersIndex(tempchar,tempnum3);
if (TRACELOG == 1) { Trace("checking officer " + tempnum3 + ", idx " + tempnum4 + ", of companion " + tempnum1 + ", idx " + tempnum2); }
if (tempnum4 >= 0)
{
tempstring1 = "member" + ListMax;
MainChar.tempCharactersList.(tempstring1).idx = tempnum4;
if (TRACELOG == 1) { Trace("added list member " + ListMax + ": idx " + tempnum4 + " type 3"); }
ListMax++;
}
}
}
}
ListMax--;
if (TRACELOG == 1) { Trace("list total: " + ListMax); }
curOfficer = 1;
xi_refCharacter = GetMainCharacter();
tempnum3 = sti(ViewingCharacter.index);
for (tempnum1 = 1; tempnum1 <= ListMax; tempnum1++)
{
tempstring1 = "member" + tempnum1;
tempnum2 = sti(MainChar.tempCharactersList.(tempstring1).idx);
if (tempnum2 == tempnum3)
{
curOfficer = tempnum1;
xi_refCharacter = GetCharacter(tempnum2);
}
}
AddCharacterExp(xi_refCharacter,0);
}