Skip to content

Commit

Permalink
wb: dont resend 'bump_later' commands
Browse files Browse the repository at this point in the history
these caused 'illegal whiteboard data' messages from the mp server.
  • Loading branch information
gfgtdf committed May 21, 2018
1 parent 93eb033 commit 6197049
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/whiteboard/side_actions.cpp
Expand Up @@ -489,7 +489,7 @@ namespace
}

//move action toward front of queue
side_actions::iterator side_actions::bump_earlier(side_actions::iterator position)
side_actions::iterator side_actions::bump_earlier(side_actions::iterator position, bool send_to_net)
{
if(resources::whiteboard->has_planned_unit_map()) {
ERR_WB << "Modifying action queue while temp modifiers are applied!!!" << std::endl;
Expand Down Expand Up @@ -529,24 +529,25 @@ side_actions::iterator side_actions::bump_earlier(side_actions::iterator positio
<< ", bumping action #" << action_number << "/" << last_position
<< " to position #" << action_number - 1 << "/" << last_position << ".\n";

resources::whiteboard->queue_net_cmd(team_index_, make_net_cmd_bump_later(position - 1));

if (send_to_net) {
resources::whiteboard->queue_net_cmd(team_index_, make_net_cmd_bump_later(position - 1));
}
actions_.bump_earlier(position);

LOG_WB << "After bumping earlier, " << *this << "\n";
return position - 1;
}

//move action toward back of queue
side_actions::iterator side_actions::bump_later(side_actions::iterator position)
side_actions::iterator side_actions::bump_later(iterator position, bool send_to_net)
{
assert(position < end());

++position;
if(position == end()) {
return end();
}
position = bump_earlier(position);
position = bump_earlier(position, send_to_net);
if(position == end()) {
return end();
}
Expand Down Expand Up @@ -841,7 +842,7 @@ void side_actions::execute_net_cmd(const net_cmd& cmd)

action_ptr first_action = *itor;
action_ptr second_action = itor[1];
bump_later(itor);
bump_later(itor, false);

LOG_WB << "Command received: action bumped later from turn #" << turn << ", position #" << pos << "\n";

Expand Down
4 changes: 2 additions & 2 deletions src/whiteboard/side_actions.hpp
Expand Up @@ -378,14 +378,14 @@ class side_actions: public std::enable_shared_from_this<side_actions>
* i.e. at the front of the queue by one position.
* @return The action's new position.
*/
iterator bump_earlier(iterator position);
iterator bump_earlier(iterator position, bool send_to_net = true);

/**
* Moves an action later in the execution order.
* i.e. at the back of the queue by one position.
* @return The action's new position.
*/
iterator bump_later(iterator position);
iterator bump_later(iterator position, bool send_to_net = true);

/**
* Deletes the action at the specified position.
Expand Down

0 comments on commit 6197049

Please sign in to comment.