Further merge StateInfo setup functions

No functional change.
Reformat do_castling()

No functional change.