Here I Stand
When Hungary surrenders after an assault that the attacker loses, what happens to Buda?
The attacking power first retreats if it has a space to retreat to. Then the Hungarian surrender takes effect, so Buda and the surviving Hungarian regulars go to the Hapsburgs.