Turns out I mistook @celticminstrel's opinion that we should use include guards over pragma (737916e).
Since all major compilers support `#pragma once`, there's no reason not to use it.
For future mergability reasons, this excludes src/spirit_po and src/xBRZ. It also excludes src/boost-patched.
This commit converts the following function calls:
* boost::bind -> std::bind
* boost::function and boost::functionN -> std::function
* boost::ref and boost::cref -> std::ref and std::cref
* boost::bad_function_call -> std::bad_function_call
In the process, it was discovered that std::bind has trouble with overloaded
functions. There were two such cases in the code:
* gui2::twindow had an ancient unused overload to draw(). The overload was removed.
* gui2::trepeating_button was binding tdispatcher::fire. This case was converted
to a lambda.
According to clang boost/function.hpp does not have include guards,
and from inspecting clang diagnostics we include it many times
in several compilation units. This commit adds an external include
guard to all of our includes of this header, it was made using
find . -type f -exec sed -i 's/^#include <boost\/function\.hpp>$/\n#ifndef I
and inspecting the results.
the intention is to fix#20871 and implement #21697, to sync
prestart/start events, and to implement
http://forums.wesnoth.org/viewtopic.php?f=6&t=39611 in the next patches,
the intention of synced_checkup is to replace random .. set/get_random_results.
Because set/get_random_results didn't have much to do with random, since it was only used to compare unit checksums and attacker damage to replays.
the intention of synced_commands is to move code out of do_replay_handle and make it callable from other places too so that we can just call the same function taht was called from replay in the simple cases (with synced_context::run_in_synced_command).
the object set_scontext_synced can be used to enter the synced context which enables synced_checkup and make the random calls synced.
Or we can use run_in_synced_context which is normaly easier than set_scontext_synced.
we can check wether we are in a synced context with get_syced_state to make addidional checks to detect oos (the other intention of that is to implement #21697 ).
this commit is part of pf 121.