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) && attacker->m_type,sound_type) &&
(store_hp - univ.party[target].cur_health > 0)) { (store_hp - univ.party[target].cur_health > 0)) {
damaged_message(store_hp - univ.party[target].cur_health, 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) { if (univ.party[target].status[10] > 0) {
add_string_to_buf(" Shares damage! "); add_string_to_buf(" Shares damage! ");
@@ -2507,7 +2507,7 @@ void monster_attack_monster(short who_att,short attackee)
dam_type += DAMAGE_MARKED; dam_type += DAMAGE_MARKED;
if (damage_monst(attackee,7,r2,0,dam_type,sound_type) == true) { if (damage_monst(attackee,7,r2,0,dam_type,sound_type) == true) {
damaged_message(store_hp - target->health, damaged_message(store_hp - target->health,
(i > 0) ? attacker->a23_type : attacker->a1_type); attacker->a[i].type);
if ((attacker->poison > 0) && (i == 0)) { if ((attacker->poison > 0) && (i == 0)) {
poison_monst(target,attacker->poison); 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 get_monst_sound(cCreature *attacker,short which_att) {
short type,strength; short type,strength;
type = (which_att == 0) ? attacker->a1_type : attacker->a23_type; type = attacker->a[which_att].type;
strength = attacker->a[which_att]; strength = attacker->a[which_att];
switch (type) { 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++) for (which = 0; which < univ.town->max_monst(); which++)
if (univ.town.monst[which].active == 0) { if (univ.town.monst[which].active == 0) {
univ.town.monst[which].number = m_num; univ.town.monst[which] = cCreature(m_num);
univ.town.monst[which] = cCreature();
univ.town.monst[which].active = 2; univ.town.monst[which].active = 2;
univ.town.monst[which].summoned = 0; univ.town.monst[which].summoned = 0;
univ.town.monst[which].attitude = mode + 1; univ.town.monst[which].attitude = mode + 1;

View File

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

View File

@@ -103,7 +103,6 @@ public:
unsigned char extra1, extra2; unsigned char extra1, extra2;
operator std::string(); 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; unsigned char level;
std::string m_name; std::string m_name;
short health; // TODO: Move health, mp and max_mp to cCreature short health; // TODO: Move health, mp and max_mp to cCreature
@@ -113,7 +112,6 @@ public:
unsigned char armor; unsigned char armor;
unsigned char skill; unsigned char skill;
cAttack a[3]; cAttack a[3];
unsigned char a1_type,a23_type; // TODO: Delete in favour of type field of cAttack
eMonsterType m_type; eMonsterType m_type;
unsigned char speed; unsigned char speed;
unsigned char ap; // TODO: Move ap to cCreature unsigned char ap; // TODO: Move ap to cCreature
@@ -172,6 +170,7 @@ public:
location targ_loc; location targ_loc;
cCreature(); cCreature();
cCreature(int num);
cCreature& operator = (legacy::creature_data_type old); cCreature& operator = (legacy::creature_data_type old);
cCreature& operator = (legacy::creature_start_type old); cCreature& operator = (legacy::creature_start_type old);