mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Hopefully fixed that pesky merc memleak and cleaned up mercs a tad.
This commit is contained in:
+26
-14
@@ -1476,7 +1476,6 @@ void Client::SendSound(){//Makes a sound.
|
||||
memset(&x[64],0xffffffff,sizeof(uint32));
|
||||
memcpy(outapp->pBuffer,x,outapp->size);
|
||||
QueuePacket(outapp);
|
||||
//DumpPacket(outapp);
|
||||
safe_delete(outapp);
|
||||
|
||||
}
|
||||
@@ -7149,13 +7148,17 @@ void Client::SendMercPersonalInfo()
|
||||
int stancecount = 0;
|
||||
stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size();
|
||||
|
||||
if (mercCount > 0)
|
||||
if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES)
|
||||
{
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, sizeof(MercenaryDataUpdate_Struct) + (mercTypeCount * sizeof(MercenaryData_Struct)) + stancecount * sizeof(MercenaryStance_Struct));
|
||||
SendMercMerchantResponsePacket(0);
|
||||
return;
|
||||
}
|
||||
if (mercCount > 0 && mercCount)
|
||||
{
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, sizeof(MercenaryDataUpdate_Struct));
|
||||
MercenaryDataUpdate_Struct* mdus = (MercenaryDataUpdate_Struct*)outapp->pBuffer;
|
||||
mdus->MercStatus = 0;
|
||||
mdus->MercCount = mercCount;
|
||||
mdus->MercData = new MercenaryData_Struct[mercCount];
|
||||
mdus->MercData[i].MercID = mercData->MercTemplateID;
|
||||
mdus->MercData[i].MercType = mercData->MercType;
|
||||
mdus->MercData[i].MercSubType = mercData->MercSubType;
|
||||
@@ -7176,7 +7179,6 @@ void Client::SendMercPersonalInfo()
|
||||
uint32 stanceindex = 0;
|
||||
if (mdus->MercData[i].StanceCount != 0)
|
||||
{
|
||||
mdus->MercData[i].Stances = new MercenaryStance_Struct[mdus->MercData[i].StanceCount];
|
||||
list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
|
||||
while(iter != zone->merc_stance_list[mercData->MercTemplateID].end())
|
||||
{
|
||||
@@ -7188,7 +7190,6 @@ void Client::SendMercPersonalInfo()
|
||||
}
|
||||
|
||||
mdus->MercData[i].MercUnk05 = 1;
|
||||
//DumpPacket(outapp);
|
||||
FastQueuePacket(&outapp);
|
||||
return;
|
||||
}
|
||||
@@ -7199,7 +7200,16 @@ void Client::SendMercPersonalInfo()
|
||||
int stancecount = 0;
|
||||
stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size();
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct) + (mercTypeCount * sizeof(MercenaryGrade_Struct)) + (mercCount * sizeof(MercenaryListEntry_Struct)) + stancecount * sizeof(MercenaryStance_Struct)); //Packet sizes are handled by the encoder.
|
||||
if(mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES)
|
||||
{
|
||||
if (GetClientVersion() == EQClientSoD)
|
||||
{
|
||||
SendMercMerchantResponsePacket(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct));
|
||||
MercenaryMerchantList_Struct* mml = (MercenaryMerchantList_Struct*)outapp->pBuffer;
|
||||
MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID];
|
||||
|
||||
@@ -7209,13 +7219,12 @@ void Client::SendMercPersonalInfo()
|
||||
if(mercTypeCount > 0)
|
||||
{
|
||||
mml->MercTypeCount = mercTypeCount; //We only should have one merc entry.
|
||||
mml->MercGrades = new MercenaryGrade_Struct[mercTypeCount]; // DBStringID for Type
|
||||
mml->MercGrades[0].GradeCountEntry = 1;
|
||||
mml->MercGrades[i] = 1;
|
||||
}
|
||||
mml->MercCount = mercCount;
|
||||
if(mercCount > 0)
|
||||
{
|
||||
mml->Mercs = new MercenaryListEntry_Struct[mercCount];
|
||||
|
||||
mml->Mercs[i].MercID = mercData->MercTemplateID;
|
||||
mml->Mercs[i].MercType = mercData->MercType;
|
||||
mml->Mercs[i].MercSubType = mercData->MercSubType;
|
||||
@@ -7236,7 +7245,6 @@ void Client::SendMercPersonalInfo()
|
||||
int stanceindex = 0;
|
||||
if(mml->Mercs[i].StanceCount != 0)
|
||||
{
|
||||
mml->Mercs[i].Stances = new MercenaryStance_Struct[mml->Mercs[i].StanceCount];
|
||||
list<MercStanceInfo>::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin();
|
||||
while(iter != zone->merc_stance_list[mercData->MercTemplateID].end())
|
||||
{
|
||||
@@ -7251,7 +7259,10 @@ void Client::SendMercPersonalInfo()
|
||||
else
|
||||
{
|
||||
safe_delete(outapp);
|
||||
SendMercMerchantResponsePacket(0);
|
||||
if (GetClientVersion() == EQClientSoD)
|
||||
{
|
||||
SendMercMerchantResponsePacket(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (GetClientVersion() == EQClientSoD)
|
||||
@@ -7262,7 +7273,10 @@ void Client::SendMercPersonalInfo()
|
||||
else
|
||||
{
|
||||
safe_delete(outapp);
|
||||
if (GetClientVersion() == EQClientSoD)
|
||||
{
|
||||
SendMercMerchantResponsePacket(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -7275,8 +7289,6 @@ void Client::SendClearMercInfo()
|
||||
nmhs->MercStatus = -1;
|
||||
nmhs->MercCount = 0;
|
||||
nmhs->MercID = 1;
|
||||
|
||||
//DumpPacket(outapp);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
|
||||
@@ -13515,6 +13515,9 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
|
||||
mercTypeCount = tar->GetNumMercTypes(GetClientVersion());
|
||||
mercCount = tar->GetNumMercs(GetClientVersion());
|
||||
|
||||
if(mercCount > MAX_MERC)
|
||||
return;
|
||||
|
||||
std::list<MercType> mercTypeList = tar->GetMercTypesList(GetClientVersion());
|
||||
std::list<MercData> mercDataList = tar->GetMercsList(GetClientVersion());
|
||||
|
||||
@@ -13530,15 +13533,14 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
|
||||
}
|
||||
}
|
||||
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct) + (mercTypeCount * sizeof(MercenaryGrade_Struct)) + (mercCount * sizeof(MercenaryListEntry_Struct)) + (StanceCount * sizeof(MercenaryStance_Struct)));
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct));
|
||||
MercenaryMerchantList_Struct* mml = (MercenaryMerchantList_Struct*)outapp->pBuffer;
|
||||
|
||||
mml->MercTypeCount = mercTypeCount;
|
||||
if(mercTypeCount > 0)
|
||||
{
|
||||
mml->MercGrades = new MercenaryGrade_Struct[mercTypeCount];
|
||||
for(std::list<MercType>::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); mercTypeListItr++) {
|
||||
mml->MercGrades[i].GradeCountEntry = mercTypeListItr->Type; // DBStringID for Type
|
||||
mml->MercGrades[i] = mercTypeListItr->Type; // DBStringID for Type
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -13547,7 +13549,6 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
|
||||
if(mercCount > 0)
|
||||
{
|
||||
i = 0;
|
||||
mml->Mercs = new MercenaryListEntry_Struct[mercCount];
|
||||
for(std::list<MercData>::iterator mercListIter = mercDataList.begin(); mercListIter != mercDataList.end(); mercListIter++)
|
||||
{
|
||||
mml->Mercs[i].MercID = mercListIter->MercTemplateID;
|
||||
@@ -13576,7 +13577,6 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
|
||||
int stanceindex = 0;
|
||||
if(mercStanceCount > 0)
|
||||
{
|
||||
mml->Mercs[i].Stances = new MercenaryStance_Struct[mercStanceCount];
|
||||
list<MercStanceInfo>::iterator iter2 = zone->merc_stance_list[mercListIter->MercTemplateID].begin();
|
||||
while(iter2 != zone->merc_stance_list[mercListIter->MercTemplateID].end())
|
||||
{
|
||||
|
||||
@@ -5886,24 +5886,18 @@ void Client::SendMercMerchantResponsePacket(int32 response_type) {
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryHire, sizeof(MercenaryMerchantResponse_Struct));
|
||||
MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer;
|
||||
mmr->ResponseType = response_type; // send specified response type
|
||||
|
||||
DumpPacket(outapp);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
void Client::SendMercenaryUnknownPacket(uint8 type) {
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1);
|
||||
outapp->WriteUInt8(type);
|
||||
|
||||
DumpPacket(outapp);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
void Client::SendMercenaryUnsuspendPacket(uint8 type) {
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1);
|
||||
outapp->WriteUInt8(type);
|
||||
|
||||
DumpPacket(outapp);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
@@ -5911,8 +5905,6 @@ void Client::SendMercSuspendResponsePacket(uint32 suspended_time) {
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenarySuspendResponse, sizeof(SuspendMercenaryResponse_Struct));
|
||||
SuspendMercenaryResponse_Struct* smr = (SuspendMercenaryResponse_Struct*)outapp->pBuffer;
|
||||
smr->SuspendTime = suspended_time; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp
|
||||
|
||||
DumpPacket(outapp);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
@@ -5930,8 +5922,6 @@ void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspen
|
||||
mss->MercUnk01 = unk01; // Seen 180000 - 3 minutes in ms - Used for the unsuspend button refresh timer
|
||||
mss->MercState = merc_state; // Seen 5 (normal) or 1 (suspended)
|
||||
mss->SuspendedTime = suspended_time; // Seen 0 for not suspended or Unix Timestamp for suspended merc
|
||||
|
||||
DumpPacket(outapp);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +392,6 @@ void WorldServer::Process() {
|
||||
_log(ZONE__WORLD, "Error: WhoAllReturnStruct did not point to a valid client! "
|
||||
"id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:",
|
||||
wars->id, wars->playerineqstring, wars->playersinzonestring);
|
||||
//DumpPacket(pack);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -495,7 +494,7 @@ void WorldServer::Process() {
|
||||
if (!(Zone::Bootup(zst->zoneid, zst->instanceid, zst->makestatic))) {
|
||||
SendChannelMessage(0, 0, 10, 0, 0, "%s:%i Zone::Bootup failed: %s", net.GetZoneAddress(), net.GetZonePort(), database.GetZoneName(zst->zoneid));
|
||||
}
|
||||
// Moved annoucement to ZoneBootup() - Quagmire
|
||||
// Moved annoucement to ZoneBootup()
|
||||
// else
|
||||
// SendEmoteMessage(0, 0, 15, "Zone bootup: %s", zone->GetLongName());
|
||||
break;
|
||||
@@ -1822,7 +1821,6 @@ void WorldServer::Process() {
|
||||
default: {
|
||||
cout << " Unknown ZSopcode:" << (int)pack->opcode;
|
||||
cout << " size:" << pack->size << endl;
|
||||
//DumpPacket(pack->pBuffer, pack->size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user