45 static struct nodes_node nodes[2000];
47 int nodes_base_node_port = 0;
56 nodes_add(
int pid,
int x,
int y,
int port,
int id)
58 nodes[numnodes].pid = pid;
59 nodes[numnodes].x = x;
60 nodes[numnodes].y = y;
61 nodes[numnodes].port = port;
62 nodes[numnodes].leds = 0;
63 nodes[numnodes].done = 0;
64 nodes[numnodes].id = id;
72 for(i = 0; i < numnodes; ++i) {
73 kill(nodes[i].pid, SIGTERM);
87 fprintf(stderr,
"nodes_node: request for %d > %d\n", num, numnodes);
93 static struct nodes_node *
94 find_node(
int x,
int y)
98 for(i = numnodes; i >= 0; --i) {
99 if(nodes[i].x == x && nodes[i].y == y) {
107 nodes_set_leds(
int x,
int y,
int leds)
109 find_node(x, y)->leds = leds;
113 nodes_set_text(
int x,
int y,
char *text)
115 strncpy(find_node(x, y)->text, text, NODES_TEXTLEN);
119 nodes_set_radio_status(
int x,
int y,
int radio_status)
121 find_node(x, y)->radio_status = radio_status;
125 nodes_set_line(
int x,
int y,
int linex,
int liney)
127 struct nodes_node *n;
135 nodes_find_pid(pid_t pid)
138 printf(
"Nofodes %d\n", numnodes);
139 for(i = 0; i < numnodes; ++i) {
140 printf(
"%d == %d\n", pid, nodes[i].pid); fflush(
NULL);
141 if(nodes[i].pid == pid) {
154 for(i = numnodes; i >= 0; --i) {
155 if(nodes[i].
id ==
id) {
158 if(nodes[i].done != 0) {
163 if(num_done == numnodes) {