This additionally:
* Makes all copyright notices identical aside from the starting year for Wesnoth-specific source files. Files not included: mariadbpp, lua, spirit po, xbrz, and bcrypt (crypt_blowfish).
* Removes all attribution from the files, since the vast majority of them are outdated or seemingly just outright incorrect. For example, I would guess that Dave is no longer the sole author of the majority of Wesnoth's current code.
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.
The main advantage is that the new code is much shorter and easier to
understand then the preivous one.
It currently still used the network::error class on some places
This also removed support for 'ping' packages, the plan is to replace it
with SO_KEEPALIVE
Also this temporaily breaks the gui2 lobby since it still uses the old
network code.
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.
when a player chats while multiple actions from another player are
executed on the local machine we before got an assertion error becasue
replay s add_command expects that there are no other commands yet to be
processed on the replay.
(this was broken at da4cdef146bf5a1b8026f12d6b1caa6c1cd20602)
we now fix this problem by ensuring that there is never more data on the
replay than needed.
for this purpose i wrote that playturn_network_adapter.cpp whose main
purpose it to split incoming [turn]s into smaller [turn]s
we also don't need the backlog anymore because now with playturn_network_adapter we only feed process_network_data with small data pieces that can always be handled at once.
I also removed the replay_ member of turn_info.
Before, we read actions from replay_srouce and wrote actions to recorder.
And after the actions in replay_source has been executed they had been pushed into recorder.
With get_user_choice this doesn't work, because we might end up pushing the 'answer' (the user choice) of a get_user_choice in the recorder while the 'question' (the invoking user action) was in replay_source and then would be pushed onto the recorder after the 'answer', leading to a wrong order in the recorder. This could maybe also have been fixed by always pushing user choices into replay_source, and syncing the replay_source somehow after we enter a user choice, but the way it was done in this commit seemed easier.
note that replay_ and backlog were already made unused in da4cdef146bf5a1b8026f12d6b1caa6c1cd20602 (that was a rather uncomplete commit)
We maybe (i didnt test, just a guess) could also fix this bug by using add_nonundoable_command instead of add_command for nonundoable commands in replay.cpp with add_nonundoable_command defined as:
config& add_nonundoable_command()
{
auto c = cfg_.add_child_at("command",config(), pos_);
pos_++;
return c;
}
One reason why i decided against it is, that i feared add_child_at to be slow (vector::insert) if there are a lot of entries in cfg_ (for example when we join game that has already run may turns).
With the playturn_network_adapter this shouldn't be an issue anymore, but it also isnt needed anymore.