Strictify race enum
- This incidentally fixes a lot of things that were broken in the previous commit due to the magic values changing
This commit is contained in:
@@ -26,7 +26,7 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){
|
||||
// Unless human, add 3 to the monster's type to get its race
|
||||
// This is because nephil, slith, and vahnatai were inserted
|
||||
if(old.m_type) m_type = eRace(old.m_type + 3);
|
||||
else m_type = RACE_HUMAN;
|
||||
else m_type = eRace::HUMAN;
|
||||
speed = old.speed;
|
||||
mu = old.mu;
|
||||
cl = old.cl;
|
||||
@@ -166,7 +166,7 @@ std::istream& operator >> (std::istream& in, eRace& e){
|
||||
in >> i;
|
||||
if(i > 0 && i < 20)
|
||||
e = (eRace) i;
|
||||
else e = RACE_HUMAN;
|
||||
else e = eRace::HUMAN;
|
||||
return in;
|
||||
}
|
||||
|
||||
@@ -380,56 +380,56 @@ cMonster::cAbility::operator std::string(){
|
||||
break;
|
||||
case MONST_SUMMON_SPECIES:
|
||||
sout << "Summons ";
|
||||
switch(extra1){
|
||||
case RACE_HUMAN:
|
||||
switch((eRace)extra1){
|
||||
case eRace::HUMAN:
|
||||
sout << "Humans";
|
||||
break;
|
||||
case RACE_NEPHIL:
|
||||
case eRace::NEPHIL:
|
||||
sout << "Nephilim";
|
||||
break;
|
||||
case RACE_SLITH:
|
||||
case eRace::SLITH:
|
||||
sout << "Slithzerikai";
|
||||
break;
|
||||
case RACE_VAHNATAI:
|
||||
case eRace::VAHNATAI:
|
||||
sout << "Vahnatai";
|
||||
break;
|
||||
case RACE_REPTILE:
|
||||
case eRace::REPTILE:
|
||||
sout << "reptiles";
|
||||
break;
|
||||
case RACE_BEAST:
|
||||
case eRace::BEAST:
|
||||
sout << "beasts";
|
||||
break;
|
||||
case RACE_HUMANOID:
|
||||
case eRace::HUMANOID:
|
||||
sout << "humanoids";
|
||||
break;
|
||||
case RACE_DEMON:
|
||||
case eRace::DEMON:
|
||||
sout << "demons";
|
||||
break;
|
||||
case RACE_UNDEAD:
|
||||
case eRace::UNDEAD:
|
||||
sout << "undead";
|
||||
break;
|
||||
case RACE_GIANT:
|
||||
case eRace::GIANT:
|
||||
sout << "giants";
|
||||
break;
|
||||
case RACE_SLIME:
|
||||
case eRace::SLIME:
|
||||
sout << "slimes";
|
||||
break;
|
||||
case RACE_STONE:
|
||||
case eRace::STONE:
|
||||
sout << "golems";
|
||||
break;
|
||||
case RACE_BUG:
|
||||
case eRace::BUG:
|
||||
sout << "bugs";
|
||||
break;
|
||||
case RACE_DRAGON:
|
||||
case eRace::DRAGON:
|
||||
sout << "Dragons";
|
||||
break;
|
||||
case RACE_MAGICAL:
|
||||
case eRace::MAGICAL:
|
||||
sout << "magical creatures";
|
||||
break;
|
||||
case RACE_PLANT:
|
||||
case eRace::PLANT:
|
||||
sout << "plants";
|
||||
break;
|
||||
case RACE_BIRD:
|
||||
case eRace::BIRD:
|
||||
sout << "birds";
|
||||
break;
|
||||
default: // Important, Mage, Priest, or invalid
|
||||
|
@@ -50,7 +50,9 @@ cPlayer& cPlayer::operator = (legacy::pc_record_type old){
|
||||
|
||||
short cPlayer::get_tnl(){
|
||||
short tnl = 100,i,store_per = 100;
|
||||
static const short rp[3] = {0,12,20};
|
||||
// Omitting a race from this list gives it a value of 0, thanks to the defaulting implementation of operator[]
|
||||
// TODO: Vahnatai
|
||||
static std::map<const eRace, const int> rp = {{eRace::NEPHIL,12},{eRace::SLITH,20}};
|
||||
static const short ap[15] = {10,20,8,10,4, 6,10,7,12,15, -10,-8,-8,-20,-8};
|
||||
|
||||
tnl = (tnl * (100 + rp[race])) / 100;
|
||||
@@ -95,7 +97,7 @@ cPlayer::cPlayer(){
|
||||
//advan[i] = false;
|
||||
traits[i] = false;
|
||||
}
|
||||
race = RACE_HUMAN;
|
||||
race = eRace::HUMAN;
|
||||
//exp_adj = 100;
|
||||
direction = 0;
|
||||
}
|
||||
@@ -153,7 +155,7 @@ cPlayer::cPlayer(long key,short slot){
|
||||
traits[i] = false;
|
||||
}
|
||||
|
||||
race = RACE_HUMAN;
|
||||
race = eRace::HUMAN;
|
||||
//exp_adj = 100;
|
||||
direction = 0;
|
||||
}else if(key == 'dflt'){
|
||||
|
@@ -55,30 +55,37 @@ inline bool isDead(eMainStatus stat) {
|
||||
}
|
||||
|
||||
/* adven[i].race */ //complete
|
||||
enum eRace {
|
||||
RACE_UNKNOWN = -1, // for parameters to some functions; not valid in the class
|
||||
RACE_HUMAN = 0,
|
||||
RACE_NEPHIL = 1,
|
||||
RACE_SLITH = 2,
|
||||
RACE_VAHNATAI = 3,
|
||||
RACE_REPTILE = 4,
|
||||
RACE_BEAST = 5,
|
||||
RACE_IMPORTANT = 6,
|
||||
RACE_MAGE = 7,
|
||||
RACE_PRIEST = 8,
|
||||
RACE_HUMANOID = 9,
|
||||
RACE_DEMON = 10,
|
||||
RACE_UNDEAD = 11,
|
||||
RACE_GIANT = 12,
|
||||
RACE_SLIME = 13,
|
||||
RACE_STONE = 14,
|
||||
RACE_BUG = 15,
|
||||
RACE_DRAGON = 16,
|
||||
RACE_MAGICAL = 17,
|
||||
RACE_PLANT = 18,
|
||||
RACE_BIRD = 19,
|
||||
enum class eRace {
|
||||
UNKNOWN = -1, // for parameters to some functions; not valid in the class
|
||||
HUMAN = 0,
|
||||
NEPHIL = 1,
|
||||
SLITH = 2,
|
||||
VAHNATAI = 3, // Former value from eMonsterType
|
||||
REPTILE = 4, // 1
|
||||
BEAST = 5, // 2
|
||||
IMPORTANT = 6, // 3
|
||||
MAGE = 7, // 4
|
||||
PRIEST = 8, // 5
|
||||
HUMANOID = 9, // 6
|
||||
DEMON = 10, // 7
|
||||
UNDEAD = 11, // 8
|
||||
GIANT = 12, // 9
|
||||
SLIME = 13, // 10
|
||||
STONE = 14, // 11
|
||||
BUG = 15, // 12
|
||||
DRAGON = 16, // 13
|
||||
MAGICAL = 17, // 14
|
||||
PLANT = 18,
|
||||
BIRD = 19,
|
||||
};
|
||||
|
||||
// Types IMPORTANT, MAGE, and PRIEST are implicitly human
|
||||
// Types NEPHIL, SLITH, and VAHNATAI are implicitly humanoid
|
||||
inline bool isHumanoid(eRace race) {
|
||||
int code = (int) race;
|
||||
return (code >= 0 && code <= 3) || (code >= 6 && code <= 9);
|
||||
}
|
||||
|
||||
/* adven[i].status*/ //complete - assign a positive value for a help pc effect, a negative for harm pc
|
||||
enum eStatus {
|
||||
STATUS_POISONED_WEAPON = 0,
|
||||
|
Reference in New Issue
Block a user