Browse Source

Merge branch 'master' of http://cutpon.com:3000/devn00b/EQ2EMu

devn00b 4 years ago
parent
commit
70fb900574

+ 5 - 0
EQ2/source/WorldServer/ClientPacketFunctions.cpp

@@ -188,6 +188,8 @@ void ClientPacketFunctions::SendCharacterMacros(Client* client) {
 						sprintf(tmp_command, "command%i", x);
 						LogWrite(PACKET__DEBUG, 5, "Packet", "\tLoading Command %i: %s", itr->first, x, itr->second[i]->text.c_str());
 						macro_packet->setArrayDataByName(tmp_command, itr->second[i]->text.c_str(), i);
+						if ( i > 0 ) // itr->second[0] used below, we will delete it later
+							safe_delete(itr->second[i]); // delete MacroData*
 					}
 					macro_packet->setArrayDataByName("unknown2", 2, x);
 					macro_packet->setArrayDataByName("unknown3", 0xFFFFFFFF, x);
@@ -198,6 +200,9 @@ void ClientPacketFunctions::SendCharacterMacros(Client* client) {
 				}
 				macro_packet->setArrayDataByName("icon", itr->second[0]->icon, x);
 				client->GetPlayer()->macro_icons[itr->first] = itr->second[0]->icon;
+				
+				// remove itr->second[0] now that we are done with it
+				safe_delete(itr->second[0]); // delete MacroData*
 			}
 			EQ2Packet* packet = macro_packet->serialize();
 			client->QueuePacket(packet);

+ 13 - 1
EQ2/source/WorldServer/Items/Items.cpp

@@ -795,6 +795,7 @@ Item::~Item(){
 	safe_delete(book_info);
 	safe_delete(houseitem_info);
 	safe_delete(housecontainer_info);
+	DeleteItemSets();
 }
 void Item::SetItem(Item* old_item){
 	if(old_item->GetItemScript())
@@ -913,7 +914,7 @@ void Item::SetItem(Item* old_item){
 	}
 	creator = old_item->creator;
 	adornment = old_item->adornment;
-	item_sets.clear();
+	DeleteItemSets();
 	for (int32 i = 0; i<old_item->item_sets.size(); i++){
 		ItemSet* set = old_item->item_sets[i];
 		if (set){
@@ -1079,6 +1080,17 @@ bool Item::HasStat(uint32 statID)
 
 	return false;
 }
+
+void Item::DeleteItemSets()
+{
+	for (int32 i = 0; i < item_sets.size(); i++){
+		ItemSet* set = item_sets[i];
+		safe_delete(set);
+	}
+		
+	item_sets.clear();
+}
+
 void Item::AddSet(ItemSet* in_set){
 	item_sets.push_back(in_set);
 }

+ 1 - 0
EQ2/source/WorldServer/Items/Items.h

@@ -866,6 +866,7 @@ public:
 	void SetAppearance(ItemAppearance* appearance);
 	void AddStat(ItemStat* in_stat);
 	bool HasStat(uint32 statID);
+	void DeleteItemSets();
 	void AddSet(ItemSet* in_set);
 	void AddStatString(ItemStatString* in_stat);
 	void AddStat(int8 type, int16 subtype, float value, char* name = 0);

+ 10 - 4
EQ2/source/WorldServer/Zone/SPGrid.cpp

@@ -34,20 +34,26 @@ SPGrid::SPGrid(string file, int32 cellSize) {
 }
 
 SPGrid::~SPGrid() {
-	vector<Cell>::iterator CellItr;
+	vector<FaceCell>::iterator CellItr;
 	map<int32, vector<Face*> >::iterator MapItr;
 	vector<Face*>::iterator FaceItr;
 
+	map<Face*, bool> deadPtrs;
+	
 	// Loop through the vector of cells
-	/*for (CellItr = m_Cells.begin(); CellItr != m_Cells.end(); CellItr++) {
+	for (CellItr = m_FaceCells.begin(); CellItr != m_FaceCells.end(); CellItr++) {
 		// Loop through the map of vertices on this cell
 		for (MapItr = (*CellItr).FaceList.begin(); MapItr != (*CellItr).FaceList.end(); MapItr++) {
 			// Loop through the vector of faces in the map and delete the pointers
 			for (FaceItr = (*MapItr).second.begin(); FaceItr != (*MapItr).second.end(); FaceItr++) {
-				safe_delete((*FaceItr));
+				if(deadPtrs.count((*FaceItr)) == 0)
+				{
+					deadPtrs.insert(make_pair((*FaceItr), true));
+					safe_delete((*FaceItr));
+				}
 			}
 		}
-	}*/
+	}
 }
 
 bool SPGrid::Init() {

+ 12 - 0
EQ2/source/WorldServer/client.cpp

@@ -9318,6 +9318,18 @@ void Client::SendSpawnChanges(set<Spawn*>& spawns) {
 				}
 
 				MakeSpawnChangePacket(tmp_info_changes, tmp_pos_changes, tmp_vis_changes, tmp_info_size, tmp_pos_size, data.size);
+				
+				for (auto& kv : tmp_info_changes) {
+					safe_delete_array(kv.second.data);
+				}
+
+				for (auto& kv : tmp_pos_changes) {
+					safe_delete_array(kv.second.data);
+				}
+
+				for (auto& kv : tmp_vis_changes) {
+					safe_delete_array(kv.second.data);
+				}
 				continue;
 			}
 		}

+ 1 - 0
EQ2/source/common/PacketStruct.cpp

@@ -439,6 +439,7 @@ PacketStruct::PacketStruct(PacketStruct* packet, int16 in_client_version) {
 PacketStruct::PacketStruct() {
 	parent = 0;
 	opcode = OP_Unknown;
+	opcode_type = string("");
 }
 
 PacketStruct::PacketStruct(PacketStruct* packet, bool sub) {

BIN
server/EQ2Login__Debug64.exe


BIN
server/EQ2World__Debug_x64.exe