From cad7cc19a2796fe76f0d75309655d8cae62cbac7 Mon Sep 17 00:00:00 2001 From: Anselme Date: Sun, 26 Feb 2017 16:18:06 +0100 Subject: [PATCH] fixed a few bugs --- src/dude.cpp | 2 ++ src/simulation.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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);