Simplify and rename wait_for_stop_or_ponderhit()

Setting stopOnPonderhit is now done by the caller.

No functional change.
Small change to "ponderhit" handling

Reset Limits.ponder only if search continue, but if
we are going to stop the search there is no need
(and is also confusing) to clear the 'ponder' flag.

This mimics the behaviour upon rceiving 'stop' when
pondering.

No functional change.
Unify 'ponderhit' handling

Finally we can now merge the 'ponderhit' case with
'stop' and 'quit'.

The patches have been done step by step to help debugging
becuase this is really tricky code.

No functional change.