fix a crash in some pacifist spell checks

This commit is contained in:
2025-04-05 20:47:29 -05:00
parent fe69f57345
commit 947787f5c6
2 changed files with 4 additions and 4 deletions

View File

@@ -4511,7 +4511,7 @@ bool combat_cast_mage_spell() {
spell_num = univ.current_pc().last_cast[eSkill::MAGE_SPELLS];
}
if(univ.current_pc().traits[eTrait::PACIFIST] && !(*spell_num).peaceful) {
if(univ.current_pc().traits[eTrait::PACIFIST] && spell_num != eSpell::NONE && !(*spell_num).peaceful) {
add_string_to_buf("Cast: You're a pacifist!");
return false;
}
@@ -4739,7 +4739,7 @@ bool combat_cast_priest_spell() {
return false;
}
if(univ.current_pc().traits[eTrait::PACIFIST] && !(*spell_num).peaceful) {
if(univ.current_pc().traits[eTrait::PACIFIST] && spell_num != eSpell::NONE && !(*spell_num).peaceful) {
add_string_to_buf("Cast: You're a pacifist!");
return false;
}

View File

@@ -578,7 +578,7 @@ void do_mage_spell(short pc_num,eSpell spell_num,bool freebie) {
add_string_to_buf("Cast: You're an Anama!");
return;
}
if(univ.party[pc_num].traits[eTrait::PACIFIST] && !(*spell_num).peaceful) {
if(univ.party[pc_num].traits[eTrait::PACIFIST] && spell_num != eSpell::NONE && !(*spell_num).peaceful) {
add_string_to_buf("Cast: You're a pacifist!");
return;
}
@@ -830,7 +830,7 @@ void do_priest_spell(short pc_num,eSpell spell_num,bool freebie) {
location loc;
location where;
if(univ.party[pc_num].traits[eTrait::PACIFIST] && !(*spell_num).peaceful) {
if(univ.party[pc_num].traits[eTrait::PACIFIST] && spell_num != eSpell::NONE && !(*spell_num).peaceful) {
add_string_to_buf("Cast: You're a pacifist!");
return;
}