diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-08-19 22:15:26 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-08-26 22:56:48 +0200 |
commit | 81a88f1dd199691ce570ab124a43740b77a67f03 (patch) | |
tree | e5cd82a8b73c1d909f63fb18357daac91f7c0d62 /src/game-server/monster.cpp | |
parent | b379c150cedfbae4775c8358369ec590ad4033f4 (diff) | |
download | manaserv-81a88f1dd199691ce570ab124a43740b77a67f03.tar.gz manaserv-81a88f1dd199691ce570ab124a43740b77a67f03.tar.bz2 manaserv-81a88f1dd199691ce570ab124a43740b77a67f03.tar.xz manaserv-81a88f1dd199691ce570ab124a43740b77a67f03.zip |
Allowed to push attributeinfos for the attribute recalculation
While on it I replaced the id usage in the server with the usage of the
AttributeInfo directly.
Next steps:
- Dehardcode the core attribute ids and store their
attributeinfos somewhere in AttributeManager (for now i simply
wrapped the ids with getAttributeInfo().
- Move AttributeInfo out of AttributeManager to shorten the usage + to
allow using a pointer in ModifierLocation without forward declaring
it.
Diffstat (limited to 'src/game-server/monster.cpp')
-rw-r--r-- | src/game-server/monster.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp index 41a69ecb..cf589977 100644 --- a/src/game-server/monster.cpp +++ b/src/game-server/monster.cpp @@ -51,9 +51,9 @@ MonsterComponent::MonsterComponent(Entity &entity, MonsterClass *specy): */ auto *beingComponent = entity.getComponent<BeingComponent>(); - for (auto attrInfo : attributeManager->getAttributeScope(MonsterScope)) + for (auto attribute : attributeManager->getAttributeScope(MonsterScope)) { - beingComponent->createAttribute(attrInfo.first, attrInfo.second); + beingComponent->createAttribute(attribute); } /* @@ -63,15 +63,15 @@ MonsterComponent::MonsterComponent(Entity &entity, MonsterClass *specy): int mutation = specy->getMutation(); - for (auto &attribute : specy->getAttributes()) + for (auto &attributeIt : specy->getAttributes()) { - double attributeValue = attribute.second; + double attributeValue = attributeIt.second; if (mutation != 0) { double factor = 100 + (rand() % (mutation * 2)) - mutation; attributeValue = attributeValue * factor / 100.0; } - beingComponent->setAttribute(entity, attribute.first->id, + beingComponent->setAttribute(entity, attributeIt.first, attributeValue); } |