fixed a few bugs

This commit is contained in:
Anselme 2017-02-26 16:18:06 +01:00
parent bb470ad518
commit cad7cc19a2
2 changed files with 3 additions and 1 deletions

View File

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

View File

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