Only send balls when not sending lines
This commit is contained in:
parent
7486b68ec3
commit
d3dcc616f8
1 changed files with 2 additions and 1 deletions
|
@ -30,10 +30,11 @@ websockets::TestProtocol<User> default_protocol{
|
|||
// write (will always come after receive)
|
||||
[](User& user, basic_websocket_info) -> std::string{
|
||||
js::Object ret;
|
||||
ret["balls"] = vector_to_json(app->sim.balls, [](ball_type const & b){return cheap_ball_type(b);});
|
||||
if(user.update_lines){
|
||||
ret["lines"] = vector_to_json(app->lines, [](AbstractLine const & l){return cheap_line_type(l);});
|
||||
user.update_lines = false;
|
||||
} else {
|
||||
ret["balls"] = vector_to_json(app->sim.balls, [](ball_type const & b){return cheap_ball_type(b);});
|
||||
}
|
||||
return write_json(ret);
|
||||
},
|
||||
|
|
Reference in a new issue