Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket: distinguish robots by team #217

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/games/rcll/websocket.clp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@

(defrule ws-update-robot
"send update of a robot, whenever the robot fact changes"
?sf <- (robot (number ?number) (name ?name))
?sf <- (robot (number ?number) (name ?name) (team ?team))
=>
(ws-create-RobotInfo ?number ?name)
(ws-create-RobotInfo ?number ?name ?team)
)

(defrule ws-update-agent-task
Expand Down
3 changes: 2 additions & 1 deletion src/libs/websocket/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ Data::log_push_order_info_via_delivery(int delivery_id)
*
*/
void
Data::log_push_robot_info(int number, std::string name)
Data::log_push_robot_info(int number, std::string name, std::string team)
{
MutexLocker lock(&env_mutex_);

Expand All @@ -565,6 +565,7 @@ Data::log_push_robot_info(int number, std::string name)
if (match(fact, "robot")) {
try {
if (get_value<int64_t>(fact, "number") == number
&& get_value<std::string>(fact, "team") == team
&& get_value<std::string>(fact, "name") == name) {
facts.push_back(fact);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/websocket/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Data
void log_push_cfg_preset(const std::string &category, const std::string &preset);
void log_push_game_state();
void log_push_time_info();
void log_push_robot_info(int number, std::string name);
void log_push_robot_info(int number, std::string name, std::string team);
void log_push_agent_task_info(int tid, int rid);
void log_push_order_info(int id);
void log_push_machine_info(std::string name);
Expand Down
2 changes: 1 addition & 1 deletion src/refbox/refbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,7 @@ LLSFRefBox::setup_clips_websocket()
&websocket::Data::log_push_time_info)));

clips_->add_function("ws-create-RobotInfo",
sigc::slot<void, int, std::string>(
sigc::slot<void, int, std::string, std::string>(
sigc::mem_fun(*(backend_->get_data()),
&websocket::Data::log_push_robot_info)));
clips_->add_function("ws-create-AgentTaskInfo",
Expand Down