Here's an odd little bug which I found while playing the "Assassin" storyline. Function 'CheckQuestRecord' in "PROGRAM\QUESTS\quests.c":
(I've left out some parts which are commented out, presumably earlier versions which didn't work properly.)
This is supposed to check whether quest record 'textId' is present in quest book 'qref'. It's called by 'AddQuestRecord' to make sure you don't try to add a duplicate copy of a record which is already in the questbook. 'qref' is set to point to'mc.QuestInfo.(idQuest)' where "mc" is you and "idQuest" is the questbook name. 'textID' is the string version of the record number being added.
'qref' is simply a string list of the record numbers already added to the questbook, e.g. "1,2,5". If you try to add record number 2, 'CheckQuestRecord' returns true if 'qref' includes either "2," or ",2". So if records 1 and 22 are already added, 'qref' is "1,22" - and 'CheckQuestRecord' passes because that does indeed include ",2". That's where the problem occurs in "Assassin", specifically its modified version of the "Hitman" quest. Record 22 is a new line about Vassal Bethune, your contact who is to lead you to Mateus Santos to start the quest. So it's added before record 2, which is the one about Ambroz Bricenos, your first target. Mateus Santos tells you to go and kill Ambroz Bricenos and the questbook fails to update.
Here's my modified version:
For one thing, it checks if the record you're trying to add is already present and is the only one. Otherwise it puts a "*" at each end of 'qref', so "1,22" becomes "*1,22*". If the record isn't the only one then, if it's present at all, it won't be alone, so there'll be a comma. The code therefore checks it the record is at either end, then checks if it's somewhere in the middle. It's now looking for "*2,", ",2*", or ",2,", which means it won't pass if "22" is present.
I've replayed that part of the modified "Hitman" quest, continued it a bit futher, and also completed a few sidequests, and all questbook entries which should be added have been added, so this appears to work.
Code:
bool CheckQuestRecord(aref qref,string textId)
{
bool retVal = hasSubStr(qref.Text, textId + ","); // KK
if (!retVal) retVal = hasSubStr(qref.Text, "," + textId); // KK
return retVal;
}
This is supposed to check whether quest record 'textId' is present in quest book 'qref'. It's called by 'AddQuestRecord' to make sure you don't try to add a duplicate copy of a record which is already in the questbook. 'qref' is set to point to'mc.QuestInfo.(idQuest)' where "mc" is you and "idQuest" is the questbook name. 'textID' is the string version of the record number being added.
'qref' is simply a string list of the record numbers already added to the questbook, e.g. "1,2,5". If you try to add record number 2, 'CheckQuestRecord' returns true if 'qref' includes either "2," or ",2". So if records 1 and 22 are already added, 'qref' is "1,22" - and 'CheckQuestRecord' passes because that does indeed include ",2". That's where the problem occurs in "Assassin", specifically its modified version of the "Hitman" quest. Record 22 is a new line about Vassal Bethune, your contact who is to lead you to Mateus Santos to start the quest. So it's added before record 2, which is the one about Ambroz Bricenos, your first target. Mateus Santos tells you to go and kill Ambroz Bricenos and the questbook fails to update.
Here's my modified version:
Code:
if(qref.Text == textID) retVal = true; // Check if textID is the only record present
if(!retVal)
{
string strpatch = "*" +qref.Text + "*"; // Put markers at start and end of qref.Text, then check if textID is at either end
retVal = hasSubstr(strpatch, "*" + textID + ",") || hasSubstr(strpatch, "," + textID + "*");
if(!retVal) retVal = hasSubstr(qref.text, "," + textID + ","); // Check if textID is somewhere in the middle
}
I've replayed that part of the modified "Hitman" quest, continued it a bit futher, and also completed a few sidequests, and all questbook entries which should be added have been added, so this appears to work.