In my current game with my modmod I am getting a crash to desktop whenever I capture Meresin's last city.
It seems that the problem was caused by the Meresin unit (which is Immortal) being loaded into a Galley which was stationed in the capital city.
The game did not let him (or the Longbowman who was also in the galley) defend the city from conquest, but automatically destroyed him with his ship when the city was captured. When he died without personally engaging in combat, I think the game tried to resurrect him even though he had no place to go.
I get the same bug when the city contains a regular Immortal on a Galley in the city when I capture it.
I have not tested in base MNAI yet, but imagine that there would be an identical problem.
----
This issue wouldn't matter in MNAI as there are no bAlwaysHostile units, but I really think you ought to do something about how units with that tag are treated.
As things currently stand, they are treated as enemies when they attack units outside of cities, but can enter rival cities peacefully. They cannot however leave those cities peacefully. That is considered an act of war.
The units can capture superforts without war, but again cannot leave them to enter rival plots without declaring war.
Normal units trying to enter cities owned by the same player cannot do so if a rival player has a bAlwaysHostile unit stationed there. The bAlways hostile unit is being treated as hostile and yet not hostile at the same time. It is like other units have to attack them in order to enter the tile, but are not permitted to attack them while in the city.
Those issues are extremely annoying for humans, and are almost guaranteed to cause an AI to get stuck in loops.
I currently used some rather inefficient code under def unitCannotMoveInto(self,argsList): in my modmod to stop bAlwaysHostile units from entering rival cities or forts without war, but it is an imperfect fix. It wouldn't handle situations where cities change hands, as through Basium's, Rantine's, or Loki's abilities, or cultural flipping.
I would really like it if you could make it so that bAlwaysHostile units are treated as if they had the bNoCapture tag when it comes to cities and superforts belonging to neutral players. They should be allowed to attack units there, but not capture any territory without a declaration of war. They should be vulnerable to attack while there, and should not have to declare war to leave.
(I'd also really like it if promotions could grant bAlwaysHostile status too, but that is clearly a feature request and not even arguably a bug fix.)