enable sycned ai actions during synced actions

we now call a new function run_in_synced_context_if_not_already instead of
run_in_synced_context in ai actions becasue we want to be able to invoke these
functions from inside a synced context. run_in_synced_context_if_not_already
runs the function directy if already inside a synced context. Otherwise it
calls run_in_synced_context.
better error message
more robust replaying
more robust replaying
use template for config_assign

this removes code dublication,
use boost::ref in boost::bind
add code for precise timestamps in log

the code is not used yet, You can set precise_timestamp= true to use it.