I noticed this section in your complie.log :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->For character 848 fall Mast name mast2 has index 2
BattleInterface DoSetFlags: 0
procGetRiggingData: n=-2, chr.id=Blaze, ship.type=Interceptor, nation=-1, ShipFlagsQuantity=6, bShipWithoutPennants=0
CurrentFlag=1, ShipFlagsQuantity=6, FlagType=PFlagType==FLAG_PENNANT && n == SHIP_FLAG
BattleInterface DoSetFlags: 1
procGetRiggingData: n=-2, chr.id=CrRedmond1, ship.type=Shnyava2, nation=3, ShipFlagsQuantity=3, bShipWithoutPennants=1
CurrentFlag=1, ShipFlagsQuantity=3, FlagType=E
procGetRiggingData: n=-2, chr.id=CrRedmond1, ship.type=Shnyava2, nation=3, ShipFlagsQuantity=3, bShipWithoutPennants=1
CurrentFlag=2, ShipFlagsQuantity=3, FlagType=E
procGetRiggingData: n=-2, chr.id=CrRedmond1, ship.type=Shnyava2, nation=3, ShipFlagsQuantity=3, bShipWithoutPennants=1
CurrentFlag=3, ShipFlagsQuantity=3, FlagType=E
procGetRiggingData: n=-2, chr.id=CrRedmond1, ship.type=Shnyava2, nation=3, ShipFlagsQuantity=3, bShipWithoutPennants=1<!--c2--></div><!--ec2-->
The game crashes on the shnyava2 but that's strange because normally, as a mast has fallen the refreshflags should be limited only to your ship and the shnyava2 shouldn't refresh her flags after. <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
I puted security in procmastfall() function for that :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void procMastFall()
{
int chrIdx = GetEventData();
string mastName = GetEventData();
int bFirstFall = GetEventData();
if(chrIdx<0) return;
int mastNum = strcut(mastName,4,strlen(mastName)-1);
trace("For character "+chrIdx+" fall Mast name "+mastName+" has index "+mastNum);
Characters[chrIdx].fallen = 1; //screwface
Characters[GetMainCharacterIndex()].avoidflagsRe = 1; //screwface
SendMessage(&PeopleOnShip, "lal", MSG_PEOPLES_ON_SHIP_MASTFALL, GetCharacter(chrIdx), mastNum);
}<!--c2--></div><!--ec2-->
As soon as the avoidflagsre attribute is set, the refreshflags is only limited to your ship, so in your case, it would significate that that mast began to fall (because of the trace) but the attribute was not set yet when the refreshflags began <img src="style_emoticons/<#EMO_DIR#>/ohmy.gif" style="vertical-align:middle" emoid="" border="0" alt="ohmy.gif" />k
Plus i also noticed that the refreshflags seems to be done 2 times in your compile and it crashes at the second time. Probably, a ship surrendered around a recall the refreshflags at the same time as the mast was falling.
Perhaps by moving the two lines i added upper it could minimize more the risk but i think it will exist ever a risk of crash if the refreshflags is called at the same time of a mast fall event. The challenge is more to limit at most this risk
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void procMastFall()
{
int chrIdx = GetEventData();
string mastName = GetEventData();
int bFirstFall = GetEventData();
if(chrIdx<0) return;
Characters[chrIdx].fallen = 1; //screwface
Characters[GetMainCharacterIndex()].avoidflagsRe = 1; //screwface
int mastNum = strcut(mastName,4,strlen(mastName)-1);
trace("For character "+chrIdx+" fall Mast name "+mastName+" has index "+mastNum);
SendMessage(&PeopleOnShip, "lal", MSG_PEOPLES_ON_SHIP_MASTFALL, GetCharacter(chrIdx), mastNum);
}<!--c2--></div><!--ec2-->
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->For character 848 fall Mast name mast2 has index 2
BattleInterface DoSetFlags: 0
procGetRiggingData: n=-2, chr.id=Blaze, ship.type=Interceptor, nation=-1, ShipFlagsQuantity=6, bShipWithoutPennants=0
CurrentFlag=1, ShipFlagsQuantity=6, FlagType=PFlagType==FLAG_PENNANT && n == SHIP_FLAG
BattleInterface DoSetFlags: 1
procGetRiggingData: n=-2, chr.id=CrRedmond1, ship.type=Shnyava2, nation=3, ShipFlagsQuantity=3, bShipWithoutPennants=1
CurrentFlag=1, ShipFlagsQuantity=3, FlagType=E
procGetRiggingData: n=-2, chr.id=CrRedmond1, ship.type=Shnyava2, nation=3, ShipFlagsQuantity=3, bShipWithoutPennants=1
CurrentFlag=2, ShipFlagsQuantity=3, FlagType=E
procGetRiggingData: n=-2, chr.id=CrRedmond1, ship.type=Shnyava2, nation=3, ShipFlagsQuantity=3, bShipWithoutPennants=1
CurrentFlag=3, ShipFlagsQuantity=3, FlagType=E
procGetRiggingData: n=-2, chr.id=CrRedmond1, ship.type=Shnyava2, nation=3, ShipFlagsQuantity=3, bShipWithoutPennants=1<!--c2--></div><!--ec2-->
The game crashes on the shnyava2 but that's strange because normally, as a mast has fallen the refreshflags should be limited only to your ship and the shnyava2 shouldn't refresh her flags after. <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
I puted security in procmastfall() function for that :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void procMastFall()
{
int chrIdx = GetEventData();
string mastName = GetEventData();
int bFirstFall = GetEventData();
if(chrIdx<0) return;
int mastNum = strcut(mastName,4,strlen(mastName)-1);
trace("For character "+chrIdx+" fall Mast name "+mastName+" has index "+mastNum);
Characters[chrIdx].fallen = 1; //screwface
Characters[GetMainCharacterIndex()].avoidflagsRe = 1; //screwface
SendMessage(&PeopleOnShip, "lal", MSG_PEOPLES_ON_SHIP_MASTFALL, GetCharacter(chrIdx), mastNum);
}<!--c2--></div><!--ec2-->
As soon as the avoidflagsre attribute is set, the refreshflags is only limited to your ship, so in your case, it would significate that that mast began to fall (because of the trace) but the attribute was not set yet when the refreshflags began <img src="style_emoticons/<#EMO_DIR#>/ohmy.gif" style="vertical-align:middle" emoid="" border="0" alt="ohmy.gif" />k
Plus i also noticed that the refreshflags seems to be done 2 times in your compile and it crashes at the second time. Probably, a ship surrendered around a recall the refreshflags at the same time as the mast was falling.
Perhaps by moving the two lines i added upper it could minimize more the risk but i think it will exist ever a risk of crash if the refreshflags is called at the same time of a mast fall event. The challenge is more to limit at most this risk
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void procMastFall()
{
int chrIdx = GetEventData();
string mastName = GetEventData();
int bFirstFall = GetEventData();
if(chrIdx<0) return;
Characters[chrIdx].fallen = 1; //screwface
Characters[GetMainCharacterIndex()].avoidflagsRe = 1; //screwface
int mastNum = strcut(mastName,4,strlen(mastName)-1);
trace("For character "+chrIdx+" fall Mast name "+mastName+" has index "+mastNum);
SendMessage(&PeopleOnShip, "lal", MSG_PEOPLES_ON_SHIP_MASTFALL, GetCharacter(chrIdx), mastNum);
}<!--c2--></div><!--ec2-->