mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-03 02:13:35 +02:00
connection::actions(): Fix negotiation termination by empty line
This commit is contained in:
parent
4fb7b18dd3
commit
a9884cf827
1 changed files with 9 additions and 10 deletions
|
@ -173,6 +173,15 @@ bump_negot:
|
||||||
negotiation = agent->newborn;
|
negotiation = agent->newborn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (negotiation && !cmd.compare("")) {
|
||||||
|
agent->newborn = negotiation = false;
|
||||||
|
if (!agent->tile)
|
||||||
|
agent->spawn();
|
||||||
|
|
||||||
|
std::stringstream s;
|
||||||
|
s << "agent_id " << agent->id << "\r\n";
|
||||||
|
out_buf.append(s.str());
|
||||||
|
|
||||||
} else if (!negotiation && !cmd.compare("move_dir") && !(mask & 1)) {
|
} else if (!negotiation && !cmd.compare("move_dir") && !(mask & 1)) {
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
sscanf(line.c_str(), "%d %d", &x, &y);
|
sscanf(line.c_str(), "%d %d", &x, &y);
|
||||||
|
@ -214,16 +223,6 @@ bump_negot:
|
||||||
}
|
}
|
||||||
in_buf.erase(0, 2);
|
in_buf.erase(0, 2);
|
||||||
|
|
||||||
if (negotiation) {
|
|
||||||
agent->newborn = negotiation = false;
|
|
||||||
if (!agent->tile)
|
|
||||||
agent->spawn();
|
|
||||||
|
|
||||||
std::stringstream s;
|
|
||||||
s << "agent_id " << agent->id << "\r\n";
|
|
||||||
out_buf.append(s.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&buf_lock);
|
pthread_mutex_unlock(&buf_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue