Example #1
0
void DieAction::dropOnGround(ActorPtr item)
{
  MapPtr map = _performer->getMap();
  if ( map != nullptr )
  {
    item->setPosition( _performer->getX(), _performer->getY() );
    map->addActor(item);
  }
}
Example #2
0
TEST_F(MapTest, addActor)
{
  MapPtr map = mapGateway.fetch(MapId::GameStart);
  ActorPtr actor = Actor::create(ActorType::HealthPotion,1,1);

  map->addActor(actor);
  auto actors = map->getActors(1,1);

  EXPECT_EQ(actors.size(), (size_t)1);
  EXPECT_TRUE( actors.front().get() == actor.get() );
}
Example #3
0
void Destroyable::dropOnGround(ActorPtr item)
{
  ActorPtr owner = getOwner().lock();
  if (owner)
  {
    MapPtr map = owner->getMap();
    if ( map != nullptr )
    {
      item->setMap(nullptr);
      item->setPosition( owner->getX(), owner->getY() );
      map->addActor(item);
    }
  }
}