connection::actions(): Fix negotiation termination by empty line

This commit is contained in:
Petr Baudis 2011-12-26 20:27:29 +01:00
parent 4fb7b18dd3
commit a9884cf827

View file

@ -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);
}