Fix monsters in outdoor combat showing up as empties

- And cut out few more legacy bits from the monster class
This commit is contained in:
2014-04-19 02:04:12 -04:00
parent f8b40ec2ea
commit 211cf06b5c
4 changed files with 11 additions and 10 deletions

View File

@@ -2335,7 +2335,7 @@ void monster_attack_pc(short who_att,short target)
attacker->m_type,sound_type) &&
(store_hp - univ.party[target].cur_health > 0)) {
damaged_message(store_hp - univ.party[target].cur_health,
(i > 0) ? attacker->a23_type : attacker->a1_type);
attacker->a[i].type);
if (univ.party[target].status[10] > 0) {
add_string_to_buf(" Shares damage! ");
@@ -2507,7 +2507,7 @@ void monster_attack_monster(short who_att,short attackee)
dam_type += DAMAGE_MARKED;
if (damage_monst(attackee,7,r2,0,dam_type,sound_type) == true) {
damaged_message(store_hp - target->health,
(i > 0) ? attacker->a23_type : attacker->a1_type);
attacker->a[i].type);
if ((attacker->poison > 0) && (i == 0)) {
poison_monst(target,attacker->poison);
@@ -4795,7 +4795,7 @@ void add_new_action(short pc_num)
short get_monst_sound(cCreature *attacker,short which_att) {
short type,strength;
type = (which_att == 0) ? attacker->a1_type : attacker->a23_type;
type = attacker->a[which_att].type;
strength = attacker->a[which_att];
switch (type) {

View File

@@ -230,8 +230,7 @@ void set_up_monst(short mode,m_num_t m_num)
for (which = 0; which < univ.town->max_monst(); which++)
if (univ.town.monst[which].active == 0) {
univ.town.monst[which].number = m_num;
univ.town.monst[which] = cCreature();
univ.town.monst[which] = cCreature(m_num);
univ.town.monst[which].active = 2;
univ.town.monst[which].summoned = 0;
univ.town.monst[which].attitude = mode + 1;

View File

@@ -17,7 +17,6 @@
cMonster& cMonster::operator = (legacy::monster_record_type& old){
int i;
m_num = old.m_num;
level = old.level;
//m_name = old.m_name;
health = old.health;
@@ -28,8 +27,8 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){
skill = old.skill;
for(i = 0; i < 3; i++) a[i] = old.a[i];
// TODO: These two bits of data belong in a[]
a1_type = old.a1_type;
a23_type = old.a23_type;
a[0].type = old.a1_type;
a[1].type = a[2].type = old.a23_type;
m_type = (eMonsterType) old.m_type;
speed = old.speed;
ap = old.ap;
@@ -78,6 +77,10 @@ cCreature::cCreature(){
target = 6;
}
cCreature::cCreature(int num) : cCreature() {
number = num;
}
cCreature& cCreature::operator = (legacy::creature_start_type old){
number = old.number;
start_attitude = old.start_attitude;

View File

@@ -103,7 +103,6 @@ public:
unsigned char extra1, extra2;
operator std::string();
};
m_num_t m_num; // TODO: This probably shouldn't be necessary. Consider why it is, and determine if it can be removed
unsigned char level;
std::string m_name;
short health; // TODO: Move health, mp and max_mp to cCreature
@@ -113,7 +112,6 @@ public:
unsigned char armor;
unsigned char skill;
cAttack a[3];
unsigned char a1_type,a23_type; // TODO: Delete in favour of type field of cAttack
eMonsterType m_type;
unsigned char speed;
unsigned char ap; // TODO: Move ap to cCreature
@@ -172,6 +170,7 @@ public:
location targ_loc;
cCreature();
cCreature(int num);
cCreature& operator = (legacy::creature_data_type old);
cCreature& operator = (legacy::creature_start_type old);