diff --git a/src/dude.cpp b/src/dude.cpp index dc1b480..039898a 100644 --- a/src/dude.cpp +++ b/src/dude.cpp @@ -8,8 +8,10 @@ Dude::Dude(const Coord &_pos, Map *_map, const int &_team) : m_team(_team), m_dead(false), m_success(true), + m_receivedComData(false), m_inventory(EMPTY) { + memset(m_com_data.data, 0, COM_SIZE); m_action.dir = NO_DIR; m_action.type = Action::WAIT; m_action.com_data = Com(); diff --git a/src/simulation.cpp b/src/simulation.cpp index 435480a..86fd068 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -220,7 +220,7 @@ void Simulation::handleAction(Dude *dude) Dude *targetDude = target.data.dudePtr; // TODO check conflicts between writers if(targetDude->getCom() == nullptr){ - targetDude->receiveComData(Dir((action.dir+2)%4), targetDude->getAction().com_data.data); + targetDude->receiveComData(Dir((action.dir+2)%4), dude->getAction().com_data.data); dude->setSuccess(true); }else dude->setSuccess(false);