The problem was that the old building gets destroyed and a new one created in the same spot. This is partially done via scheduled playercommands, so we can have nondeterministic delays here.
Sending a note to the building window fixes the issue.
I'd still like to look some more at that conquering code though - it's overly complicated. Before the OneTribe change, we used to have "global" militarysites so that we could add other tribes' building types when conquering. This is no longer needed, so I think rather than destroying and recreating, we should be able to simply unconquer for old owner, change owner and conquer for new owner.
The problem was that the old building gets destroyed and a new one created in the same spot. This is partially done via scheduled playercommands, so we can have nondeterministic delays here.
Sending a note to the building window fixes the issue.
I'd still like to look some more at that conquering code though - it's overly complicated. Before the OneTribe change, we used to have "global" militarysites so that we could add other tribes' building types when conquering. This is no longer needed, so I think rather than destroying and recreating, we should be able to simply unconquer for old owner, change owner and conquer for new owner.