mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-03 02:13:35 +02:00
Connection: Add 'move' attribute to the negotiation phase
This commit is contained in:
parent
9cf99e0bcd
commit
2907cb6791
4 changed files with 25 additions and 1 deletions
|
@ -69,7 +69,13 @@ connection::actions(class agent &agent)
|
|||
std::string cmd = line.substr(0, spofs);
|
||||
line.erase(0, spofs + 1);
|
||||
|
||||
if (!cmd.compare("move_dir")) {
|
||||
if (negotiation && !cmd.compare("move")) {
|
||||
double mprob = 1.0;
|
||||
sscanf(line.c_str(), "%lf", &mprob);
|
||||
if (mprob >= 0 && mprob <= 1)
|
||||
agent.attr.move = mprob;
|
||||
|
||||
} else if (!negotiation && !cmd.compare("move_dir")) {
|
||||
int x = 0, y = 0;
|
||||
sscanf(line.c_str(), "%d %d", &x, &y);
|
||||
if (x < -1) x = -1; if (x > 1) x = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue