diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-10 23:04:42 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-11 13:47:17 +0200 |
commit | d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da (patch) | |
tree | 1b4d200ba66c6afcdb7763951980476756339cf1 /src/game-server/spawnareacomponent.cpp | |
parent | aa04597c5f8bb806996d604699fc8ebff6d53bdd (diff) | |
download | manaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.tar.gz manaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.tar.bz2 manaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.tar.xz manaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.zip |
Converted Being into a Component
I did not really care too much about staying consistent with the use of
static_casts to Actors since they are only temporary anyway until Actor
is a component too.
Diffstat (limited to 'src/game-server/spawnareacomponent.cpp')
-rw-r--r-- | src/game-server/spawnareacomponent.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/game-server/spawnareacomponent.cpp b/src/game-server/spawnareacomponent.cpp index 557a2da5..843371a7 100644 --- a/src/game-server/spawnareacomponent.cpp +++ b/src/game-server/spawnareacomponent.cpp @@ -67,10 +67,12 @@ void SpawnAreaComponent::update(Entity &entity) const int width = mZone.w; const int height = mZone.h; - Being *being = new Being(OBJECT_MONSTER); + Actor *being = new Actor(OBJECT_MONSTER); + auto *beingComponent = new BeingComponent(*being); + being->addComponent(beingComponent); being->addComponent(new MonsterComponent(*being, mSpecy)); - if (being->getModifiedAttribute(ATTR_MAX_HP) <= 0) + if (beingComponent->getModifiedAttribute(ATTR_MAX_HP) <= 0) { LOG_WARN("Refusing to spawn dead monster " << mSpecy->getId()); delete being; @@ -96,7 +98,7 @@ void SpawnAreaComponent::update(Entity &entity) being->setMap(map); being->setPosition(position); - being->clearDestination(); + beingComponent->clearDestination(*being); GameState::enqueueInsert(being); mNumBeings++; |