diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-02-04 16:19:21 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-02-04 17:43:24 +0100 |
commit | f7d71e54c0b5fdaa9e8aa1e69e615b9f80d124e4 (patch) | |
tree | 24a1d06ef633fe3a1bf4943846666f48aaf0c32a /src/game-server/character.h | |
parent | 5255be5a5457e287464606478df62300a44d8479 (diff) | |
download | manaserv-f7d71e54c0b5fdaa9e8aa1e69e615b9f80d124e4.tar.gz manaserv-f7d71e54c0b5fdaa9e8aa1e69e615b9f80d124e4.tar.bz2 manaserv-f7d71e54c0b5fdaa9e8aa1e69e615b9f80d124e4.tar.xz manaserv-f7d71e54c0b5fdaa9e8aa1e69e615b9f80d124e4.zip |
Moved attribute (re)calculation to the scripts
This introduces two callbacks:
- on_update_derived_attribute -> Called to recalculate other derived
attributes.
- on_recalculate_base_attribute -> Called to recalculate a base attribute
(only called for characters. However the
function passed as callback can be useful
for recalculating the derived attributes
as well)
Monsters no longer block recalculation of attributes except HP and Speed.
I saw no sense to keep this.
Fixed constant value in libmana-constants.lua
Dropped bool type of the recalculation functions. It would be difficult to
keep it while pushing all to the script engine and it was unused anyway.
All in all this adds a LOT more flexibillity to projects since they can now
adapt all attributes in the way they want.
Diffstat (limited to 'src/game-server/character.h')
-rw-r--r-- | src/game-server/character.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/game-server/character.h b/src/game-server/character.h index d225081b..9c9a5459 100644 --- a/src/game-server/character.h +++ b/src/game-server/character.h @@ -251,11 +251,11 @@ class Character : public Being void modifiedAllAttribute(); /** - * Recalculate the base value of an attribute and update derived - * attributes if it has changed. - * @returns Whether it was changed. - */ - bool recalculateBaseAttribute(unsigned); + * Recalculate the base value of an attribute and update derived + * attributes if it has changed. + */ + void recalculateBaseAttribute(unsigned); + /** * Attribute has changed, recalculate base value of dependant |