#define NONEFACE_TEXTURE_NAME "interfaces\empty_face.tga"

#define IC_GOVERNOR  1
#define IC_FC        2

string oldCurNode = "";

int nCurScrollNum;
int nCurChar = IC_GOVERNOR;
ref _refCh;
string colony_name = "";
int govidx = -1;
int fcidx = -1;
bool hasGovernor = false;
bool hasFortCommandant = false;
int iTaxLevel = TAX_NORMAL;

void InitInterface_RS(string iniName,ref _refCharacter, string _colony_name)
{
	_refCh = _refCharacter;
	colony_name = _colony_name;
	ref mc = GetMainCharacter();
	iTaxLevel = TAX_NORMAL;

	if (CheckAttribute(mc, "colony_capture"))
		GameInterface.title = "titleColonyCapture";
	else
		GameInterface.title = "titleChangeGovernment";

	FillScroll();

	SendMessage(&GameInterface,"ls",MSG_INTERFACE_INIT,iniName);
	CreateExitString();//MAXIMUS: standard exit-string for exit-button

	CreateString(true, "ColonyName", GetTownName(colony_name), FONT_SEADOGS, COLOR_NORMAL, 200, 198, SCRIPT_ALIGN_CENTER, 1.0);
	CreateString(true, "TaxationLevel", XI_GetTaxationLevelName(), FONT_NORMAL, COLOR_NORMAL, 530, 198, SCRIPT_ALIGN_CENTER, 1.0);
	hasGovernor = GetTownGovernorIndex(colony_name) != -1;
	hasFortCommandant = GetTownNumForts(colony_name) > 0;
	if (hasGovernor) {
  	CreateString(true, "Governor", XI_ConvertString("Governor"), FONT_NORMAL, COLOR_NORMAL, 94, 390, SCRIPT_ALIGN_CENTER, 1.0);
		CreateImage("GovFace", GetFaceGroupName(-1), GetFacePictureName(-1), 30, 250, 158, 378);
	}
	if (hasFortCommandant) {
		CreateString(true, "FortCommandant", XI_ConvertString("Fort Commandant"), FONT_NORMAL, COLOR_NORMAL, 546, 390, SCRIPT_ALIGN_CENTER, 1.0);
		CreateImage("FCFace", GetFaceGroupName(-1), GetFacePictureName(-1), 482, 250, 610, 378);
	}

	if (hasGovernor)
		Event("PressGov");
	else
		Event("PressFC");

	SetCurrentNode("PASSENGERSLIST");

	CreateString(true,"skillLeadership","",FONT_BOLD_NUMBERS,COLOR_NORMAL,300,232,SCRIPT_ALIGN_RIGHT,1.0);
	CreateString(true,"skillFencing","",FONT_BOLD_NUMBERS,COLOR_NORMAL,300,266,SCRIPT_ALIGN_RIGHT,1.0);
	CreateString(true,"skillSailing","",FONT_BOLD_NUMBERS,COLOR_NORMAL,300,300,SCRIPT_ALIGN_RIGHT,1.0);
	CreateString(true,"skillAccuracy","",FONT_BOLD_NUMBERS,COLOR_NORMAL,300,334,SCRIPT_ALIGN_RIGHT,1.0);
	CreateString(true,"skillCannons","",FONT_BOLD_NUMBERS,COLOR_NORMAL,300,368,SCRIPT_ALIGN_RIGHT,1.0);
	CreateString(true,"skillGrappling","",FONT_BOLD_NUMBERS,COLOR_NORMAL,434,232,SCRIPT_ALIGN_RIGHT,1.0);
	CreateString(true,"skillRepair","",FONT_BOLD_NUMBERS,COLOR_NORMAL,434,266,SCRIPT_ALIGN_RIGHT,1.0);
	CreateString(true,"skillDefence","",FONT_BOLD_NUMBERS,COLOR_NORMAL,434,300,SCRIPT_ALIGN_RIGHT,1.0);
	CreateString(true,"skillCommerce","",FONT_BOLD_NUMBERS,COLOR_NORMAL,434,334,SCRIPT_ALIGN_RIGHT,1.0);
	CreateString(true,"skillSneak","",FONT_BOLD_NUMBERS,COLOR_NORMAL,434,368,SCRIPT_ALIGN_RIGHT,1.0);


	CreateExitString();//MAXIMUS: standard exit-string for exit-button
	SetSelectable("ASSIGNGOV_BUTTON", false);

	SetEventHandler("InterfaceBreak","ProcessCancelExit",0);
	SetEventHandler("frame","ProcessFrame",1);
	SetEventHandler("exitCancel","ProcessCancelExit",0);

	/* BEGIN MOD : Stone-D 01/08/2003 */
	SetEventHandler("PassengerDown","PassengerDown",0);
	SetEventHandler("AssignGov","ProcessAssignGov",0);
	SetEventHandler("ievnt_command","ProcessCommandExecute",0);
	/* END MOD : Stone-D 01/08/2003 */
// KK -->
	SetEventHandler("PressGov", "ProcessGovSelect", 0);
	SetEventHandler("PressFC", "ProcessFCSelect", 0);
	SetEventHandler("PressNone", "ProcessNoneSelect", 0);
	SetEventHandler("ColonyNameChange", "ProcessColonyNameChange", 0);
	SetEventHandler("KB_End","WriteName",0);
	SetEventHandler("KB_Update", "UpdateName", 0);
	SetEventHandler("NodeCancel", "ProcessNodeCancel", 0);
	SetEventHandler("IEvnt_MouseClick", "IProcMouseClick", 0);
	SetEventHandler("ChangeTaxLeft", "DoTaxChangeLeft", 0);
	SetEventHandler("ChangeTaxRight", "DoTaxChangeRight", 0);
// <-- KK
}

void FillScroll()
{
	int i;
	string faceName;
	string attributeName;
	string PsgAttrName;
	int _curCharIdx;
	ref _refCurChar;
	aref pRef;

	nCurScrollNum = -1;
	GameInterface.passengerslist.current = 0;
	makearef(pRef,_refCh.Fellows.Passengers);
	int nListSize = GetPassengersQuantity(_refCh);
	GameInterface.passengerslist.NotUsed = 5;
	GameInterface.passengerslist.ListSize = nListSize;

	GameInterface.passengerslist.ImagesGroup.t0 = "EMPTYFACE";

	FillFaceList( "passengerslist.ImagesGroup", _refCh, 0 ); // officers
	FillFaceList( "passengerslist.ImagesGroup", _refCh, 2 ); // passengers

	GameInterface.passengerslist.BadTex1 = 0;
	GameInterface.passengerslist.BadPic1 = "emptyface";

	for(i=0; i<nListSize; i++)
	{
		attributeName = "pic" + (i+1);
		PsgAttrName = "id"+(i+1);
		_curCharIdx = sti(pRef.(PsgAttrName));
		if(_curCharIdx!=-1)
		{
			GameInterface.passengerslist.(attributeName).img1 = GetFacePicName(GetCharacter(_curCharIdx));
			GameInterface.passengerslist.(attributeName).tex1 = FindFaceGroupNum("passengerslist.ImagesGroup","FACE128_"+Characters[_curCharIdx].FaceID);
		}
		else
		{
			GameInterface.passengerslist.(attributeName).img1 = "emptyface";
			GameInterface.passengerslist.(attributeName).tex1 = 0;
		}
	}
}

void ProcessFrame()
{
	string curName = GetCurrentNode();
	if(oldCurNode!=curName)
	{
		oldCurNode = curName;
		if(curName=="PASSENGERSLIST")
		{
			nCurScrollNum = -1;
		}
		Event("PressNone");
	}

	if(sti(GameInterface.passengerslist.current)!=nCurScrollNum)
	{
		DoScrollChange();
	}
}

void DoScrollChange()
{
	nCurScrollNum   = sti(GameInterface.passengerslist.current);

	ref chPsgn;
	int psgIdx = GetPassenger(_refCh,nCurScrollNum);
	if(psgIdx<0)
	{
		SetSumSkillData();
	}
	else
	{
		SetChrSkillData(GetCharacter(psgIdx));
	}
}

void SetVariable()
{
}

void ProcessCancelExit()
{
	ref mc = GetMainCharacter();
	if (CheckAttribute(mc, "colony_capture")) LAi_QuestDelay("ColonyCapture_ContinueDialog", 1.0);
	IDoExit(RC_INTERFACE_CAPTURE_COLONY_EXIT);
}

void ProcessAssignGov()
{
	ref refMyChar, refChar, rtmp, rIsland;
	aref artmp, arIslandReload;
	int chridx = -1;
	string chrid = "";
	object objtmp;
	if (hasGovernor == true && govidx != -1) {
		refMyChar = GetCharacter(govidx);
		refChar = GetTownGovernor(colony_name);
		chrid = refchar.id;
		chridx = GetCharacterIndex(chrid);
		makeref(rtmp, objtmp);
		CopyAttributes(rtmp, refChar);
		DeleteAttribute(refChar, "");
		CopyAttributes(refChar, refMyChar);
		refChar.orig = "";
		makearef(artmp, refChar.orig);
		CopyAttributes(&artmp, rtmp);

		refChar.id = chrid;
		refChar.index = chridx;
		refChar.location = refchar.orig.location;
		refChar.location.group = refchar.orig.location.group;
		refChar.location.locator = refchar.orig.location.locator;
		if (refChar.sex == "woman") {
			refChar.model.height = WOMAN_HEIGHT;
			if (refChar.location.group == "sit") refChar.model.animation = "woman_sit";
		} else {
			refChar.model.height = MAN_HEIGHT;
		}
		DeleteAttribute(refChar, "officer");
		DeleteAttribute(refChar, "offgen");
		DeleteAttribute(refChar, "quest");
		refChar.quest = "True";
		refChar.quest.meeting = 0;
		refChar.nation = PERSONAL_NATION;
		LAi_SetHuberType(refChar);
		if (CheckAttribute(refChar, "orig.chr_ai.type")) refChar.chr_ai.type = refChar.orig.chr_ai.type;
		if (CheckAttribute(refChar, "orig.chr_ai.tmpl")) refChar.chr_ai.tmpl = refChar.orig.chr_ai.tmpl;
		if (CheckAttribute(refChar, "orig.Dialog.filename")) refChar.Dialog.filename = refChar.orig.Dialog.filename;
		if (CheckAttribute(refChar, "orig.Dialog.CurrentNode")) refChar.Dialog.CurrentNode = refChar.orig.Dialog.CurrentNode;
		if (CheckAttribute(refChar, "orig.Dialog.TempNode")) refChar.Dialog.TempNode = refChar.orig.Dialog.TempNode;
		if (CheckAttribute(refChar, "orig.quest")) refChar.quest = refChar.orig.quest;
		if (CheckAttribute(refChar, "orig.quest.meeting")) refChar.quest.meeting = refChar.orig.quest.meeting;

		ChangeCharacterAddressGroup(refMyChar, "None", "", "");
		RemovePassenger(_refCh, refMyChar);
	}
	if (hasFortCommandant == true && fcidx != -1) {
		refMyChar = GetCharacter(fcidx);
		refChar = GetTownFortCommander(colony_name, 0);
		DeleteAttribute(refChar, "Fort.Cannons.Damaged");
		chrid = refchar.id;
		chridx = GetCharacterIndex(chrid);
		makeref(rtmp, objtmp);
		CopyAttributes(rtmp, refChar);
		DeleteAttribute(refChar, "");
		CopyAttributes(refChar, refMyChar);
		refChar.orig = "";
		makearef(artmp, refChar.orig);
		CopyAttributes(&artmp, rtmp);

		refChar.id = chrid;
		refChar.index = chridx;
		refChar.location = refchar.orig.location;
		refChar.location.group = refchar.orig.location.group;
		refChar.location.locator = refchar.orig.location.locator;
		refChar.Dialog.Filename = "";
		refChar.Dialog.CurrentNode = "";
		refChar.Dialog.TempNode = "";
		DeleteAttribute(refChar, "officer");
		DeleteAttribute(refChar, "offgen");
		DeleteAttribute(refChar, "quest");
		refChar.quest = "True";
		refChar.quest.meeting = 0;
		refChar.quest.escort = 0;
		refChar.nation = PERSONAL_NATION;
		refChar.ship.type = refChar.orig.ship.type;
		refChar.Fort.Cannons.Charge.Type = refChar.orig.Fort.Cannons.Charge.Type;
		refChar.Fort.Cannons.Type.1 = refChar.orig.Fort.Cannons.Type.1;
		refChar.Fort.Cannons.Type.2 = refChar.orig.Fort.Cannons.Type.2;
		refChar.town = refChar.orig.town;

		ChangeCharacterAddressGroup(refMyChar, "None", "", "");
		RemovePassenger(_refCh, refMyChar);
	}

	ref mc = GetMainCharacter();
	CaptureColony(GetCharacter(sti(mc.colony_capture.govidx)), PERSONAL_NATION);
	DeleteAttribute(mc, "colony_capture");

	int tmpLangFileID = LanguageOpenFile("interface_strings.txt");

	if (GameInterface.strings.ColonyName != GetTownName(colony_name)) {
		Towns[GetTownIndex(colony_name)].name = GameInterface.strings.ColonyName;
		Preprocessor_Delete(colony_name);
		Preprocessor_Save(colony_name, GameInterface.strings.ColonyName);
		rIsland = GetIslandByID(GetIslandIDFromTown(colony_name));
		makearef(arIslandReload, rIsland.reload);
		int num = GetAttributesNum(arIslandReload);
		int i = 0;
		for (i = 0; i < num; i++) {
			artmp = GetAttributeN(arIslandReload, i);
			if (CheckAttribute(artmp, "go") == true && CheckAttribute(&Towns[GetTownIndex(colony_name)], "boarding.l1") == true && artmp.go == Towns[GetTownIndex(colony_name)].boarding.l1) {
				artmp.label = LanguageConvertString(tmpLangFileID, "#stown_name# Port");
				Preprocessor_Add("town_name", GameInterface.strings.ColonyName);
				artmp.label = PreprocessText(artmp.label);
				Preprocessor_Remove("town_name");
				break;
			}
		}
		if (hasFortCommandant == true) {
			refChar = GetTownFortCommander(colony_name, 0);
			refChar.name = GetTownName(colony_name) + " " + XI_ConvertString("Fort");
			refChar.old.name = refChar.name;
			for (i = 0; i < num; i++) {
				artmp = GetAttributeN(arIslandReload, i);
				if (CheckAttribute(artmp, "go") == true && CheckAttribute(artmp, "commander") == true && artmp.go == "BOARDING_Fort" && artmp.commander == refChar.id) {
					artmp.label = LanguageConvertString(tmpLangFileID, "#stown_name# Fort");
					Preprocessor_Add("town_name", GameInterface.strings.ColonyName);
					artmp.label = PreprocessText(artmp.label);
					Preprocessor_Remove("town_name");
					break;
				}
			}
		}
		SetWorldMapIcon(colony_name, GameInterface.strings.ColonyName, -1);
	}

	LanguageCloseFile(tmpLangFileID);

	Towns[GetTownIndex(colony_name)].tax = iTaxLevel;

	Event("exitCancel");
}

void PassengerDown()
{
}

void IDoExit(int exitCode)
{
	/* BEGIN MOD : Stone-D 01/08/2003 */
	DelEventHandler("InterfaceBreak","ProcessCancelExit");
	DelEventHandler("frame","ProcessFrame");
	DelEventHandler("exitCancel","ProcessCancelExit");
	DelEventHandler("PassengerDown","PassengerDown");
	DelEventHandler("AssignGov","ProcessAssignGov");
	DelEventHandler("ievnt_command","ProcessCommandExecute");
	/* END MOD : Stone-D 01/08/2003 */
// KK -->
	DelEventHandler("PressGov", "ProcessGovSelect");
	DelEventHandler("PressFC", "ProcessFCSelect");
	DelEventHandler("PressNone", "ProcessNoneSelect");
	DelEventHandler("ColonyNameChange", "ProcessColonyNameChange");
	DelEventHandler("KB_End","WriteName"); // NK Keyboard
	DelEventHandler("KB_Update", "UpdateName");
	DelEventHandler("NodeCancel", "ProcessNodeCancel");
	DelEventHandler("IEvnt_MouseClick", "IProcMouseClick");
	DelEventHandler("ChangeTaxLeft", "DoTaxChangeLeft");
	DelEventHandler("ChangeTaxRight", "DoTaxChangeRight");
// <-- KK

	interfaceResultCommand = exitCode;
// MAXIMUS interface MOD -->
	EndCancelInterface(true);
// MAXIMUS interface MOD <--
}

void SetSumSkillData()
{
	ref chref = _refCh;

	GameInterface.strings.skillLeadership = GetSummonSkillFromName(chref,SKILL_LEADERSHIP);
	GameInterface.strings.skillFencing = GetSummonSkillFromName(chref,SKILL_FENCING);
	GameInterface.strings.skillSailing = GetSummonSkillFromName(chref,SKILL_SAILING);
	GameInterface.strings.skillAccuracy = GetSummonSkillFromName(chref,SKILL_ACCURACY);
	GameInterface.strings.skillCannons = GetSummonSkillFromName(chref,SKILL_CANNONS);
	GameInterface.strings.skillGrappling = GetSummonSkillFromName(chref,SKILL_GRAPPLING);
	GameInterface.strings.skillRepair = GetSummonSkillFromName(chref,SKILL_REPAIR);
	GameInterface.strings.skillDefence = GetSummonSkillFromName(chref,SKILL_DEFENCE);
	GameInterface.strings.skillCommerce = GetSummonSkillFromName(chref,SKILL_COMMERCE);
	GameInterface.strings.skillSneak = GetSummonSkillFromName(chref,SKILL_SNEAK);
}

void SetChrSkillData(ref chref)
{
	GameInterface.strings.skillLeadership = GetCharacterSkill(chref,SKILL_LEADERSHIP);
	GameInterface.strings.skillFencing = GetCharacterSkill(chref,SKILL_FENCING);
	GameInterface.strings.skillSailing = GetCharacterSkill(chref,SKILL_SAILING);
	GameInterface.strings.skillAccuracy = GetCharacterSkill(chref,SKILL_ACCURACY);
	GameInterface.strings.skillCannons = GetCharacterSkill(chref,SKILL_CANNONS);
	GameInterface.strings.skillGrappling = GetCharacterSkill(chref,SKILL_GRAPPLING);
	GameInterface.strings.skillRepair = GetCharacterSkill(chref,SKILL_REPAIR);
	GameInterface.strings.skillDefence = GetCharacterSkill(chref,SKILL_DEFENCE);
	GameInterface.strings.skillCommerce = GetCharacterSkill(chref,SKILL_COMMERCE);
	GameInterface.strings.skillSneak = GetCharacterSkill(chref,SKILL_SNEAK);
}

void ProcessCommandExecute()
{
	string comName = GetEventData();
	string nodName = GetEventData();

	switch(nodName)
	{
		case "PASSENGERSLIST":
			if(comName=="activate")
			{
				if (nCurChar == IC_GOVERNOR)
					XI_SetGovernor();
				else
					XI_SetFortCommandant();
			}
		break;
	}
}

void FillSelectedScroll()
{
	int i;
	string faceName;
	string attributeName;
	string PsgAttrName;
	int _curCharIdx;
	ref _refCurChar;
	aref pRef;

	nCurScrollNum = -1;
	GameInterface.passengerslist.current = 0;
	makearef(pRef,_refCh.Fellows.Passengers);
	int nListSize = GetNotCaptivePassengersQuantity(_refCh);
	nListSize = sti(GetPassengersQuantity(_refCh));
	GameInterface.passengerslist.NotUsed = 5;
	GameInterface.passengerslist.ListSize = nListSize;

	GameInterface.passengerslist.ImagesGroup.t0 = "EMPTYFACE";

	FillFaceList( "passengerslist.ImagesGroup", _refCh, 0 ); // officers
	FillFaceList( "passengerslist.ImagesGroup", _refCh, 2 ); // passengers

	GameInterface.passengerslist.BadTex1 = 0;
	GameInterface.passengerslist.BadPic1 = "emptyface";

	int logined = 0;
	for(i=0; i<nListSize; i++)
	{
		attributeName = "pic" + (i+1);
		PsgAttrName = "id" + (i+1);
		_curCharIdx = sti(pRef.(PsgAttrName));
		if(_curCharIdx!=-1)
		{
			if(!CheckAttribute(GetCharacter(_curCharIdx),"prisoned"))
			{
				attributeName = "pic" + (logined+1);
				PsgAttrName = "id" + (i+1);
				_curCharIdx = sti(pRef.(PsgAttrName));
				logined++;
				GameInterface.passengerslist.(attributeName).img1 = GetFacePicName(GetCharacter(_curCharIdx));
				GameInterface.passengerslist.(attributeName).tex1 = FindFaceGroupNum("passengerslist.ImagesGroup","FACE128_"+Characters[_curCharIdx].FaceID);
			}
		}
		else
		{
			GameInterface.passengerslist.(attributeName).img1 = "emptyface";
			GameInterface.passengerslist.(attributeName).tex1 = 0;
		}
	}
}

void ProcessColonyNameChange()
{
	SetNodeUsing("BOX", true);
	SetCurrentNode("BOX");
	KB_SetKeyboardMode(true);
	KeyboardString = "";
}

void UpdateName()
{
	GameInterface.strings.ColonyName = KeyboardString;
}

void WriteName()
{
	if(KeyboardString != "")
	{
		GameInterface.strings.ColonyName = KeyboardString;
	}
	else
	{
		GameInterface.strings.ColonyName = GetTownName(colony_name);
	}
}

void ProcessNodeCancel()
{
	GameInterface.strings.ColonyName = GetTownName(colony_name);
}

void ProcessGovSelect()
{
	if (hasGovernor) {
		SetPictureBlind("GovFace", true, minBlindColor, maxBlindColor);
		SetCurrentNode("RGOV");
		nCurChar = IC_GOVERNOR;
	}
}

void ProcessFCSelect()
{
	if (hasFortCommandant) {
		SetPictureBlind("FCFace", true, minBlindColor, maxBlindColor);
		SetCurrentNode("RFC");
		nCurChar = IC_FC;
	}
}

void ProcessNoneSelect()
{
	if (hasGovernor) SetPictureBlind("GovFace", false, 0, 0);
	if (hasFortCommandant) SetPictureBlind("FCFace", false, 0, 0);
}

void XI_SetGovernor()
{
	if (govidx != -1) {
		govidx = -1;
		RefillScroll();
	}
	if (govidx == fcidx) {
		fcidx = -1;
		RefillScroll();
		SetPictureBlind("FCFace", false, 0, 0);
	}
	nCurScrollNum = sti(GameInterface.passengerslist.current);
	govidx = GetPassenger(_refCh, nCurScrollNum);
	if (govidx != -1) {
		ref chPsgn = GetCharacter(govidx);
		RefillScroll();
		CreateImage("GovFace", GetFaceGroupName(govidx), GetFacePictureName(govidx), 30, 250, 158, 378);
		SetCurrentNode("PASSENGERSLIST");
		if (hasFortCommandant == true && fcidx != -1) SetSelectable("ASSIGNGOV_BUTTON", true);
		if (hasFortCommandant == false) SetSelectable("ASSIGNGOV_BUTTON", true);
	}
}

void XI_SetFortCommandant()
{
	if (fcidx != -1) {
		fcidx = -1;
		RefillScroll();
	}
	if (fcidx == govidx) {
		govidx = -1;
		RefillScroll();
		SetPictureBlind("GovFace", false, 0, 0);
	}
	nCurScrollNum = sti(GameInterface.passengerslist.current);
	fcidx = GetPassenger(_refCh,nCurScrollNum);
	if (fcidx != -1) {
		ref chPsgn = GetCharacter(fcidx);
		RefillScroll();
		CreateImage("FCFace", GetFaceGroupName(fcidx), GetFacePictureName(fcidx), 482, 250, 610, 378);
		SetCurrentNode("PASSENGERSLIST");
		if (hasGovernor == true && govidx != -1) SetSelectable("ASSIGNGOV_BUTTON", true);
		if (hasGovernor == false) SetSelectable("ASSIGNGOV_BUTTON", true);
	}
}

void RefillScroll()
{
	ref charRef;
	int charQuantity=0;
	string attributeName;
	int i;

	charQuantity = sti(GameInterface.passengerslist.ListSize);
	for (i = 0; i < charQuantity; i++) {
		attributeName = "passengerslist.pic" + (i+1);
		DeleteAttribute(&GameInterface, attributeName);
	}
	charQuantity = 0;
	i = 0;
	int psgIdx = GetNotCaptivePassenger(_refCh, i);
	while (psgIdx != -1) {
		if (psgIdx != govidx && psgIdx != fcidx) {
			charRef = GetCharacter(psgIdx);
			attributeName = "pic" + (charQuantity+1);
			GameInterface.passengerslist.(attributeName).img1 = GetFacePicName(charRef);
			GameInterface.passengerslist.(attributeName).tex1 = FindFaceGroupNum("passengerslist.ImagesGroup","FACE128_"+charRef.FaceId);
			charQuantity++;
		}
		i++;
		psgIdx = GetNotCaptivePassenger(_refCh, i);
	}
	GameInterface.passengerslist.ListSize = charQuantity;
	SendMessage(&GameInterface,"ls",MSG_INTERFACE_REFRESH_SCROLL,"PASSENGERSLIST");
}

string XI_GetTaxationLevelName()
{
	int tmpLangFileID = LanguageOpenFile("interface_strings.txt");
	string ret = "";
	switch (iTaxLevel) {
		case TAX_NONE:    ret = LanguageConvertString(tmpLangFileID, "tax_none");    break;
		case TAX_LOW:     ret = LanguageConvertString(tmpLangFileID, "tax_low");     break;
		case TAX_NORMAL:  ret = LanguageConvertString(tmpLangFileID, "tax_normal");  break;
		case TAX_HIGH:    ret = LanguageConvertString(tmpLangFileID, "tax_high");    break;
		case TAX_PLUNDER: ret = LanguageConvertString(tmpLangFileID, "tax_plunder"); break;
	}
	LanguageCloseFile(tmpLangFileID);
	return ret;
}

void IProcMouseClick()
{
	string nodName = GetEventData();
	int btnCode = GetEventData();

	if (nodName == "TAX_CHANGER") {
		if (btnCode == 0) Event("ChangeTaxLeft");
		if (btnCode == 1) Event("ChangeTaxRight");
	}
}

void DoTaxChangeLeft()
{
	if (iTaxLevel > TAX_NONE) {
		iTaxLevel--;
		GameInterface.strings.TaxationLevel = XI_GetTaxationLevelName();
	}
}

void DoTaxChangeRight()
{
	if (iTaxLevel < TAX_PLUNDER) {
		iTaxLevel++;
		GameInterface.strings.TaxationLevel = XI_GetTaxationLevelName();
	}
}
