Browse Source

Fix crash on maintained spells

Image 11 months ago
parent
commit
eaca445168

+ 1 - 0
EQ2/source/WorldServer/Entity.cpp

@@ -853,6 +853,7 @@ void Entity::RemoveMaintainedSpell(LuaSpell* luaspell){
 		memset(&GetInfoStruct()->maintained_effects[29], 0, sizeof(MaintainedEffects));
 		GetInfoStruct()->maintained_effects[29].spell_id = 0xFFFFFFFF;
 		GetInfoStruct()->maintained_effects[29].icon = 0xFFFF;
+		GetInfoStruct()->maintained_effects[29].spell = nullptr;
 	}
 	MMaintainedSpells.releasewritelock(__FUNCTION__, __LINE__);
 }

+ 2 - 0
EQ2/source/WorldServer/Entity.h

@@ -776,6 +776,8 @@ struct InfoStruct{
 				maintained_effects[i].spell_id = 0xFFFFFFFF;
 				if (spawn->IsPlayer())
 					maintained_effects[i].icon = 0xFFFF;
+
+				maintained_effects[i].spell = nullptr;
 			}
 			spell_effects[i].spell_id = 0xFFFFFFFF;	
 			spell_effects[i].spell = nullptr;

+ 3 - 0
EQ2/source/WorldServer/Player.cpp

@@ -2918,8 +2918,10 @@ PlayerInfo::PlayerInfo(Player* in_player){
 		if(i<30){
 			info_struct->maintained_effects[i].spell_id = 0xFFFFFFFF;
 			info_struct->maintained_effects[i].icon = 0xFFFF;
+			info_struct->maintained_effects[i].spell = nullptr;
 		}
 		info_struct->spell_effects[i].spell_id = 0xFFFFFFFF;	
+		info_struct->spell_effects[i].spell = nullptr;	
 	}
 	
 	house_zone_id = 0;
@@ -3163,6 +3165,7 @@ void Player::RemoveMaintainedSpell(LuaSpell* luaspell){
 		memset(&GetInfoStruct()->maintained_effects[29], 0, sizeof(MaintainedEffects));
 		GetInfoStruct()->maintained_effects[29].spell_id = 0xFFFFFFFF;
 		GetInfoStruct()->maintained_effects[29].icon = 0xFFFF;
+		GetInfoStruct()->maintained_effects[29].spell = nullptr;
 		charsheet_changed = true;
 	}
 	GetMaintainedMutex()->releasewritelock(__FUNCTION__, __LINE__);