mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Fixed a couple of merc memory leaks and removed some commented out DumpPacket calls.
This commit is contained in:
parent
8eef122cec
commit
981cabe857
@ -3540,13 +3540,11 @@ void Client::Handle_OP_WearChange(const EQApplicationPacket *app)
|
||||
{
|
||||
if (app->size != sizeof(WearChange_Struct)) {
|
||||
cout << "Wrong size: OP_WearChange, size=" << app->size << ", expected " << sizeof(WearChange_Struct) << endl;
|
||||
//DumpPacket(app);
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
WearChange_Struct* wc=(WearChange_Struct*)app->pBuffer;
|
||||
//printf("Wearchange:\n");
|
||||
//DumpPacket(app);
|
||||
if(wc->spawn_id != GetID())
|
||||
return;
|
||||
|
||||
@ -3597,7 +3595,7 @@ void Client::Handle_OP_WhoAllRequest(const EQApplicationPacket *app)
|
||||
{
|
||||
if (app->size != sizeof(Who_All_Struct)) {
|
||||
cout << "Wrong size on OP_WhoAll. Got: " << app->size << ", Expected: " << sizeof(Who_All_Struct) << endl;
|
||||
//DumpPacket(app);
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
Who_All_Struct* whoall = (Who_All_Struct*) app->pBuffer;
|
||||
@ -3696,7 +3694,6 @@ void Client::Handle_OP_EndLootRequest(const EQApplicationPacket *app)
|
||||
|
||||
Entity* entity = entity_list.GetID(*((uint16*)app->pBuffer));
|
||||
if (entity == 0) {
|
||||
//DumpPacket(app);
|
||||
Message(13, "Error: OP_EndLootRequest: Corpse not found (ent = 0)");
|
||||
if(GetClientVersion() >= EQClientSoD)
|
||||
Corpse::SendEndLootErrorPacket(this);
|
||||
@ -7388,27 +7385,6 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app)
|
||||
memcpy(out->message, name, len_name);
|
||||
memcpy(&out->message[len_name], in->message, len_msg);
|
||||
|
||||
//cout << "######### Outgoing emote packet" << endl;
|
||||
//DumpPacket(outapp);
|
||||
|
||||
/*
|
||||
if (target && target->IsClient()) {
|
||||
entity_list.QueueCloseClients(this, outapp, false, 100, target);
|
||||
|
||||
cptr = outapp->pBuffer + 2;
|
||||
|
||||
// not sure if live does this or not. thought it was a nice feature, but would take a lot to
|
||||
// clean up grammatical and other errors. Maybe with a regex parser...
|
||||
replacestr((char *)cptr, target->GetName(), "you");
|
||||
replacestr((char *)cptr, " he", " you");
|
||||
replacestr((char *)cptr, " she", " you");
|
||||
replacestr((char *)cptr, " him", " you");
|
||||
replacestr((char *)cptr, " her", " you");
|
||||
target->CastToClient()->QueuePacket(outapp);
|
||||
|
||||
}
|
||||
else
|
||||
*/
|
||||
entity_list.QueueCloseClients(this, outapp, true, 100,0,true,FilterSocials);
|
||||
|
||||
safe_delete(outapp);
|
||||
@ -7429,7 +7405,6 @@ void Client::Handle_OP_Animation(const EQApplicationPacket *app)
|
||||
|
||||
//might verify spawn ID, but it wouldent affect anything
|
||||
|
||||
// an emote (i.e., waving arm to say hello)
|
||||
DoAnim(s->action, s->value);
|
||||
|
||||
return;
|
||||
@ -7853,7 +7828,6 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app)
|
||||
if(Buyer) {
|
||||
Trader_EndTrader();
|
||||
Message(13, "You cannot be a Trader and Buyer at the same time.");
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -7892,7 +7866,6 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app)
|
||||
|
||||
if(!TradeItemsValid) {
|
||||
Trader_EndTrader();
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -7948,7 +7921,6 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -8127,8 +8099,6 @@ void Client::Handle_OP_ClientError(const EQApplicationPacket *app)
|
||||
ClientError_Struct* error = (ClientError_Struct*)app->pBuffer;
|
||||
LogFile->write(EQEMuLog::Error, "Client error: %s", error->character_name);
|
||||
LogFile->write(EQEMuLog::Error, "Error message:%s", error->message);
|
||||
//if (EQDEBUG>=5)
|
||||
// DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -13611,8 +13581,6 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app)
|
||||
uint32 merc_unk1 = mmrq->MercUnk01;
|
||||
uint32 merc_unk2 = mmrq->MercUnk02;
|
||||
|
||||
//DumpPacket(app);
|
||||
|
||||
if(MERC_DEBUG > 0)
|
||||
Message(7, "Mercenary Debug: Template ID (%i), Merchant ID (%i), Unknown1 (%i), Unknown2 (%i)", merc_template_id, merchant_id, merc_unk1, merc_unk2);
|
||||
|
||||
@ -13674,8 +13642,6 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app)
|
||||
SuspendMercenary_Struct* sm = (SuspendMercenary_Struct*) app->pBuffer;
|
||||
uint32 merc_suspend = sm->SuspendMerc; // Seen 30 for suspending or unsuspending
|
||||
|
||||
//DumpPacket(app);
|
||||
|
||||
if(MERC_DEBUG > 0)
|
||||
Message(7, "Mercenary Debug: Suspend ( %i ) received.", merc_suspend);
|
||||
|
||||
@ -13700,8 +13666,6 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app)
|
||||
uint32 merc_command = mc->MercCommand; // Seen 0 (zone in with no merc or suspended), 1 (dismiss merc), 5 (normal state), 20 (unknown), 36 (zone in with merc)
|
||||
int32 option = mc->Option; // Seen -1 (zone in with no merc), 0 (setting to passive stance), 1 (normal or setting to balanced stance)
|
||||
|
||||
//DumpPacket(app);
|
||||
|
||||
if(MERC_DEBUG > 0)
|
||||
Message(7, "Mercenary Debug: Command %i, Option %i received.", merc_command, option);
|
||||
|
||||
@ -13754,8 +13718,6 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app
|
||||
return;
|
||||
}
|
||||
|
||||
//DumpPacket(app);
|
||||
|
||||
if(MERC_DEBUG > 0)
|
||||
Message(7, "Mercenary Debug: Data Update Request Received.");
|
||||
|
||||
@ -13776,8 +13738,6 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
//DumpPacket(app);
|
||||
|
||||
uint8 Command = 0;
|
||||
if(app->size > 0)
|
||||
{
|
||||
@ -13811,8 +13771,6 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
//DumpPacket(app);
|
||||
|
||||
if(MERC_DEBUG > 0)
|
||||
Message(7, "Mercenary Debug: Timer Request received.");
|
||||
|
||||
|
||||
@ -930,7 +930,6 @@ void Client::BulkSendInventoryItems() {
|
||||
ptr += length;
|
||||
}
|
||||
}
|
||||
//DumpPacket(outapp);
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
@ -1309,8 +1308,6 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
|
||||
int32 *from_bucket = 0, *to_bucket = 0;
|
||||
Mob* trader = trade->With();
|
||||
|
||||
//DumpPacket(app);
|
||||
|
||||
// could just do a range, but this is clearer and explicit
|
||||
if
|
||||
(
|
||||
|
||||
@ -148,7 +148,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger)
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
||||
MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer;
|
||||
//DumpPacket(app);
|
||||
|
||||
md->doorid = door_id;
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//used_pawn: Locked doors! Rogue friendly too =)
|
||||
|
||||
@ -1980,7 +1980,6 @@ void Client::SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType
|
||||
#if EQDEBUG >= 9
|
||||
DumpPacket(outapp);
|
||||
#endif
|
||||
//DumpPacket(outapp);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
|
||||
@ -840,7 +840,6 @@ void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) {
|
||||
_log(TASKS__UPDATE, "New enabled task list ");
|
||||
for(unsigned int i=0; i<EnabledTasks.size(); i++)
|
||||
_log(TASKS__UPDATE, "%i ", EnabledTasks[i]);
|
||||
fflush(stdout);
|
||||
|
||||
if(TasksEnabled.size() == 0 ) return;
|
||||
|
||||
@ -901,7 +900,6 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) {
|
||||
_log(TASKS__UPDATE, "New enabled task list ");
|
||||
for(unsigned int i=0; i<EnabledTasks.size(); i++)
|
||||
_log(TASKS__UPDATE, "%i ", EnabledTasks[i]);
|
||||
fflush(stdout);
|
||||
|
||||
if(TasksDisabled.size() == 0) return;
|
||||
|
||||
@ -2561,7 +2559,7 @@ void Client::SendTaskFailed(int TaskID, int TaskIndex) {
|
||||
tac->unknown5 = 0; // 0 for task complete or failed.
|
||||
|
||||
_log(TASKS__UPDATE, "TaskFailed");
|
||||
//DumpPacket(outapp); fflush(stdout);
|
||||
|
||||
_pkt(TASKS__PACKETS, outapp);
|
||||
|
||||
QueuePacket(outapp);
|
||||
|
||||
@ -517,7 +517,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
|
||||
outp->reply_code = 0x00000000; //success for finding it...
|
||||
|
||||
user->QueuePacket(outapp);
|
||||
//DumpPacket(outapp);
|
||||
|
||||
safe_delete(outapp);
|
||||
|
||||
|
||||
@ -665,7 +665,6 @@ void Client::TradeskillSearchResults(const char *query, unsigned long qlen,
|
||||
reply->trivial = trivial;
|
||||
strn0cpy(reply->recipe_name, name, sizeof(reply->recipe_name));
|
||||
|
||||
//DumpPacket(outapp);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
@ -1520,4 +1519,4 @@ bool Client::CanIncreaseTradeskill(SkillType tradeskill) {
|
||||
break; //Other skills unchecked and ability to increase assumed true
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1748,7 +1748,7 @@ bool ZoneDatabase::SaveMerc(Merc *merc) {
|
||||
}
|
||||
}
|
||||
|
||||
safe_delete(Query);
|
||||
safe_delete_array(Query);
|
||||
|
||||
if(!errorMessage.empty() || (Result && affectedRows != 1)) {
|
||||
if(owner && !errorMessage.empty())
|
||||
@ -1917,12 +1917,16 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) {
|
||||
else
|
||||
TempCounter++;
|
||||
|
||||
safe_delete_array(Query);
|
||||
|
||||
if(!database.RunQuery(Query, MakeAnyLenString(&Query, "DELETE FROM mercs WHERE MercID = '%u'", merc_id), TempErrorMessageBuffer)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
else
|
||||
TempCounter++;
|
||||
|
||||
safe_delete_array(Query);
|
||||
|
||||
if(TempCounter == 2)
|
||||
Result = true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user