Exemplo n.º 1
0
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);
	}
}
Exemplo n.º 2
0
void HouseTile::__internalAddThing(uint32_t index, Thing* thing)
{
	Tile::__internalAddThing(index, thing);

	if(Item* item = thing->getItem()){
		updateHouse(item);
	}
}
Exemplo n.º 3
0
void HouseTile::__internalAddThing(uint32_t index, Thing* thing)
{
	Tile::__internalAddThing(index, thing);
	if(!thing->getParent())
		return;

	if(Item* item = thing->getItem())
		updateHouse(item);
}
Exemplo n.º 4
0
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);
}
Exemplo n.º 5
0
void HouseTile::__addThing(int32_t index, Thing* thing)
{
	Tile::__addThing(index, thing);

	if (!thing->getParent()) {
		return;
	}

	if (Item* item = thing->getItem()) {
		updateHouse(item);
	}
}
Exemplo n.º 6
0
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);
    }
}