fix bugs and add comments on simple_move_and_targeting_phase

fix bugs and add comments on simple_move_and_targeting_phase

fix bugs and add comments on simple_move_and_targeting_phase
Merge pull request #144 from Kevin-Xi/bugfix

fix bugs and add comments on simple_move_and_targeting_phase
Messenger Micro AI: minor code simplification
Micro AIs: avoid using table.remove

It’s slow.  The inverse logic using table.insert is much faster,
especially for large tables.  Only kept table.remove in a couple places
where it doesn’t matter.
Micro AIs: avoid using formula= in SUFs

It’s slow for finding units with moves or attacks left.  The
alternative method of getting all units and then looping over the table
with a condition is much faster.
Fix a typo

I had actually introduced this typo intentionally for testing purposes
and then forgotten to remove it.  :-P
Use 'faction' and 'gender' attributes to provide default values in MP Create.

Before this, 'faction' and 'gender' were not used if 'force_lock_settings'
wasn't set to 'yes'. This resulted in inconsistent behaviour between the
mentioned two attributes and 'type' attribute. When 'type' was set, the relevant
leader was always selected by default.

This partially fixes bugs #21753 and #20562. To properly address them, it might
be needed to add 'faction_lock', 'type_lock' and 'gender_lock' attributes so
that UMC authors would have a way to actually lock these selections without
using 'force_lock_settings' if they don't want to.