void Robot::runRobot() { if (canRun) { //position->print(); if (updateHouse(*position)) score.setDirtCollected(score.getDirtCollected() + 1); updateBattery(*position, *battery); if (battery->isEmpry()) { canRun = false; brokedDown = true; score.setPosition(10); return; } algo->setSensor(*sensor); Direction direction = algo->step(); //should check if direction is legal position->move(direction); if (crashedToWall(*position)) { canRun = false; brokedDown = true; return; } sensor->getInfoFromPoint(house, position); score.setNumSteps(score.getNumSteps() + 1); } }
void HouseTile::__internalAddThing(uint32_t index, Thing* thing) { Tile::__internalAddThing(index, thing); if(Item* item = thing->getItem()){ updateHouse(item); } }
void HouseTile::__internalAddThing(uint32_t index, Thing* thing) { Tile::__internalAddThing(index, thing); if(!thing->getParent()) return; if(Item* item = thing->getItem()) updateHouse(item); }
void HouseTile::__addThing(Creature* actor, int32_t index, Thing* thing) { Tile::__addThing(actor, index, thing); if(!thing->getParent()) return; if(Item* item = thing->getItem()) updateHouse(item); }
void HouseTile::__addThing(int32_t index, Thing* thing) { Tile::__addThing(index, thing); if (!thing->getParent()) { return; } if (Item* item = thing->getItem()) { updateHouse(item); } }
void HouseTile::__internalAddThing(uint32_t index, Thing* thing) { Tile::__internalAddThing(index, thing); if (!thing->getParent()) { // happens when placing a magic field on an existing one which is non-replaceable return; } if (Item* item = thing->getItem()) { updateHouse(item); } }