Browse Source

♻️ Eliminate global 'MaxStats' variable

pull/1415/head
Juliano Leal Goncalves 5 years ago committed by Anders Jenbo
parent
commit
30cd12c000
  1. 23
      Source/player.cpp
  2. 1
      Source/player.h

23
Source/player.cpp

@ -115,17 +115,7 @@ int ToBlkTbl[NUM_CLASSES] = {
25,
30,
};
/** Maps from player_class to maximum stats. */
int MaxStats[NUM_CLASSES][4] = {
// clang-format off
{ 250, 50, 60, 100 },
{ 55, 70, 250, 80 },
{ 45, 250, 85, 80 },
{ 150, 80, 150, 80 },
{ 120, 120, 120, 100 },
{ 255, 0, 55, 150 },
// clang-format on
};
/** Specifies the experience point limit of each level. */
int ExpLvlsTbl[MAXCHARLEVEL] = {
0,
@ -207,6 +197,17 @@ Sint32 PlayerStruct::GetBaseAttributeValue(attribute_id attribute) const
Sint32 PlayerStruct::GetMaximumAttributeValue(attribute_id attribute) const
{
static const int MaxStats[NUM_CLASSES][4] = {
// clang-format off
{ 250, 50, 60, 100 },
{ 55, 70, 250, 80 },
{ 45, 250, 85, 80 },
{ 150, 80, 150, 80 },
{ 120, 120, 120, 100 },
{ 255, 0, 55, 150 },
// clang-format on
};
return MaxStats[_pClass][attribute];
}

1
Source/player.h

@ -314,7 +314,6 @@ extern int StrengthTbl[NUM_CLASSES];
extern int MagicTbl[NUM_CLASSES];
extern int DexterityTbl[NUM_CLASSES];
extern int VitalityTbl[NUM_CLASSES];
extern int MaxStats[NUM_CLASSES][4];
extern int ExpLvlsTbl[MAXCHARLEVEL];
#ifdef __cplusplus

Loading…
Cancel
Save