Skip to content

Commit

Permalink
Merge pull request #554 from wesnoth/gfgtdf-patch-2
Browse files Browse the repository at this point in the history
Mute false positive OOS reports when recalling
  • Loading branch information
gfgtdf committed Nov 15, 2015
2 parents 6ae0134 + 20c1ede commit 9f967ff
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/server/game.cpp
Expand Up @@ -23,6 +23,7 @@
#include "player_network.hpp"
#include "serialization/string_utils.hpp"
#include "util.hpp"
#include "utils/foreach.tpp"

#include <boost/bind.hpp>

Expand Down Expand Up @@ -921,6 +922,13 @@ bool game::process_turn(simple_wml::document& data, const player_map::const_iter
}
}
}
else if ((**command).child("recall") || (**command).child("recruit")) {
simple_wml::node& command_r = **command;
// remove all [checkup] from recruit or replay [command]s, this fixes some false positive OOS reports caused by differences in unit checksum calculation between 1.12.4. and 1.12.5
while(command_r.child("checkup")) {
command_r.remove_child("checkup", 0);
}
}
else if((**command).has_attr("from_side"))
{
if((**command)["from_side"] == "server")
Expand Down Expand Up @@ -1032,7 +1040,26 @@ void game::process_whiteboard(simple_wml::document& data, const player_map::cons
{
std::ostringstream msg;
msg << "Ignoring illegal whiteboard data, sent from user '" << user->second.name()
<< "' to team '" << std::string(team_name.begin(), team_name.end()) << "'." << std::endl;
<< "' to team '" << std::string(team_name.begin(), team_name.end()) << "'";
if(side_num < 1 || side_num > gamemap::MAX_PLAYERS) {
msg << " (invalid side number '" << side_num << "')";
}
else if(sides_[side_num-1] != user->first) {
msg << " (player doesn't control side '" << side_num << "')";
}
else {
FOREACH(AUTO p_side, level_.root().children("side"))
{
if((*p_side)["side"].to_int() == int(side_num)) {
if((*p_side)["team_name"] != team_name) {
msg << "(side '" << side_num << "' is on team '" << (*p_side)["team_name"] << "')";
}
break;
}
}
}
msg << "." << std::endl;

const std::string& msg_str = msg.str();
LOG_GAME << msg_str << std::endl;
send_and_record_server_message(msg_str);
Expand Down

0 comments on commit 9f967ff

Please sign in to comment.