… | |
… | |
139 | /* |
139 | /* |
140 | Since this is nowhere defined ... |
140 | Since this is nowhere defined ... |
141 | Both come in handy at least in function add_exp() |
141 | Both come in handy at least in function add_exp() |
142 | */ |
142 | */ |
143 | |
143 | |
144 | #define MAX_EXPERIENCE levels[settings.max_level] |
144 | #define MAX_EXPERIENCE levels [settings.max_level] |
145 | |
145 | |
146 | /* because exp_obj sum to make the total score, |
146 | /* because exp_obj sum to make the total score, |
147 | * we cannot allow that sum to exceed the maximum |
147 | * we cannot allow that sum to exceed the maximum |
148 | * amount of experience a player can gain. Thus |
148 | * amount of experience a player can gain. Thus |
149 | * we define MAX_EXP_IN_OBJ. It is important to try |
149 | * we define MAX_EXP_IN_OBJ. It is important to try |
… | |
… | |
156 | * line with progression of previous levels, so |
156 | * line with progression of previous levels, so |
157 | * if more levels are desired, this should be fixed. |
157 | * if more levels are desired, this should be fixed. |
158 | * -b.t. |
158 | * -b.t. |
159 | */ |
159 | */ |
160 | |
160 | |
161 | #define MAX_EXP_IN_OBJ levels[settings.max_level]/(MAX_EXP_CAT - 1) |
161 | #define MAX_EXP_IN_OBJ MAX_EXP_IN_OBJ / (MAX_EXP_CAT - 1) |
162 | |
|
|
163 | extern sint64 *levels; |
|
|
164 | |
162 | |
165 | #define MAX_SAVE_LEVEL 110 |
163 | #define MAX_SAVE_LEVEL 110 |
166 | |
164 | |
167 | /* This no longer needs to be changed anytime the number of |
165 | /* This no longer needs to be changed anytime the number of |
168 | * levels is increased - rather, did_make_save will do the |
166 | * levels is increased - rather, did_make_save will do the |
… | |
… | |
1612 | */ |
1610 | */ |
1613 | |
1611 | |
1614 | sint64 |
1612 | sint64 |
1615 | level_exp (int level, double expmul) |
1613 | level_exp (int level, double expmul) |
1616 | { |
1614 | { |
1617 | if (level > settings.max_level) |
1615 | return expmul * level_to_min_exp (level); |
1618 | return (sint64) (expmul * levels[settings.max_level]); |
|
|
1619 | |
|
|
1620 | return (sint64) (expmul * levels[level]); |
|
|
1621 | } |
1616 | } |
1622 | |
1617 | |
1623 | /* |
1618 | /* |
1624 | * Ensure that the permanent experience requirements in an exp object are met. |
1619 | * Ensure that the permanent experience requirements in an exp object are met. |
1625 | * This really just checks 'op to make sure the perm_exp value is within |
1620 | * This really just checks 'op to make sure the perm_exp value is within |
… | |
… | |
1693 | { |
1688 | { |
1694 | /* Basically, you can never gain more experience in one shot |
1689 | /* Basically, you can never gain more experience in one shot |
1695 | * than half what you need to gain for next level. |
1690 | * than half what you need to gain for next level. |
1696 | */ |
1691 | */ |
1697 | exp_to_add = exp; |
1692 | exp_to_add = exp; |
1698 | limit = (levels[op->level + 1] - levels[op->level]) / 2; |
1693 | limit = (levels [op->level + 1] - levels [op->level]) / 2; |
1699 | if (exp_to_add > limit) |
1694 | if (exp_to_add > limit) |
1700 | exp_to_add = limit; |
1695 | exp_to_add = limit; |
1701 | |
1696 | |
1702 | ADD_EXP (op->stats.exp, (sint64) ((float) exp_to_add * (skill_obj ? skill_obj->expmul : 1))); |
1697 | ADD_EXP (op->stats.exp, (sint64) ((float) exp_to_add * (skill_obj ? skill_obj->expmul : 1))); |
1703 | if (settings.permanent_exp_ratio) |
1698 | if (settings.permanent_exp_ratio) |
… | |
… | |
1710 | } |
1705 | } |
1711 | |
1706 | |
1712 | if (skill_obj) |
1707 | if (skill_obj) |
1713 | { |
1708 | { |
1714 | exp_to_add = exp; |
1709 | exp_to_add = exp; |
1715 | limit = (levels[skill_obj->level + 1] - levels[skill_obj->level]) / 2; |
1710 | limit = (levels [skill_obj->level + 1] - levels [skill_obj->level]) / 2; |
1716 | if (exp_to_add > limit) |
1711 | if (exp_to_add > limit) |
1717 | exp_to_add = limit; |
1712 | exp_to_add = limit; |
1718 | |
1713 | |
1719 | ADD_EXP (skill_obj->stats.exp, exp_to_add); |
1714 | ADD_EXP (skill_obj->stats.exp, exp_to_add); |
1720 | if (settings.permanent_exp_ratio) |
1715 | if (settings.permanent_exp_ratio) |