mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 09:53:38 +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;
|
||||
}
|
||||
|
||||
} 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)) {
|
||||
int x = 0, y = 0;
|
||||
sscanf(line.c_str(), "%d %d", &x, &y);
|
||||
|
@ -214,16 +223,6 @@ bump_negot:
|
|||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue