diff --git a/common/database.cpp b/common/database.cpp index 95895dc5f..fc26cc636 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1474,8 +1474,9 @@ void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { QueryDatabase(query); } -void Database::AddReport(std::string who, std::string against, std::string lines) { - char *escape_str = new char[lines.size()*2+1]; +void Database::AddReport(std::string who, std::string against, std::string lines) +{ + auto escape_str = new char[lines.size() * 2 + 1]; DoEscapeString(escape_str, lines.c_str(), lines.size()); std::string query = StringFormat("INSERT INTO reports (name, reported, reported_text) VALUES('%s', '%s', '%s')", EscapeString(who).c_str(), EscapeString(against).c_str(), escape_str); diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 76e87cde1..0fcaa7678 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -98,14 +98,14 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo pStatus = Error; - char *errorBuffer = new char[MYSQL_ERRMSG_SIZE]; + auto errorBuffer = new char[MYSQL_ERRMSG_SIZE]; snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer); } - char *errorBuffer = new char[MYSQL_ERRMSG_SIZE]; + auto errorBuffer = new char[MYSQL_ERRMSG_SIZE]; snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); /* Implement Logging at the Root */ diff --git a/common/emu_tcp_connection.cpp b/common/emu_tcp_connection.cpp index da34f1ee7..0a0444c69 100644 --- a/common/emu_tcp_connection.cpp +++ b/common/emu_tcp_connection.cpp @@ -456,21 +456,21 @@ void EmuTCPConnection::SendNetErrorPacket(const char* reason) { std::cout << reason; std::cout << "': " << inet_ntoa(in) << ":" << GetPort() << std::endl; #endif - ServerPacket* pack = new ServerPacket(0); - pack->size = 1; - if (reason) - pack->size += strlen(reason) + 1; - pack->pBuffer = new uchar[pack->size]; - memset(pack->pBuffer, 0, pack->size); - pack->pBuffer[0] = 255; - strcpy((char*) &pack->pBuffer[1], reason); - SendPacket(pack); - safe_delete(pack); + auto pack = new ServerPacket(0); + pack->size = 1; + if (reason) + pack->size += strlen(reason) + 1; + pack->pBuffer = new uchar[pack->size]; + memset(pack->pBuffer, 0, pack->size); + pack->pBuffer[0] = 255; + strcpy((char *)&pack->pBuffer[1], reason); + SendPacket(pack); + safe_delete(pack); } void EmuTCPConnection::RemoveRelay(EmuTCPConnection* relay, bool iSendRelayDisconnect) { if (iSendRelayDisconnect) { - ServerPacket* pack = new ServerPacket(0, 5); + auto pack = new ServerPacket(0, 5); pack->pBuffer[0] = 3; *((uint32*) &pack->pBuffer[1]) = relay->GetRemoteID(); SendPacket(pack); @@ -609,7 +609,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) { if (base >= recvbuf_used) { safe_delete_array(recvbuf); } else { - uchar* tmpbuf = new uchar[recvbuf_size - base]; + auto tmpbuf = new uchar[recvbuf_size - base]; memcpy(tmpbuf, &recvbuf[base], recvbuf_used - base); safe_delete_array(recvbuf); recvbuf = tmpbuf; @@ -683,7 +683,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsOldPackets(char* errbuf) { safe_delete_array(recvbuf); } else { - uchar* tmpbuf = new uchar[recvbuf_size - base]; + auto tmpbuf = new uchar[recvbuf_size - base]; memcpy(tmpbuf, &recvbuf[base], recvbuf_used - base); safe_delete_array(recvbuf); recvbuf = tmpbuf; @@ -739,7 +739,8 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) { SendNetErrorPacket("New RelayClient: illegal on outgoing connection"); break; } - EmuTCPConnection* con = new EmuTCPConnection(Server->GetNextID(), Server, this, *((uint32*) data), *((uint32*) &data[4]), *((uint16*) &data[8])); + auto con = new EmuTCPConnection(Server->GetNextID(), Server, this, *((uint32 *)data), + *((uint32 *)&data[4]), *((uint16 *)&data[8])); Server->AddConnection(con); RelayCount++; break; @@ -787,7 +788,7 @@ bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) { if(sent_something) keepalive_timer.Start(); else if (TCPMode == modePacket && keepalive_timer.Check()) { - ServerPacket* pack = new ServerPacket(0, 0); + auto pack = new ServerPacket(0, 0); SendPacket(pack); safe_delete(pack); #if TCPN_DEBUG >= 5 diff --git a/common/emu_tcp_server.cpp b/common/emu_tcp_server.cpp index 4509c399f..00a241859 100644 --- a/common/emu_tcp_server.cpp +++ b/common/emu_tcp_server.cpp @@ -24,7 +24,7 @@ void EmuTCPServer::Process() { void EmuTCPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort) { - EmuTCPConnection *conn = new EmuTCPConnection(ID, this, in_socket, irIP, irPort, pOldFormat); + auto conn = new EmuTCPConnection(ID, this, in_socket, irIP, irPort, pOldFormat); AddConnection(conn); } diff --git a/common/eq_packet.cpp b/common/eq_packet.cpp index e01f6a3f8..d7e607d77 100644 --- a/common/eq_packet.cpp +++ b/common/eq_packet.cpp @@ -260,7 +260,7 @@ bool EQProtocolPacket::combine(const EQProtocolPacket *rhs) { bool result=false; if (opcode==OP_Combined && size+rhs->size+5<256) { - unsigned char *tmpbuffer=new unsigned char [size+rhs->size+3]; + auto tmpbuffer = new unsigned char[size + rhs->size + 3]; memcpy(tmpbuffer,pBuffer,size); uint32 offset=size; tmpbuffer[offset++]=rhs->Size(); @@ -270,7 +270,7 @@ bool result=false; pBuffer=tmpbuffer; result=true; } else if (size+rhs->size+7<256) { - unsigned char *tmpbuffer=new unsigned char [size+rhs->size+6]; + auto tmpbuffer = new unsigned char[size + rhs->size + 6]; uint32 offset=0; tmpbuffer[offset++]=Size(); offset+=serialize(tmpbuffer+offset); @@ -457,7 +457,7 @@ EQApplicationPacket *EQApplicationPacket::Copy() const { } EQRawApplicationPacket *EQProtocolPacket::MakeAppPacket() const { - EQRawApplicationPacket *res = new EQRawApplicationPacket(opcode, pBuffer, size); + auto res = new EQRawApplicationPacket(opcode, pBuffer, size); res->copyInfo(this); return(res); } diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 00f5b1b9a..5a272e201 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -561,12 +561,12 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2) Log.Out(Logs::Detail, Logs::Netcode, _L "Making oversized packet, len %d" __L, p->Size()); - unsigned char *tmpbuff=new unsigned char[p->size+3]; + auto tmpbuff = new unsigned char[p->size + 3]; length=p->serialize(opcode, tmpbuff); if (length != p->Size()) Log.Out(Logs::Detail, Logs::Netcode, _L "Packet adjustment, len %d to %d" __L, p->Size(), length); - EQProtocolPacket *out=new EQProtocolPacket(OP_Fragment,nullptr,MaxLen-4); + auto out = new EQProtocolPacket(OP_Fragment, nullptr, MaxLen - 4); *(uint32 *)(out->pBuffer+2)=htonl(length); used=MaxLen-10; memcpy(out->pBuffer+6,tmpbuff,used); @@ -587,10 +587,10 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) delete[] tmpbuff; } else { - unsigned char *tmpbuff=new unsigned char[p->Size()+3]; + auto tmpbuff = new unsigned char[p->Size() + 3]; length=p->serialize(opcode, tmpbuff+2) + 2; - EQProtocolPacket *out=new EQProtocolPacket(OP_Packet,tmpbuff,length); + auto out = new EQProtocolPacket(OP_Packet, tmpbuff, length); delete[] tmpbuff; SequencedPush(out); @@ -882,7 +882,7 @@ sockaddr_in address; void EQStream::SendSessionResponse() { -EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(SessionResponse)); + auto out = new EQProtocolPacket(OP_SessionResponse, nullptr, sizeof(SessionResponse)); SessionResponse *Response=(SessionResponse *)out->pBuffer; Response->Session=htonl(Session); Response->MaxLength=htonl(MaxLen); @@ -904,7 +904,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses void EQStream::SendSessionRequest() { -EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(SessionRequest)); + auto out = new EQProtocolPacket(OP_SessionRequest, nullptr, sizeof(SessionRequest)); SessionRequest *Request=(SessionRequest *)out->pBuffer; memset(Request,0,sizeof(SessionRequest)); Request->Session=htonl(time(nullptr)); @@ -920,7 +920,7 @@ void EQStream::_SendDisconnect() if(GetState() == CLOSED) return; - EQProtocolPacket *out=new EQProtocolPacket(OP_SessionDisconnect,nullptr,sizeof(uint32)); + auto out = new EQProtocolPacket(OP_SessionDisconnect, nullptr, sizeof(uint32)); *(uint32 *)out->pBuffer=htonl(Session); NonSequencedPush(out); @@ -940,7 +940,7 @@ EQRawApplicationPacket *p=nullptr; MInboundQueue.lock(); if (!InboundQueue.empty()) { - std::vector::iterator itr=InboundQueue.begin(); + auto itr = InboundQueue.begin(); p=*itr; InboundQueue.erase(itr); } @@ -965,7 +965,7 @@ EQRawApplicationPacket *p=nullptr; MInboundQueue.lock(); if (!InboundQueue.empty()) { - std::vector::iterator itr=InboundQueue.begin(); + auto itr = InboundQueue.begin(); p=*itr; InboundQueue.erase(itr); } @@ -992,7 +992,7 @@ EQRawApplicationPacket *p=nullptr; MInboundQueue.lock(); if (!InboundQueue.empty()) { - std::vector::iterator itr=InboundQueue.begin(); + auto itr = InboundQueue.begin(); p=*itr; } MInboundQueue.unlock(); diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 6be3017f0..d58995623 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -235,7 +235,7 @@ void EQStreamFactory::CheckTimeout() //give it a little time for everybody to finish with it } else { //everybody is done, we can delete it now - std::map, std::shared_ptr>::iterator temp = stream_itr; + auto temp = stream_itr; ++stream_itr; temp->second = nullptr; Streams.erase(temp); diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index 4640c75f1..89df25ab2 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -25,7 +25,7 @@ EQStreamIdentifier::~EQStreamIdentifier() { } void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) { - Patch *p = new Patch; + auto p = new Patch; p->signature = sig; p->name = name; p->opcodes = opcodes; diff --git a/common/eqdb.cpp b/common/eqdb.cpp index 2c912afba..a94be7768 100644 --- a/common/eqdb.cpp +++ b/common/eqdb.cpp @@ -63,7 +63,7 @@ EQDBRes * EQDB::query(Const_char *q) { //NOT THREAD SAFE! Const_char *EQDB::escape_string(Const_char *from) { int len = strlen(from); - char *res = new char[len*2+1]; + auto res = new char[len * 2 + 1]; mysql_real_escape_string(mysql_ref,res,from,len); diff --git a/common/eqemu_config.cpp b/common/eqemu_config.cpp index 977593291..900b83787 100644 --- a/common/eqemu_config.cpp +++ b/common/eqemu_config.cpp @@ -80,7 +80,7 @@ void EQEmuConfig::do_world(TiXmlElement *ele) sprintf(str, "loginserver%i", ++LoginCount); sub_ele = ele->FirstChildElement(str); if (sub_ele) { - LoginConfig* loginconfig = new LoginConfig; + auto loginconfig = new LoginConfig; text = ParseTextBlock(sub_ele, "host", true); if (text) { loginconfig->LoginHost = text; diff --git a/common/guild_base.cpp b/common/guild_base.cpp index aa4f7c509..ed4b508bc 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -179,7 +179,7 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con } //make the new entry and store it into the map. - GuildInfo *info = new GuildInfo; + auto info = new GuildInfo; info->name = guild_name; info->leader_char_id = leader_char_id; info->minstatus = minstatus; @@ -236,9 +236,9 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { results = m_db->QueryDatabase(query); //escape our strings. - char *name_esc = new char[info->name.length()*2+1]; - char *motd_esc = new char[info->motd.length()*2+1]; - char *motd_set_esc = new char[info->motd_setter.length()*2+1]; + auto name_esc = new char[info->name.length() * 2 + 1]; + auto motd_esc = new char[info->motd.length() * 2 + 1]; + auto motd_set_esc = new char[info->motd_setter.length() * 2 + 1]; m_db->DoEscapeString(name_esc, info->name.c_str(), info->name.length()); m_db->DoEscapeString(motd_esc, info->motd.c_str(), info->motd.length()); m_db->DoEscapeString(motd_set_esc, info->motd_setter.c_str(), info->motd_setter.length()); @@ -264,7 +264,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { for(rank = 0; rank <= GUILD_MAX_RANK; rank++) { const RankInfo &rankInfo = info->ranks[rank]; - char *title_esc = new char[rankInfo.name.length()*2+1]; + auto title_esc = new char[rankInfo.name.length() * 2 + 1]; m_db->DoEscapeString(title_esc, rankInfo.name.c_str(), rankInfo.name.length()); query = StringFormat("INSERT INTO guild_ranks " @@ -564,7 +564,7 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { //escape our strings. uint32 len = strlen(name); - char *esc = new char[len*2+1]; + auto esc = new char[len * 2 + 1]; m_db->DoEscapeString(esc, name, len); //insert the new `guilds` entry @@ -636,8 +636,8 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c //escape our strings. uint32 len = strlen(motd); uint32 len2 = strlen(setter); - char *esc = new char[len*2+1]; - char *esc_set = new char[len2*2+1]; + auto esc = new char[len * 2 + 1]; + auto esc_set = new char[len2 * 2 + 1]; m_db->DoEscapeString(esc, motd, len); m_db->DoEscapeString(esc_set, setter, len2); @@ -675,7 +675,7 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) //escape our strings. uint32 len = strlen(URL); - char *esc = new char[len*2+1]; + auto esc = new char[len * 2 + 1]; m_db->DoEscapeString(esc, URL, len); std::string query = StringFormat("UPDATE guilds SET url='%s' WHERE id=%d", esc, GuildID); @@ -709,7 +709,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) //escape our strings. uint32 len = strlen(Channel); - char *esc = new char[len*2+1]; + auto esc = new char[len * 2 + 1]; m_db->DoEscapeString(esc, Channel, len); std::string query = StringFormat("UPDATE guilds SET channel='%s' WHERE id=%d", esc, GuildID); @@ -832,7 +832,7 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { //escape our strings. uint32 len = strlen(note); - char *esc = new char[len*2+1]; + auto esc = new char[len * 2 + 1]; m_db->DoEscapeString(esc, note, len); //insert the new `guilds` entry @@ -918,8 +918,8 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorDoEscapeString(esc, char_name, nl); //load up the rank info for each guild. @@ -994,7 +994,7 @@ uint8 *BaseGuildManager::MakeGuildList(const char *head_name, uint32 &length) co //dynamic structs will make this a lot less painful. length = sizeof(GuildsList_Struct); - uint8 *buffer = new uint8[length]; + auto buffer = new uint8[length]; //a bit little better than memsetting the whole thing... uint32 r,pos; diff --git a/common/item.cpp b/common/item.cpp index c00f137db..054bbda42 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -2119,7 +2119,7 @@ const EQEmu::Item_Struct* ItemInst::GetUnscaledItem() const std::string ItemInst::GetCustomDataString() const { std::string ret_val; - std::map::const_iterator iter = m_custom_data.begin(); + auto iter = m_custom_data.begin(); while (iter != m_custom_data.end()) { if (ret_val.length() > 0) { ret_val += "^"; @@ -2172,7 +2172,7 @@ void ItemInst::SetCustomData(std::string identifier, bool value) { } void ItemInst::DeleteCustomData(std::string identifier) { - std::map::iterator iter = m_custom_data.find(identifier); + auto iter = m_custom_data.find(identifier); if (iter != m_custom_data.end()) { m_custom_data.erase(iter); } diff --git a/common/packet_dump.cpp b/common/packet_dump.cpp index 4ab1fcbef..1e28c2616 100644 --- a/common/packet_dump.cpp +++ b/common/packet_dump.cpp @@ -54,7 +54,7 @@ void DumpPacketHex(const uchar* buf, uint32 size, uint32 cols, uint32 skip) { // Output as HEX char output[4]; int j = 0; - char* ascii = new char[cols+1]; + auto ascii = new char[cols + 1]; memset(ascii, 0, cols+1); uint32 i; for(i=skip; icount); + auto outapp = new EQApplicationPacket( + OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); structs::AltCurrencyPopulate_Struct *out_populate = (structs::AltCurrencyPopulate_Struct*)outapp->pBuffer; out_populate->opcode = populate->opcode; @@ -221,7 +222,7 @@ namespace RoF dest->FastQueuePacket(&outapp, ack_req); } else { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); memcpy(outapp->pBuffer, emu_buffer, sizeof(AltCurrencyUpdate_Struct)); dest->FastQueuePacket(&outapp, ack_req); } @@ -1046,7 +1047,8 @@ namespace RoF { //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); @@ -1064,7 +1066,8 @@ namespace RoF //if(gjs->action == groupActLeave) // Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); @@ -1101,7 +1104,7 @@ namespace RoF //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); + auto outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; @@ -1167,7 +1170,8 @@ namespace RoF memcpy(eq->membername, emu->membername, sizeof(eq->membername)); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); GroupLeadershipAAUpdate_Struct *GLAAus = (GroupLeadershipAAUpdate_Struct*)outapp->pBuffer; GLAAus->NPCMarkerID = emu->NPCMarkerID; @@ -1637,7 +1641,7 @@ namespace RoF PacketSize += sizeof(structs::MercenaryStance_Struct) * emu->Mercs[r].StanceCount; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, PacketSize); + auto outapp = new EQApplicationPacket(OP_MercenaryDataResponse, PacketSize); Buffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercTypeCount); @@ -2025,7 +2029,7 @@ namespace RoF uint32 PacketSize = 40000; // Calculate this later - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PlayerProfile, PacketSize); + auto outapp = new EQApplicationPacket(OP_PlayerProfile, PacketSize); outapp->WriteUInt32(0); // Checksum, we will update this later outapp->WriteUInt32(0); // Checksum size, we will update this later @@ -2698,7 +2702,7 @@ namespace RoF Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); - unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; + auto NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); safe_delete_array(outapp->pBuffer); outapp->pBuffer = NewBuffer; @@ -2720,7 +2724,7 @@ namespace RoF unsigned char * __emu_buffer = inapp->pBuffer; RaidCreate_Struct *raid_create = (RaidCreate_Struct*)__emu_buffer; - EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *general = (structs::RaidGeneral_Struct*)outapp_create->pBuffer; general->action = 8; @@ -2743,7 +2747,7 @@ namespace RoF { RaidAddMember_Struct* in_add_member = (RaidAddMember_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; add_member->raidGen.action = in_add_member->raidGen.action; @@ -2763,7 +2767,8 @@ namespace RoF else if (raid_gen->action == 35) { RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + + strlen(inmotd->motd) + 1); structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; outmotd->general.action = inmotd->general.action; @@ -2774,7 +2779,8 @@ namespace RoF else if (raid_gen->action == 14 || raid_gen->action == 30) { RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; outlaa->action = inlaa->action; @@ -2787,7 +2793,7 @@ namespace RoF { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *raid_general = (structs::RaidGeneral_Struct*)outapp->pBuffer; strn0cpy(raid_general->leader_name, in_raid_general->leader_name, 64); strn0cpy(raid_general->player_name, in_raid_general->player_name, 64); @@ -3240,7 +3246,7 @@ namespace RoF return; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); + auto outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); ChangeSize_Struct *css = (ChangeSize_Struct *)outapp->pBuffer; @@ -3474,7 +3480,7 @@ namespace RoF in->SetReadPosition(0); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_TaskHistoryReply, OutboundPacketSize); + auto outapp = new EQApplicationPacket(OP_TaskHistoryReply, OutboundPacketSize); outapp->WriteUInt32(in->ReadUInt32()); // Task index outapp->WriteUInt32(in->ReadUInt32()); // Activity count @@ -3786,7 +3792,7 @@ namespace RoF int Count = wars->playercount; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_WhoAllResponse, in->size + (Count * 4)); + auto outapp = new EQApplicationPacket(OP_WhoAllResponse, in->size + (Count * 4)); char *OutBuffer = (char *)outapp->pBuffer; @@ -3961,7 +3967,7 @@ namespace RoF SpawnSize = 3; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ZoneEntry, PacketSize); + auto outapp = new EQApplicationPacket(OP_ZoneEntry, PacketSize); Buffer = (char *)outapp->pBuffer; BufferStart = Buffer; VARSTRUCT_ENCODE_STRING(Buffer, emu->name); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index cdb5d6c2e..8e38d81f2 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -271,8 +271,9 @@ namespace RoF2 if (opcode == 8) { AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) - + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); + auto outapp = new EQApplicationPacket( + OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); structs::AltCurrencyPopulate_Struct *out_populate = (structs::AltCurrencyPopulate_Struct*)outapp->pBuffer; out_populate->opcode = populate->opcode; @@ -290,7 +291,7 @@ namespace RoF2 dest->FastQueuePacket(&outapp, ack_req); } else { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); memcpy(outapp->pBuffer, emu_buffer, sizeof(AltCurrencyUpdate_Struct)); dest->FastQueuePacket(&outapp, ack_req); } @@ -1120,7 +1121,8 @@ namespace RoF2 { //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); @@ -1138,7 +1140,8 @@ namespace RoF2 //if(gjs->action == groupActLeave) // Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); @@ -1175,7 +1178,7 @@ namespace RoF2 //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); + auto outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; @@ -1241,7 +1244,8 @@ namespace RoF2 memcpy(eq->membername, emu->membername, sizeof(eq->membername)); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); GroupLeadershipAAUpdate_Struct *GLAAus = (GroupLeadershipAAUpdate_Struct*)outapp->pBuffer; GLAAus->NPCMarkerID = emu->NPCMarkerID; @@ -1712,7 +1716,7 @@ namespace RoF2 PacketSize += sizeof(structs::MercenaryStance_Struct) * emu->Mercs[r].StanceCount; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, PacketSize); + auto outapp = new EQApplicationPacket(OP_MercenaryDataResponse, PacketSize); Buffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercTypeCount); @@ -2109,7 +2113,7 @@ namespace RoF2 uint32 PacketSize = 40000; // Calculate this later - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PlayerProfile, PacketSize); + auto outapp = new EQApplicationPacket(OP_PlayerProfile, PacketSize); outapp->WriteUInt32(0); // Checksum, we will update this later outapp->WriteUInt32(0); // Checksum size, we will update this later @@ -2792,7 +2796,7 @@ namespace RoF2 Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); - unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; + auto NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); safe_delete_array(outapp->pBuffer); outapp->pBuffer = NewBuffer; @@ -2814,7 +2818,7 @@ namespace RoF2 unsigned char * __emu_buffer = inapp->pBuffer; RaidCreate_Struct *raid_create = (RaidCreate_Struct*)__emu_buffer; - EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *general = (structs::RaidGeneral_Struct*)outapp_create->pBuffer; general->action = 8; @@ -2837,7 +2841,7 @@ namespace RoF2 { RaidAddMember_Struct* in_add_member = (RaidAddMember_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; add_member->raidGen.action = in_add_member->raidGen.action; @@ -2857,7 +2861,8 @@ namespace RoF2 else if (raid_gen->action == 35) { RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + + strlen(inmotd->motd) + 1); structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; outmotd->general.action = inmotd->general.action; @@ -2868,7 +2873,8 @@ namespace RoF2 else if (raid_gen->action == 14 || raid_gen->action == 30) { RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; outlaa->action = inlaa->action; @@ -2881,7 +2887,7 @@ namespace RoF2 { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *raid_general = (structs::RaidGeneral_Struct*)outapp->pBuffer; strn0cpy(raid_general->leader_name, in_raid_general->leader_name, 64); strn0cpy(raid_general->player_name, in_raid_general->player_name, 64); @@ -3315,7 +3321,7 @@ namespace RoF2 return; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); + auto outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); ChangeSize_Struct *css = (ChangeSize_Struct *)outapp->pBuffer; @@ -3549,7 +3555,7 @@ namespace RoF2 in->SetReadPosition(0); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_TaskHistoryReply, OutboundPacketSize); + auto outapp = new EQApplicationPacket(OP_TaskHistoryReply, OutboundPacketSize); outapp->WriteUInt32(in->ReadUInt32()); // Task index outapp->WriteUInt32(in->ReadUInt32()); // Activity count @@ -3936,7 +3942,7 @@ namespace RoF2 int Count = wars->playercount; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_WhoAllResponse, in->size + (Count * 4)); + auto outapp = new EQApplicationPacket(OP_WhoAllResponse, in->size + (Count * 4)); char *OutBuffer = (char *)outapp->pBuffer; @@ -4122,7 +4128,7 @@ namespace RoF2 SpawnSize = 3; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ZoneEntry, PacketSize); + auto outapp = new EQApplicationPacket(OP_ZoneEntry, PacketSize); Buffer = (char *)outapp->pBuffer; BufferStart = Buffer; VARSTRUCT_ENCODE_STRING(Buffer, emu->name); diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index a6ecb80a9..244e63c71 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -778,7 +778,8 @@ namespace SoD { //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); @@ -796,7 +797,8 @@ namespace SoD //if(gjs->action == groupActLeave) // Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); @@ -833,7 +835,7 @@ namespace SoD //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); + auto outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; // Header @@ -897,7 +899,8 @@ namespace SoD memcpy(eq->membername, emu->membername, sizeof(eq->membername)); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); GroupLeadershipAAUpdate_Struct *GLAAus = (GroupLeadershipAAUpdate_Struct*)outapp->pBuffer; GLAAus->NPCMarkerID = emu->NPCMarkerID; @@ -1160,7 +1163,7 @@ namespace SoD PacketSize += sizeof(structs::MercenaryStance_Struct) * emu->Mercs[r].StanceCount; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, PacketSize); + auto outapp = new EQApplicationPacket(OP_MercenaryDataResponse, PacketSize); Buffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercTypeCount); @@ -1772,7 +1775,7 @@ namespace SoD unsigned char * __emu_buffer = inapp->pBuffer; RaidCreate_Struct *raid_create = (RaidCreate_Struct*)__emu_buffer; - EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *general = (structs::RaidGeneral_Struct*)outapp_create->pBuffer; general->action = 8; @@ -1795,7 +1798,7 @@ namespace SoD { RaidAddMember_Struct* in_add_member = (RaidAddMember_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; add_member->raidGen.action = in_add_member->raidGen.action; @@ -1815,7 +1818,8 @@ namespace SoD else if (raid_gen->action == 35) { RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + + strlen(inmotd->motd) + 1); structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; outmotd->general.action = inmotd->general.action; @@ -1826,7 +1830,8 @@ namespace SoD else if (raid_gen->action == 14 || raid_gen->action == 30) { RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; outlaa->action = inlaa->action; @@ -1839,7 +1844,7 @@ namespace SoD { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *raid_general = (structs::RaidGeneral_Struct*)outapp->pBuffer; strn0cpy(raid_general->leader_name, in_raid_general->leader_name, 64); strn0cpy(raid_general->player_name, in_raid_general->player_name, 64); @@ -1873,7 +1878,8 @@ namespace SoD *p = nullptr; AARankInfo_Struct *emu = (AARankInfo_Struct*)inapp->pBuffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendAATable, sizeof(structs::SendAA_Struct) + emu->total_effects * sizeof(structs::AA_Ability)); + auto outapp = new EQApplicationPacket( + OP_SendAATable, sizeof(structs::SendAA_Struct) + emu->total_effects * sizeof(structs::AA_Ability)); structs::SendAA_Struct *eq = (structs::SendAA_Struct*)outapp->pBuffer; inapp->SetReadPosition(sizeof(AARankInfo_Struct)); @@ -2372,7 +2378,8 @@ namespace SoD uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); *p = nullptr; - EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); + auto outapp_create = + new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward) * count)); uchar *old_data = __emu_buffer; uchar *data = outapp_create->pBuffer; for (unsigned int i = 0; i < count; ++i) @@ -2424,7 +2431,7 @@ namespace SoD int Count = wars->playercount; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_WhoAllResponse, in->size + (Count * 4)); + auto outapp = new EQApplicationPacket(OP_WhoAllResponse, in->size + (Count * 4)); char *OutBuffer = (char *)outapp->pBuffer; @@ -2589,7 +2596,7 @@ namespace SoD SpawnSize = 3; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ZoneEntry, PacketSize); + auto outapp = new EQApplicationPacket(OP_ZoneEntry, PacketSize); Buffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_STRING(Buffer, emu->name); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 187d841b0..5ea473904 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1431,7 +1431,7 @@ namespace SoF unsigned char * __emu_buffer = inapp->pBuffer; RaidCreate_Struct *raid_create = (RaidCreate_Struct*)__emu_buffer; - EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *general = (structs::RaidGeneral_Struct*)outapp_create->pBuffer; general->action = 8; @@ -1454,7 +1454,7 @@ namespace SoF { RaidAddMember_Struct* in_add_member = (RaidAddMember_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; add_member->raidGen.action = in_add_member->raidGen.action; @@ -1474,7 +1474,8 @@ namespace SoF else if (raid_gen->action == 35) { RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + + strlen(inmotd->motd) + 1); structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; outmotd->general.action = inmotd->general.action; @@ -1485,7 +1486,8 @@ namespace SoF else if (raid_gen->action == 14 || raid_gen->action == 30) { RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; outlaa->action = inlaa->action; @@ -1498,7 +1500,7 @@ namespace SoF { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *raid_general = (structs::RaidGeneral_Struct*)outapp->pBuffer; strn0cpy(raid_general->leader_name, in_raid_general->leader_name, 64); strn0cpy(raid_general->player_name, in_raid_general->player_name, 64); @@ -1532,7 +1534,8 @@ namespace SoF *p = nullptr; AARankInfo_Struct *emu = (AARankInfo_Struct*)inapp->pBuffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendAATable, sizeof(structs::SendAA_Struct) + emu->total_effects * sizeof(structs::AA_Ability)); + auto outapp = new EQApplicationPacket( + OP_SendAATable, sizeof(structs::SendAA_Struct) + emu->total_effects * sizeof(structs::AA_Ability)); structs::SendAA_Struct *eq = (structs::SendAA_Struct*)outapp->pBuffer; inapp->SetReadPosition(sizeof(AARankInfo_Struct)); @@ -1958,7 +1961,8 @@ namespace SoF uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); *p = nullptr; - EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); + auto outapp_create = + new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward) * count)); uchar *old_data = __emu_buffer; uchar *data = outapp_create->pBuffer; for (uint32 i = 0; i < count; ++i) diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 67c745c78..3cde09beb 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -793,7 +793,7 @@ namespace Titanium return; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, sizeof(structs::LFGuild_PlayerToggle_Struct)); + auto outapp = new EQApplicationPacket(OP_LFGuild, sizeof(structs::LFGuild_PlayerToggle_Struct)); memcpy(outapp->pBuffer, in->pBuffer, sizeof(structs::LFGuild_PlayerToggle_Struct)); @@ -1151,7 +1151,8 @@ namespace Titanium *p = nullptr; AARankInfo_Struct *emu = (AARankInfo_Struct*)inapp->pBuffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendAATable, sizeof(structs::SendAA_Struct) + emu->total_effects * sizeof(structs::AA_Ability)); + auto outapp = new EQApplicationPacket( + OP_SendAATable, sizeof(structs::SendAA_Struct) + emu->total_effects * sizeof(structs::AA_Ability)); structs::SendAA_Struct *eq = (structs::SendAA_Struct*)outapp->pBuffer; inapp->SetReadPosition(sizeof(AARankInfo_Struct)); @@ -1479,7 +1480,8 @@ namespace Titanium uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); *p = nullptr; - EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); + auto outapp_create = + new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward) * count)); uchar *old_data = __emu_buffer; uchar *data = outapp_create->pBuffer; for (uint32 i = 0; i < count; ++i) diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 9142385ed..d07914cb8 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -207,8 +207,9 @@ namespace UF if (opcode == 8) { AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) - + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); + auto outapp = new EQApplicationPacket( + OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); structs::AltCurrencyPopulate_Struct *out_populate = (structs::AltCurrencyPopulate_Struct*)outapp->pBuffer; out_populate->opcode = populate->opcode; @@ -225,7 +226,7 @@ namespace UF dest->FastQueuePacket(&outapp, ack_req); } else { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); memcpy(outapp->pBuffer, emu_buffer, sizeof(AltCurrencyUpdate_Struct)); dest->FastQueuePacket(&outapp, ack_req); } @@ -937,7 +938,8 @@ namespace UF { //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); @@ -956,7 +958,8 @@ namespace UF //if(gjs->action == groupActLeave) // Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); @@ -993,7 +996,7 @@ namespace UF //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); + auto outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; @@ -1057,7 +1060,8 @@ namespace UF memcpy(eq->membername, emu->membername, sizeof(eq->membername)); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); GroupLeadershipAAUpdate_Struct *GLAAus = (GroupLeadershipAAUpdate_Struct*)outapp->pBuffer; GLAAus->NPCMarkerID = emu->NPCMarkerID; @@ -1397,7 +1401,7 @@ namespace UF PacketSize += sizeof(structs::MercenaryStance_Struct) * emu->Mercs[r].StanceCount; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, PacketSize); + auto outapp = new EQApplicationPacket(OP_MercenaryDataResponse, PacketSize); Buffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercTypeCount); @@ -2039,7 +2043,7 @@ namespace UF unsigned char * __emu_buffer = inapp->pBuffer; RaidCreate_Struct *raid_create = (RaidCreate_Struct*)__emu_buffer; - EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *general = (structs::RaidGeneral_Struct*)outapp_create->pBuffer; general->action = 8; @@ -2062,7 +2066,7 @@ namespace UF { RaidAddMember_Struct* in_add_member = (RaidAddMember_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; add_member->raidGen.action = in_add_member->raidGen.action; @@ -2082,7 +2086,8 @@ namespace UF else if (raid_gen->action == 35) { RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + + strlen(inmotd->motd) + 1); structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; outmotd->general.action = inmotd->general.action; @@ -2093,7 +2098,8 @@ namespace UF else if (raid_gen->action == 14 || raid_gen->action == 30) { RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; outlaa->action = inlaa->action; @@ -2106,7 +2112,7 @@ namespace UF { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); structs::RaidGeneral_Struct *raid_general = (structs::RaidGeneral_Struct*)outapp->pBuffer; strn0cpy(raid_general->leader_name, in_raid_general->leader_name, 64); strn0cpy(raid_general->player_name, in_raid_general->player_name, 64); @@ -2161,7 +2167,8 @@ namespace UF *p = nullptr; AARankInfo_Struct *emu = (AARankInfo_Struct*)inapp->pBuffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendAATable, sizeof(structs::SendAA_Struct) + emu->total_effects * sizeof(structs::AA_Ability)); + auto outapp = new EQApplicationPacket( + OP_SendAATable, sizeof(structs::SendAA_Struct) + emu->total_effects * sizeof(structs::AA_Ability)); structs::SendAA_Struct *eq = (structs::SendAA_Struct*)outapp->pBuffer; inapp->SetReadPosition(sizeof(AARankInfo_Struct)); @@ -2406,7 +2413,7 @@ namespace UF return; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); + auto outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); ChangeSize_Struct *css = (ChangeSize_Struct *)outapp->pBuffer; css->EntityID = sas->spawn_id; @@ -2650,7 +2657,8 @@ namespace UF uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); *p = nullptr; - EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); + auto outapp_create = + new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward) * count)); uchar *old_data = __emu_buffer; uchar *data = outapp_create->pBuffer; for (unsigned int i = 0; i < count; ++i) @@ -2702,7 +2710,7 @@ namespace UF int Count = wars->playercount; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_WhoAllResponse, in->size + (Count * 4)); + auto outapp = new EQApplicationPacket(OP_WhoAllResponse, in->size + (Count * 4)); char *OutBuffer = (char *)outapp->pBuffer; @@ -2864,7 +2872,7 @@ namespace UF SpawnSize = 3; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ZoneEntry, PacketSize); + auto outapp = new EQApplicationPacket(OP_ZoneEntry, PacketSize); Buffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_STRING(Buffer, emu->name); diff --git a/common/proc_launcher.cpp b/common/proc_launcher.cpp index d44cc9c46..b59f4e852 100644 --- a/common/proc_launcher.cpp +++ b/common/proc_launcher.cpp @@ -212,7 +212,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { #else //!WIN32 //build argv - char **argv = new char *[it->args.size()+2]; + auto argv = new char *[it->args.size() + 2]; unsigned int r; argv[0] = const_cast(it->program.c_str()); for(r = 1; r <= it->args.size(); r++) { @@ -276,7 +276,7 @@ ProcLauncher::ProcRef ProcLauncher::Launch(Spec *&to_launch) { //if graceful is true, we try to be nice about it if possible bool ProcLauncher::Terminate(const ProcRef &proc, bool graceful) { //we are only willing to kill things we started... - std::map::iterator res = m_running.find(proc); + auto res = m_running.find(proc); if(res == m_running.end()) return(false); diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 56289b09a..770a1ab97 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -307,7 +307,7 @@ void RuleManager::_SaveRule(Database *database, RuleType type, uint16 index) { int RuleManager::GetRulesetID(Database *database, const char *ruleset_name) { uint32 len = strlen(ruleset_name); - char* rst = new char[2 * len + 1]; + auto rst = new char[2 * len + 1]; database->DoEscapeString(rst, ruleset_name, len); std::string query = StringFormat("SELECT ruleset_id FROM rule_sets WHERE name='%s'", rst); @@ -331,7 +331,7 @@ int RuleManager::_FindOrCreateRuleset(Database *database, const char *in_ruleset return ruleset_id; //found and existing one... uint32 len = strlen(in_ruleset_name); - char* ruleset_name = new char[2 * len + 1]; + auto ruleset_name = new char[2 * len + 1]; database->DoEscapeString(ruleset_name, in_ruleset_name, len); std::string query = StringFormat("INSERT INTO rule_sets (ruleset_id, name) VALUES(0, '%s')", ruleset_name); diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 968002baa..e8046167b 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1368,7 +1368,7 @@ bool SharedDatabase::GetCommandSettings(std::map aliases = SplitString(row[2], '|'); - for (std::vector::iterator iter = aliases.begin(); iter != aliases.end(); ++iter) { + for (auto iter = aliases.begin(); iter != aliases.end(); ++iter) { if (iter->empty()) continue; command_settings[row[0]].second.push_back(*iter); diff --git a/common/string_util.cpp b/common/string_util.cpp index 96cfce310..b5717c1b7 100644 --- a/common/string_util.cpp +++ b/common/string_util.cpp @@ -288,7 +288,7 @@ void RemoveApostrophes(std::string &s) char *RemoveApostrophes(const char *s) { - char *NewString = new char[strlen(s) + 1]; + auto NewString = new char[strlen(s) + 1]; strcpy(NewString, s); @@ -452,7 +452,7 @@ uchar* EQEmu::OutBuffer::detach() if (buffer_size == 0) return nullptr; - uchar* out_buffer = new uchar[buffer_size]; + auto out_buffer = new uchar[buffer_size]; memcpy(out_buffer, str().c_str(), buffer_size); flush(); diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index aa687cc01..d13cf89cc 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -187,7 +187,7 @@ void TCPConnection::ServerSendQueuePushEnd(const uchar* data, int32 size) { } else if (size > (sendbuf_size - sendbuf_used)) { sendbuf_size += size + 1024; - uchar* tmp = new uchar[sendbuf_size]; + auto tmp = new uchar[sendbuf_size]; memcpy(tmp, sendbuf, sendbuf_used); safe_delete_array(sendbuf); sendbuf = tmp; @@ -209,7 +209,7 @@ void TCPConnection::ServerSendQueuePushEnd(uchar** data, int32 size) { } if (size > (sendbuf_size - sendbuf_used)) { sendbuf_size += size; - uchar* tmp = new uchar[sendbuf_size]; + auto tmp = new uchar[sendbuf_size]; memcpy(tmp, sendbuf, sendbuf_used); safe_delete_array(sendbuf); sendbuf = tmp; @@ -229,7 +229,7 @@ void TCPConnection::ServerSendQueuePushFront(uchar* data, int32 size) { } else if (size > (sendbuf_size - sendbuf_used)) { sendbuf_size += size; - uchar* tmp = new uchar[sendbuf_size]; + auto tmp = new uchar[sendbuf_size]; memcpy(&tmp[size], sendbuf, sendbuf_used); safe_delete_array(sendbuf); sendbuf = tmp; @@ -608,7 +608,7 @@ bool TCPConnection::RecvData(char* errbuf) { recvbuf_echo = 0; } else if ((recvbuf_size - recvbuf_used) < 2048) { - uchar* tmpbuf = new uchar[recvbuf_size + 5120]; + auto tmpbuf = new uchar[recvbuf_size + 5120]; memcpy(tmpbuf, recvbuf, recvbuf_used); recvbuf_size += 5120; safe_delete_array(recvbuf); diff --git a/common/worldconn.cpp b/common/worldconn.cpp index e85d24a75..432148f89 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -46,7 +46,7 @@ void WorldConnection::OnConnected() { const EQEmuConfig *Config=EQEmuConfig::get(); Log.Out(Logs::General, Logs::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); - ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16); + auto pack = new ServerPacket(ServerOP_ZAAuth, 16); MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer); SendPacket(pack); safe_delete(pack); diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index c1bc0fc42..37c963eb3 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -38,7 +38,7 @@ WorldServer::~WorldServer() { void WorldServer::OnConnected() { WorldConnection::OnConnected(); - ServerPacket* pack = new ServerPacket(ServerOP_LauncherConnectInfo, sizeof(LauncherConnectInfo)); + auto pack = new ServerPacket(ServerOP_LauncherConnectInfo, sizeof(LauncherConnectInfo)); LauncherConnectInfo* sci = (LauncherConnectInfo*) pack->pBuffer; strn0cpy(sci->name, m_name, sizeof(sci->name)); // sci->port = net.GetZonePort(); @@ -92,13 +92,13 @@ void WorldServer::Process() { Log.Out(Logs::Detail, Logs::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); } else { Log.Out(Logs::Detail, Logs::Launcher, "World told us to start zone %s.", lzr->short_name); - ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, lzr->port, m_config); + auto l = new ZoneLaunch(this, m_name, lzr->short_name, lzr->port, m_config); m_zones[lzr->short_name] = l; } break; } case ZR_Restart: { - std::map::iterator res = m_zones.find(lzr->short_name); + auto res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { Log.Out(Logs::Detail, Logs::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); } else { @@ -108,7 +108,7 @@ void WorldServer::Process() { break; } case ZR_Stop: { - std::map::iterator res = m_zones.find(lzr->short_name); + auto res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { Log.Out(Logs::Detail, Logs::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); } else { @@ -137,7 +137,7 @@ void WorldServer::Process() { void WorldServer::SendStatus(const char *short_name, uint32 start_count, bool running) { - ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneStatus, sizeof(LauncherZoneStatus)); + auto pack = new ServerPacket(ServerOP_LauncherZoneStatus, sizeof(LauncherZoneStatus)); LauncherZoneStatus* it =(LauncherZoneStatus*) pack->pBuffer; strn0cpy(it->short_name, short_name, 32); diff --git a/eqlaunch/zone_launch.cpp b/eqlaunch/zone_launch.cpp index 974cf5b3d..7af96c59f 100644 --- a/eqlaunch/zone_launch.cpp +++ b/eqlaunch/zone_launch.cpp @@ -60,7 +60,7 @@ void ZoneLaunch::SendStatus() const { } void ZoneLaunch::Start() { - ProcLauncher::Spec *spec = new ProcLauncher::Spec(); + auto spec = new ProcLauncher::Spec(); spec->program = m_config->ZoneExe; if(m_port) { diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 2e86c449f..6216e112d 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -100,9 +100,9 @@ Database::~Database() void Database::AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type) { - char *escapedFrom = new char[strlen(from) * 2 + 1]; - char *escapedTo = new char[strlen(to) * 2 + 1]; - char *escapedMessage = new char[strlen(message) * 2 + 1]; + auto escapedFrom = new char[strlen(from) * 2 + 1]; + auto escapedTo = new char[strlen(to) * 2 + 1]; + auto escapedMessage = new char[strlen(message) * 2 + 1]; DoEscapeString(escapedFrom, from, strlen(from)); DoEscapeString(escapedTo, to, strlen(to)); DoEscapeString(escapedMessage, message, strlen(message)); @@ -350,7 +350,7 @@ void Database::GeneralQueryReceive(ServerPacket *pack) { /* These are general queries passed from anywhere in zone instead of packing structures and breaking them down again and again */ - char *queryBuffer = new char[pack->ReadUInt32() + 1]; + auto queryBuffer = new char[pack->ReadUInt32() + 1]; pack->ReadString(queryBuffer); std::string query(queryBuffer); diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index 340321f06..ff7271832 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -168,7 +168,7 @@ void LFGuildManager::SendPlayerMatches(uint32 FromZoneID, uint32 FromInstanceID, } - ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, PacketSize); + auto pack = new ServerPacket(ServerOP_QueryServGeneric, PacketSize); pack->WriteUInt32(FromZoneID); pack->WriteUInt32(FromInstanceID); @@ -211,7 +211,7 @@ void LFGuildManager::SendGuildMatches(uint32 FromZoneID, uint32 FromInstanceID, } - ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, PacketSize); + auto pack = new ServerPacket(ServerOP_QueryServGeneric, PacketSize); pack->WriteUInt32(FromZoneID); pack->WriteUInt32(FromInstanceID); @@ -255,7 +255,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char auto results = database.QueryDatabase(query); } - ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); + auto pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); pack->WriteUInt32(FromZoneID); pack->WriteUInt32(FromInstanceID); @@ -300,7 +300,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char } - ServerPacket *pack = new ServerPacket(ServerOP_LFGuildUpdate, strlen(GuildName) + strlen(Comments) + 30); + auto pack = new ServerPacket(ServerOP_LFGuildUpdate, strlen(GuildName) + strlen(Comments) + 30); pack->WriteString(GuildName); pack->WriteString(Comments); @@ -352,7 +352,8 @@ void LFGuildManager::SendPlayerStatus(uint32 FromZoneID, uint32 FromInstanceID, { if(!strcasecmp((*it).Name.c_str(), From)) { - ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + (*it).Comments.length() + 30); + auto pack = + new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + (*it).Comments.length() + 30); pack->WriteUInt32(FromZoneID); pack->WriteUInt32(FromInstanceID); @@ -379,7 +380,8 @@ void LFGuildManager::SendGuildStatus(uint32 FromZoneID, uint32 FromInstanceID, c { if(!strcasecmp((*it).Name.c_str(), GuildName)) { - ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + (*it).Comments.length() + 42); + auto pack = + new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + (*it).Comments.length() + 42); pack->WriteUInt32(FromZoneID); pack->WriteUInt32(FromInstanceID); diff --git a/zone/aa.cpp b/zone/aa.cpp index 7828d6654..477de240e 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -120,7 +120,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u npca->SetFollowID(GetID()); if(!npca->GetSwarmInfo()){ - AA_SwarmPetInfo* nSI = new AA_SwarmPetInfo; + auto nSI = new AA_SwarmPetInfo; npca->SetSwarmInfo(nSI); npca->GetSwarmInfo()->duration = new Timer(pet_duration*1000); } @@ -217,7 +217,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid npca->SetFollowID(GetID()); if(!npca->GetSwarmInfo()){ - AA_SwarmPetInfo* nSI = new AA_SwarmPetInfo; + auto nSI = new AA_SwarmPetInfo; npca->SetSwarmInfo(nSI); npca->GetSwarmInfo()->duration = new Timer(pet_duration*1000); } @@ -260,7 +260,7 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) //assuming we have pets in our table; we take the first pet as a base type. const NPCType *base_type = database.LoadNPCTypesData(500); - NPCType *make_npc = new NPCType; + auto make_npc = new NPCType; memcpy(make_npc, base_type, sizeof(NPCType)); //combat stats @@ -397,10 +397,10 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) make_npc->d_melee_texture1 = 0; make_npc->d_melee_texture2 = 0; - NPC* npca = new NPC(make_npc, 0, GetPosition(), FlyMode3); + auto npca = new NPC(make_npc, 0, GetPosition(), FlyMode3); if(!npca->GetSwarmInfo()){ - AA_SwarmPetInfo* nSI = new AA_SwarmPetInfo; + auto nSI = new AA_SwarmPetInfo; npca->SetSwarmInfo(nSI); npca->GetSwarmInfo()->duration = new Timer(duration*1000); } @@ -477,7 +477,7 @@ void Client::ResetAA() { void Client::SendClearAA() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ClearLeadershipAbilities, 0); + auto outapp = new EQApplicationPacket(OP_ClearLeadershipAbilities, 0); FastQueuePacket(&outapp); outapp = new EQApplicationPacket(OP_ClearAA, 0); FastQueuePacket(&outapp); @@ -733,7 +733,7 @@ void Client::InspectBuffs(Client* Inspector, int Rank) if (!Inspector || Rank == 0) return; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_InspectBuffs, sizeof(InspectBuffs_Struct)); + auto outapp = new EQApplicationPacket(OP_InspectBuffs, sizeof(InspectBuffs_Struct)); InspectBuffs_Struct *ib = (InspectBuffs_Struct *)outapp->pBuffer; uint32 buff_count = GetMaxTotalSlots(); @@ -847,7 +847,7 @@ void Client::SendAlternateAdvancementRank(int aa_id, int level) { } int size = sizeof(AARankInfo_Struct) + (sizeof(AARankEffect_Struct) * rank->effects.size()) + (sizeof(AARankPrereq_Struct) * rank->prereqs.size()); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendAATable, size); + auto outapp = new EQApplicationPacket(OP_SendAATable, size); AARankInfo_Struct *aai = (AARankInfo_Struct*)outapp->pBuffer; aai->id = rank->id; @@ -898,7 +898,7 @@ void Client::SendAlternateAdvancementRank(int aa_id, int level) { } void Client::SendAlternateAdvancementStats() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AAExpUpdate, sizeof(AltAdvStats_Struct)); + auto outapp = new EQApplicationPacket(OP_AAExpUpdate, sizeof(AltAdvStats_Struct)); AltAdvStats_Struct *aps = (AltAdvStats_Struct *)outapp->pBuffer; aps->experience = (uint32)(((float)330.0f * (float)m_pp.expAA) / (float)max_AAXP); aps->unspent = m_pp.aapoints; @@ -908,7 +908,7 @@ void Client::SendAlternateAdvancementStats() { } void Client::SendAlternateAdvancementPoints() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RespondAA, sizeof(AATable_Struct)); + auto outapp = new EQApplicationPacket(OP_RespondAA, sizeof(AATable_Struct)); AATable_Struct* aa2 = (AATable_Struct *)outapp->pBuffer; int i = 0; @@ -933,7 +933,7 @@ void Client::SendAlternateAdvancementPoints() { } void Client::SendAlternateAdvancementTimer(int ability, int begin, int end) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AAAction, sizeof(UseAA_Struct)); + auto outapp = new EQApplicationPacket(OP_AAAction, sizeof(UseAA_Struct)); UseAA_Struct* uaaout = (UseAA_Struct*)outapp->pBuffer; uaaout->ability = ability; uaaout->begin = begin; @@ -945,7 +945,7 @@ void Client::SendAlternateAdvancementTimer(int ability, int begin, int end) { //sends all AA timers. void Client::SendAlternateAdvancementTimers() { //we dont use SendAATimer because theres no reason to allocate the EQApplicationPacket every time - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AAAction, sizeof(UseAA_Struct)); + auto outapp = new EQApplicationPacket(OP_AAAction, sizeof(UseAA_Struct)); UseAA_Struct* uaaout = (UseAA_Struct*)outapp->pBuffer; PTimerList::iterator c, e; @@ -974,7 +974,7 @@ void Client::ResetAlternateAdvancementTimer(int ability) { } void Client::ResetAlternateAdvancementTimers() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AAAction, sizeof(UseAA_Struct)); + auto outapp = new EQApplicationPacket(OP_AAAction, sizeof(UseAA_Struct)); UseAA_Struct* uaaout = (UseAA_Struct*)outapp->pBuffer; PTimerList::iterator c, e; @@ -1592,7 +1592,7 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_mapid = atoi(row[0]); ability->name = row[1]; ability->category = atoi(row[2]); @@ -1624,7 +1624,7 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_mapid = atoi(row[0]); rank->upper_hotkey_sid = atoi(row[1]); rank->lower_hotkey_sid = atoi(row[2]); diff --git a/zone/aggro.cpp b/zone/aggro.cpp index a2ee52357..847c51e76 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -1218,7 +1218,7 @@ void Mob::RemoveFromFeignMemory(Client* attacker) { } void Mob::ClearFeignMemory() { - std::set::iterator RememberedCharID = feign_memory_list.begin(); + auto RememberedCharID = feign_memory_list.begin(); while (RememberedCharID != feign_memory_list.end()) { Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID); diff --git a/zone/attack.cpp b/zone/attack.cpp index a401c71c5..354517279 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1460,7 +1460,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att if((RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) || RuleB(Character, LeaveNakedCorpses)) { // creating the corpse takes the cash/items off the player too - Corpse *new_corpse = new Corpse(this, exploss); + auto new_corpse = new Corpse(this, exploss); std::string tmp; database.GetVariable("ServerType", tmp); @@ -1901,7 +1901,7 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, SkillUseTypes attac uint8 killed_level = GetLevel(); if (GetClass() == LDON_TREASURE) { // open chest - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Animation, sizeof(Animation_Struct)); + auto outapp = new EQApplicationPacket(OP_Animation, sizeof(Animation_Struct)); Animation_Struct* anim = (Animation_Struct*)outapp->pBuffer; anim->spawnid = GetID(); anim->action = 0x0F; @@ -1910,7 +1910,7 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, SkillUseTypes attac safe_delete(outapp); } - EQApplicationPacket* app = new EQApplicationPacket(OP_Death, sizeof(Death_Struct)); + auto app = new EQApplicationPacket(OP_Death, sizeof(Death_Struct)); Death_Struct* d = (Death_Struct*)app->pBuffer; d->spawn_id = GetID(); d->killer_id = killer_mob ? killer_mob->GetID() : 0; @@ -2005,7 +2005,10 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, SkillUseTypes attac // QueryServ Logging - Raid Kills if (RuleB(QueryServ, PlayerLogNPCKills)) { - ServerPacket* pack = new ServerPacket(ServerOP_QSPlayerLogNPCKills, sizeof(QSPlayerLogNPCKill_Struct) + (sizeof(QSPlayerLogNPCKillsPlayers_Struct) * PlayerCount)); + auto pack = + new ServerPacket(ServerOP_QSPlayerLogNPCKills, + sizeof(QSPlayerLogNPCKill_Struct) + + (sizeof(QSPlayerLogNPCKillsPlayers_Struct) * PlayerCount)); PlayerCount = 0; QSPlayerLogNPCKill_Struct* QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer; QS->s1.NPCID = this->GetNPCTypeID(); @@ -2052,7 +2055,10 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, SkillUseTypes attac // QueryServ Logging - Group Kills if (RuleB(QueryServ, PlayerLogNPCKills)) { - ServerPacket* pack = new ServerPacket(ServerOP_QSPlayerLogNPCKills, sizeof(QSPlayerLogNPCKill_Struct) + (sizeof(QSPlayerLogNPCKillsPlayers_Struct) * PlayerCount)); + auto pack = + new ServerPacket(ServerOP_QSPlayerLogNPCKills, + sizeof(QSPlayerLogNPCKill_Struct) + + (sizeof(QSPlayerLogNPCKillsPlayers_Struct) * PlayerCount)); PlayerCount = 0; QSPlayerLogNPCKill_Struct* QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer; QS->s1.NPCID = this->GetNPCTypeID(); @@ -2096,7 +2102,9 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, SkillUseTypes attac // QueryServ Logging - Solo if (RuleB(QueryServ, PlayerLogNPCKills)) { - ServerPacket* pack = new ServerPacket(ServerOP_QSPlayerLogNPCKills, sizeof(QSPlayerLogNPCKill_Struct) + (sizeof(QSPlayerLogNPCKillsPlayers_Struct) * 1)); + auto pack = new ServerPacket(ServerOP_QSPlayerLogNPCKills, + sizeof(QSPlayerLogNPCKill_Struct) + + (sizeof(QSPlayerLogNPCKillsPlayers_Struct) * 1)); QSPlayerLogNPCKill_Struct* QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer; QS->s1.NPCID = this->GetNPCTypeID(); QS->s1.ZoneID = this->GetZoneID(); @@ -2126,7 +2134,9 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, SkillUseTypes attac entity_list.RemoveFromAutoXTargets(this); uint16 emoteid = this->GetEmoteID(); - Corpse* corpse = new Corpse(this, &itemlist, GetNPCTypeID(), &NPCTypedata, level>54 ? RuleI(NPC, MajorNPCCorpseDecayTimeMS) : RuleI(NPC, MinorNPCCorpseDecayTimeMS)); + auto corpse = new Corpse(this, &itemlist, GetNPCTypeID(), &NPCTypedata, + level > 54 ? RuleI(NPC, MajorNPCCorpseDecayTimeMS) + : RuleI(NPC, MinorNPCCorpseDecayTimeMS)); entity_list.LimitRemoveNPC(this); entity_list.AddCorpse(corpse, GetID()); @@ -2477,7 +2487,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { } attacker->Damage(this, -DS, spellid, SkillAbjuration/*hackish*/, false); //we can assume there is a spell now - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); + auto outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct* cds = (CombatDamage_Struct*)outapp->pBuffer; cds->target = attacker->GetID(); cds->source = GetID(); @@ -3242,7 +3252,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //send damage packet... if(!iBuffTic) { //buff ticks do not send damage, instead they just call SendHPUpdate(), which is done above - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); + auto outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct* a = (CombatDamage_Struct*)outapp->pBuffer; a->target = GetID(); if (attacker == nullptr) @@ -4434,7 +4444,7 @@ void Mob::CommonBreakInvisibleFromCombat() if(hidden || improved_hidden){ hidden = false; improved_hidden = false; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x03; diff --git a/zone/client.cpp b/zone/client.cpp index 77e5e78d6..38e5d7c7e 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -424,7 +424,7 @@ void Client::SendZoneInPackets() { ////////////////////////////////////////////////////// // Spawn Appearance Packet - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)outapp->pBuffer; sa->type = AT_SpawnID; // Is 0x10 used to set the player id? sa->parameter = GetID(); // Four bytes for this parameter... @@ -486,7 +486,7 @@ void Client::SendZoneInPackets() void Client::SendLogoutPackets() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_CancelTrade, sizeof(CancelTrade_Struct)); + auto outapp = new EQApplicationPacket(OP_CancelTrade, sizeof(CancelTrade_Struct)); CancelTrade_Struct* ct = (CancelTrade_Struct*) outapp->pBuffer; ct->fromid = GetID(); ct->action = groupActUpdate; @@ -683,7 +683,7 @@ bool Client::AddPacket(const EQApplicationPacket *pApp, bool bAckreq) { //drop the packet because it will never get sent. return(false); } - CLIENTPACKET *c = new CLIENTPACKET; + auto c = new CLIENTPACKET; c->ack_req = bAckreq; c->app = pApp->Copy(); @@ -700,7 +700,7 @@ bool Client::AddPacket(EQApplicationPacket** pApp, bool bAckreq) { //drop the packet because it will never get sent. return(false); } - CLIENTPACKET *c = new CLIENTPACKET; + auto c = new CLIENTPACKET; c->ack_req = bAckreq; c->app = *pApp; @@ -821,7 +821,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s /* Logs Player Chat */ if (RuleB(QueryServ, PlayerLogChat)) { - ServerPacket* pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct) + strlen(message) + 1); + auto pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct) + strlen(message) + 1); Server_Speech_Struct* sem = (Server_Speech_Struct*) pack->pBuffer; if(chan_num == 0) @@ -1123,7 +1123,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s if (msg_len > 512) message[512] = '\0'; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Emote, 4 + msg_len + strlen(GetName()) + 2); + auto outapp = new EQApplicationPacket(OP_Emote, 4 + msg_len + strlen(GetName()) + 2); Emote_Struct* es = (Emote_Struct*)outapp->pBuffer; char *Buffer = (char *)es; Buffer += 4; @@ -1218,7 +1218,7 @@ void Client::Message(uint32 type, const char* message, ...) { return; va_list argptr; - char *buffer = new char[4096]; + auto buffer = new char[4096]; va_start(argptr, message); vsnprintf(buffer, 4096, message, argptr); va_end(argptr); @@ -1231,7 +1231,7 @@ void Client::Message(uint32 type, const char* message, ...) { //len = 4096 - sizeof(SpecialMesg_Struct); uint32 len_packet = sizeof(SpecialMesg_Struct)+len; - EQApplicationPacket* app = new EQApplicationPacket(OP_SpecialMesg, len_packet); + auto app = new EQApplicationPacket(OP_SpecialMesg, len_packet); SpecialMesg_Struct* sm=(SpecialMesg_Struct*)app->pBuffer; sm->header[0] = 0x00; // Header used for #emote style messages.. sm->header[1] = 0x00; // Play around with these to see other types @@ -1262,7 +1262,7 @@ void Client::QuestJournalledMessage(const char *npcname, const char* message) { snprintf(OutMessage, MaxMessageLength, "%s", message); OutMessage[MaxMessageLength]='\0'; uint32 len_packet = sizeof(SpecialMesg_Struct) + strlen(OutNPCName) + strlen(OutMessage); - EQApplicationPacket* app = new EQApplicationPacket(OP_SpecialMesg, len_packet); + auto app = new EQApplicationPacket(OP_SpecialMesg, len_packet); SpecialMesg_Struct* sm=(SpecialMesg_Struct*)app->pBuffer; sm->header[0] = 0; @@ -1417,7 +1417,7 @@ bool Client::UpdateLDoNPoints(int32 points, uint32 theme) } m_pp.ldon_points_available += points; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventurePointsUpdate, sizeof(AdventurePoints_Update_Struct)); + auto outapp = new EQApplicationPacket(OP_AdventurePointsUpdate, sizeof(AdventurePoints_Update_Struct)); AdventurePoints_Update_Struct* apus = (AdventurePoints_Update_Struct*)outapp->pBuffer; apus->ldon_available_points = m_pp.ldon_points_available; apus->ldon_guk_points = m_pp.ldon_points_guk; @@ -1440,7 +1440,7 @@ void Client::SetSkill(SkillUseTypes skillid, uint16 value) { database.SaveCharacterSkill(this->CharacterID(), skillid, value); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer; skill->skillId=skillid; skill->value=value; @@ -1460,7 +1460,7 @@ void Client::IncreaseLanguageSkill(int skill_id, int value) { database.SaveCharacterLanguage(this->CharacterID(), skill_id, m_pp.languages[skill_id]); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer; skill->skillId = 100 + skill_id; skill->value = m_pp.languages[skill_id]; @@ -1481,7 +1481,7 @@ void Client::AddSkill(SkillUseTypes skillid, uint16 value) { } void Client::SendSound(){//Makes a sound. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Sound, 68); + auto outapp = new EQApplicationPacket(OP_Sound, 68); unsigned char x[68]; memset(x, 0, 68); x[0]=0x22; @@ -1507,7 +1507,7 @@ void Client::UpdateWho(uint8 remove) { return; if (!worldserver.Connected()) return; - ServerPacket* pack = new ServerPacket(ServerOP_ClientList, sizeof(ServerClientList_Struct)); + auto pack = new ServerPacket(ServerOP_ClientList, sizeof(ServerClientList_Struct)); ServerClientList_Struct* scl = (ServerClientList_Struct*) pack->pBuffer; scl->remove = remove; scl->wid = this->GetWID(); @@ -1553,7 +1553,7 @@ void Client::WhoAll(Who_All_Struct* whom) { if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_Who, sizeof(ServerWhoAll_Struct)); + auto pack = new ServerPacket(ServerOP_Who, sizeof(ServerWhoAll_Struct)); ServerWhoAll_Struct* whoall = (ServerWhoAll_Struct*) pack->pBuffer; whoall->admin = this->Admin(); whoall->fromid=this->GetID(); @@ -1574,7 +1574,8 @@ void Client::FriendsWho(char *FriendsString) { if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_FriendsWho, sizeof(ServerFriendsWho_Struct) + strlen(FriendsString)); + auto pack = + new ServerPacket(ServerOP_FriendsWho, sizeof(ServerFriendsWho_Struct) + strlen(FriendsString)); ServerFriendsWho_Struct* FriendsWho = (ServerFriendsWho_Struct*) pack->pBuffer; FriendsWho->FromID = this->GetID(); strcpy(FriendsWho->FromName, GetName()); @@ -1609,7 +1610,7 @@ void Client::SetStats(uint8 type,int16 set_val){ printf("Error in Client::IncStats, received invalid type of: %i\n",type); return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_IncreaseStats,sizeof(IncreaseStat_Struct)); + auto outapp = new EQApplicationPacket(OP_IncreaseStats, sizeof(IncreaseStat_Struct)); IncreaseStat_Struct* iss=(IncreaseStat_Struct*)outapp->pBuffer; switch(type){ case STAT_STR: @@ -1692,7 +1693,7 @@ void Client::IncStats(uint8 type,int16 increase_val){ printf("Error in Client::IncStats, received invalid type of: %i\n",type); return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_IncreaseStats,sizeof(IncreaseStat_Struct)); + auto outapp = new EQApplicationPacket(OP_IncreaseStats, sizeof(IncreaseStat_Struct)); IncreaseStat_Struct* iss=(IncreaseStat_Struct*)outapp->pBuffer; switch(type){ case STAT_STR: @@ -1796,9 +1797,7 @@ void Client::SendManaUpdatePacket() { if (last_reported_mana != cur_mana || last_reported_endur != cur_end) { - - - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ManaChange, sizeof(ManaChange_Struct)); + auto outapp = new EQApplicationPacket(OP_ManaChange, sizeof(ManaChange_Struct)); ManaChange_Struct* manachange = (ManaChange_Struct*)outapp->pBuffer; manachange->new_mana = cur_mana; manachange->stamina = cur_end; @@ -1812,7 +1811,8 @@ void Client::SendManaUpdatePacket() { if(g) { outapp = new EQApplicationPacket(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); - EQApplicationPacket *outapp2 = new EQApplicationPacket(OP_MobEnduranceUpdate, sizeof(MobEnduranceUpdate_Struct)); + auto outapp2 = + new EQApplicationPacket(OP_MobEnduranceUpdate, sizeof(MobEnduranceUpdate_Struct)); MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp->pBuffer; MobEnduranceUpdate_Struct *meus = (MobEnduranceUpdate_Struct *)outapp2->pBuffer; @@ -1843,7 +1843,7 @@ void Client::SendManaUpdatePacket() { // sends mana update to self void Client::SendManaUpdate() { - EQApplicationPacket* mana_app = new EQApplicationPacket(OP_ManaUpdate,sizeof(ManaUpdate_Struct)); + auto mana_app = new EQApplicationPacket(OP_ManaUpdate, sizeof(ManaUpdate_Struct)); ManaUpdate_Struct* mus = (ManaUpdate_Struct*)mana_app->pBuffer; mus->cur_mana = GetMana(); mus->max_mana = GetMaxMana(); @@ -1856,7 +1856,7 @@ void Client::SendManaUpdate() // sends endurance update to self void Client::SendEnduranceUpdate() { - EQApplicationPacket* end_app = new EQApplicationPacket(OP_EnduranceUpdate,sizeof(EnduranceUpdate_Struct)); + auto end_app = new EQApplicationPacket(OP_EnduranceUpdate, sizeof(EnduranceUpdate_Struct)); EnduranceUpdate_Struct* eus = (EnduranceUpdate_Struct*)end_app->pBuffer; eus->cur_end = GetEndurance(); eus->max_end = GetMaxEndurance(); @@ -1929,7 +1929,7 @@ void Client::Stand() { void Client::ChangeLastName(const char* in_lastname) { memset(m_pp.last_name, 0, sizeof(m_pp.last_name)); strn0cpy(m_pp.last_name, in_lastname, sizeof(m_pp.last_name)); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMLastName, sizeof(GMLastName_Struct)); + auto outapp = new EQApplicationPacket(OP_GMLastName, sizeof(GMLastName_Struct)); GMLastName_Struct* gmn = (GMLastName_Struct*)outapp->pBuffer; strcpy(gmn->name, name); strcpy(gmn->gmname, name); @@ -1962,7 +1962,7 @@ bool Client::ChangeFirstName(const char* in_firstname, const char* gmname) Save(); // send name update packet - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMNameChange, sizeof(GMName_Struct)); + auto outapp = new EQApplicationPacket(OP_GMNameChange, sizeof(GMName_Struct)); GMName_Struct* gmn=(GMName_Struct*)outapp->pBuffer; strn0cpy(gmn->gmname,gmname,64); strn0cpy(gmn->oldname,GetName(),64); @@ -2003,7 +2003,7 @@ void Client::ReadBook(BookRequest_Struct *book) { #if EQDEBUG >= 6 Log.Out(Logs::General, Logs::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); #endif - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); + auto outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); BookText_Struct *out = (BookText_Struct *) outapp->pBuffer; out->window = book->window; @@ -2031,7 +2031,7 @@ void Client::QuestReadBook(const char* text, uint8 type) { std::string booktxt2 = text; int length = booktxt2.length(); if (booktxt2[0] != '\0') { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); + auto outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); BookText_Struct *out = (BookText_Struct *) outapp->pBuffer; out->window = 0xFF; out->type = type; @@ -2043,7 +2043,7 @@ void Client::QuestReadBook(const char* text, uint8 type) { } void Client::SendClientMoneyUpdate(uint8 type,uint32 amount){ - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeMoneyUpdate,sizeof(TradeMoneyUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_TradeMoneyUpdate, sizeof(TradeMoneyUpdate_Struct)); TradeMoneyUpdate_Struct* mus= (TradeMoneyUpdate_Struct*)outapp->pBuffer; mus->amount=amount; mus->trader=0; @@ -2241,7 +2241,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat } void Client::SendMoneyUpdate() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoneyUpdate,sizeof(MoneyUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_MoneyUpdate, sizeof(MoneyUpdate_Struct)); MoneyUpdate_Struct* mus= (MoneyUpdate_Struct*)outapp->pBuffer; mus->platinum = m_pp.platinum; @@ -2489,7 +2489,7 @@ void Client::SetPVP(bool toggle) { } void Client::WorldKick() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMKick, sizeof(GMKick_Struct)); + auto outapp = new EQApplicationPacket(OP_GMKick, sizeof(GMKick_Struct)); GMKick_Struct* gmk = (GMKick_Struct *)outapp->pBuffer; strcpy(gmk->name,GetName()); QueuePacket(outapp); @@ -2498,7 +2498,7 @@ void Client::WorldKick() { } void Client::GMKill() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMKill, sizeof(GMKill_Struct)); + auto outapp = new EQApplicationPacket(OP_GMKill, sizeof(GMKill_Struct)); GMKill_Struct* gmk = (GMKill_Struct *)outapp->pBuffer; strcpy(gmk->name,GetName()); QueuePacket(outapp); @@ -2513,7 +2513,7 @@ bool Client::CheckAccess(int16 iDBLevel, int16 iDefaultLevel) { } void Client::MemorizeSpell(uint32 slot,uint32 spellid,uint32 scribing){ - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MemorizeSpell,sizeof(MemorizeSpell_Struct)); + auto outapp = new EQApplicationPacket(OP_MemorizeSpell, sizeof(MemorizeSpell_Struct)); MemorizeSpell_Struct* mss=(MemorizeSpell_Struct*)outapp->pBuffer; mss->scribing=scribing; mss->slot=slot; @@ -2859,7 +2859,7 @@ void Client::Message_StringID(uint32 type, uint32 string_id, uint32 distance) return; if (GetFilter(FilterSpellCrits) == FilterHide && type == MT_SpellCrits) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SimpleMessage,12); + auto outapp = new EQApplicationPacket(OP_SimpleMessage, 12); SimpleMessage_Struct* sms = (SimpleMessage_Struct*)outapp->pBuffer; sms->color=type; sms->string_id=string_id; @@ -2921,7 +2921,7 @@ void Client::Message_StringID(uint32 type, uint32 string_id, const char* message length += 1; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_FormattedMessage, sizeof(FormattedMessage_Struct) + length); + auto outapp = new EQApplicationPacket(OP_FormattedMessage, sizeof(FormattedMessage_Struct) + length); FormattedMessage_Struct *fm = (FormattedMessage_Struct *)outapp->pBuffer; fm->string_id = string_id; fm->type = type; @@ -2987,7 +2987,7 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, if (!FilteredMessageCheck(sender, filter)) return; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SimpleMessage, 12); + auto outapp = new EQApplicationPacket(OP_SimpleMessage, 12); SimpleMessage_Struct *sms = (SimpleMessage_Struct *)outapp->pBuffer; sms->color = type; sms->string_id = string_id; @@ -3035,7 +3035,7 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType fil length += 1; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_FormattedMessage, sizeof(FormattedMessage_Struct) + length); + auto outapp = new EQApplicationPacket(OP_FormattedMessage, sizeof(FormattedMessage_Struct) + length); FormattedMessage_Struct *fm = (FormattedMessage_Struct *)outapp->pBuffer; fm->string_id = string_id; fm->type = type; @@ -3113,7 +3113,7 @@ void Client::SetLanguageSkill(int langid, int value) m_pp.languages[langid] = value; database.SaveCharacterLanguage(this->CharacterID(), langid, value); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer; skill->skillId = 100 + langid; skill->value = m_pp.languages[langid]; @@ -3639,7 +3639,7 @@ void Client::SetEndurance(int32 newEnd) void Client::SacrificeConfirm(Client *caster) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_Sacrifice, sizeof(Sacrifice_Struct)); + auto outapp = new EQApplicationPacket(OP_Sacrifice, sizeof(Sacrifice_Struct)); Sacrifice_Struct *ss = (Sacrifice_Struct *)outapp->pBuffer; if (!caster || PendingSacrifice) { @@ -3712,7 +3712,7 @@ void Client::Sacrifice(Client *caster) } ClearAllProximities(); if(RuleB(Character, LeaveCorpses)){ - Corpse *new_corpse = new Corpse(this, 0); + auto new_corpse = new Corpse(this, 0); entity_list.AddCorpse(new_corpse, GetID()); SetID(0); entity_list.QueueClients(this, &app2, true); @@ -3734,7 +3734,7 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { const SPDat_Spell_Struct &Spell = spells[SpellID]; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Translocate, sizeof(Translocate_Struct)); + auto outapp = new EQApplicationPacket(OP_Translocate, sizeof(Translocate_Struct)); Translocate_Struct *ts = (Translocate_Struct*)outapp->pBuffer; strcpy(ts->Caster, Caster->GetName()); @@ -3769,28 +3769,28 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { return; } void Client::SendPickPocketResponse(Mob *from, uint32 amt, int type, const EQEmu::Item_Struct* item){ - EQApplicationPacket* outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); - sPickPocket_Struct* pick_out = (sPickPocket_Struct*) outapp->pBuffer; - pick_out->coin = amt; - pick_out->from = GetID(); - pick_out->to = from->GetID(); - pick_out->myskill = GetSkill(SkillPickPockets); + auto outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); + sPickPocket_Struct *pick_out = (sPickPocket_Struct *)outapp->pBuffer; + pick_out->coin = amt; + pick_out->from = GetID(); + pick_out->to = from->GetID(); + pick_out->myskill = GetSkill(SkillPickPockets); - if((type >= PickPocketPlatinum) && (type <= PickPocketCopper) && (amt == 0)) - type = PickPocketFailed; + if ((type >= PickPocketPlatinum) && (type <= PickPocketCopper) && (amt == 0)) + type = PickPocketFailed; - pick_out->type = type; - if(item) - strcpy(pick_out->itemname, item->Name); - else - pick_out->itemname[0] = '\0'; - //if we do not send this packet the client will lock up and require the player to relog. - QueuePacket(outapp); - safe_delete(outapp); + pick_out->type = type; + if (item) + strcpy(pick_out->itemname, item->Name); + else + pick_out->itemname[0] = '\0'; + // if we do not send this packet the client will lock up and require the player to relog. + QueuePacket(outapp); + safe_delete(outapp); } void Client::SetHoTT(uint32 mobid) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_TargetHoTT, sizeof(ClientTarget_Struct)); + auto outapp = new EQApplicationPacket(OP_TargetHoTT, sizeof(ClientTarget_Struct)); ClientTarget_Struct *ct = (ClientTarget_Struct *) outapp->pBuffer; ct->new_target = mobid; QueuePacket(outapp); @@ -3800,7 +3800,7 @@ void Client::SetHoTT(uint32 mobid) { void Client::SendPopupToClient(const char *Title, const char *Text, uint32 PopupID, uint32 Buttons, uint32 Duration) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_OnLevelMessage, sizeof(OnLevelMessage_Struct)); + auto outapp = new EQApplicationPacket(OP_OnLevelMessage, sizeof(OnLevelMessage_Struct)); OnLevelMessage_Struct *olms = (OnLevelMessage_Struct *)outapp->pBuffer; if ((strlen(Title) > (sizeof(olms->Title) - 1)) || (strlen(Text) > (sizeof(olms->Text) - 1))) { @@ -3837,7 +3837,7 @@ void Client::SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const size_t len = strlen(buffer); - EQApplicationPacket* app = new EQApplicationPacket(OP_OnLevelMessage, sizeof(OnLevelMessage_Struct)); + auto app = new EQApplicationPacket(OP_OnLevelMessage, sizeof(OnLevelMessage_Struct)); OnLevelMessage_Struct* olms=(OnLevelMessage_Struct*)app->pBuffer; if(strlen(Text) > (sizeof(olms->Text)-1)) { @@ -3932,10 +3932,7 @@ void Client::KeyRingAdd(uint32 item_id) bool Client::KeyRingCheck(uint32 item_id) { - for(std::list::iterator iter = keyring.begin(); - iter != keyring.end(); - ++iter) - { + for (auto iter = keyring.begin(); iter != keyring.end(); ++iter) { if(*iter == item_id) return true; } @@ -3946,10 +3943,7 @@ void Client::KeyRingList() { Message(4,"Keys on Keyring:"); const EQEmu::Item_Struct *item = 0; - for(std::list::iterator iter = keyring.begin(); - iter != keyring.end(); - ++iter) - { + for (auto iter = keyring.begin(); iter != keyring.end(); ++iter) { if ((item = database.GetItem(*iter))!=nullptr) { Message(4,item->Name); } @@ -4124,7 +4118,7 @@ bool Client::GroupFollow(Client* inviter) { //Invite the inviter into the group first.....dont ask if (inviter->ClientVersion() < EQEmu::versions::ClientVersion::SoD) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* outgj = (GroupJoin_Struct*)outapp->pBuffer; strcpy(outgj->membername, inviter->GetName()); strcpy(outgj->yourname, inviter->GetName()); @@ -4396,7 +4390,7 @@ void Client::IncrementAggroCount() { if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 1); + auto outapp = new EQApplicationPacket(OP_RestState, 1); char *Buffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0x01); QueuePacket(outapp); @@ -4441,7 +4435,7 @@ void Client::DecrementAggroCount() { if (ClientVersion() >= EQEmu::versions::ClientVersion::SoF) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 5); + auto outapp = new EQApplicationPacket(OP_RestState, 5); char *Buffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0x00); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, (uint32)(time_until_rest / 1000)); @@ -4457,7 +4451,7 @@ void Client::SendPVPStats() // When the PVP Stats window is opened, no opcode is sent. Therefore this method should be called // from Client::CompleteConnect, and also when the player makes a PVP kill. // - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PVPStats, sizeof(PVPStats_Struct)); + auto outapp = new EQApplicationPacket(OP_PVPStats, sizeof(PVPStats_Struct)); PVPStats_Struct *pvps = (PVPStats_Struct *)outapp->pBuffer; pvps->Kills = m_pp.PVPKills; @@ -4476,7 +4470,7 @@ void Client::SendPVPStats() void Client::SendCrystalCounts() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_CrystalCountUpdate, sizeof(CrystalCountUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_CrystalCountUpdate, sizeof(CrystalCountUpdate_Struct)); CrystalCountUpdate_Struct *ccus = (CrystalCountUpdate_Struct *)outapp->pBuffer; ccus->CurrentRadiantCrystals = GetRadiantCrystals(); @@ -4492,7 +4486,7 @@ void Client::SendCrystalCounts() void Client::SendDisciplineTimers() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); + auto outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; for(unsigned int i = 0; i < MAX_DISCIPLINE_TIMERS; ++i) @@ -4556,7 +4550,7 @@ void Client::SendRespawnBinds() PacketLength += opt->name.size() + 1; //+1 for cstring } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RespawnWindow, PacketLength); + auto outapp = new EQApplicationPacket(OP_RespawnWindow, PacketLength); char* buffer = (char*)outapp->pBuffer; //Packet header @@ -4820,7 +4814,7 @@ void Client::SummonAndRezzAllCorpses() { PendingRezzXP = -1; - ServerPacket *Pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); + auto Pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); ServerDepopAllPlayersCorpses_Struct *sdapcs = (ServerDepopAllPlayersCorpses_Struct*)Pack->pBuffer; @@ -4855,7 +4849,7 @@ void Client::SummonAllCorpses(const glm::vec4& position) if(IsOrigin(position) && position.w == 0.0f) summonLocation = GetPosition(); - ServerPacket *Pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); + auto Pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); ServerDepopAllPlayersCorpses_Struct *sdapcs = (ServerDepopAllPlayersCorpses_Struct*)Pack->pBuffer; @@ -4874,7 +4868,7 @@ void Client::SummonAllCorpses(const glm::vec4& position) void Client::DepopAllCorpses() { - ServerPacket *Pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); + auto Pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); ServerDepopAllPlayersCorpses_Struct *sdapcs = (ServerDepopAllPlayersCorpses_Struct*)Pack->pBuffer; @@ -4891,7 +4885,7 @@ void Client::DepopAllCorpses() void Client::DepopPlayerCorpse(uint32 dbid) { - ServerPacket *Pack = new ServerPacket(ServerOP_DepopPlayerCorpse, sizeof(ServerDepopPlayerCorpse_Struct)); + auto Pack = new ServerPacket(ServerOP_DepopPlayerCorpse, sizeof(ServerDepopPlayerCorpse_Struct)); ServerDepopPlayerCorpse_Struct *sdpcs = (ServerDepopPlayerCorpse_Struct*)Pack->pBuffer; @@ -4913,7 +4907,7 @@ void Client::BuryPlayerCorpses() void Client::NotifyNewTitlesAvailable() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_NewTitlesAvailable, 0); + auto outapp = new EQApplicationPacket(OP_NewTitlesAvailable, 0); QueuePacket(outapp); @@ -5336,7 +5330,7 @@ void Client::SendRewards() if(rewards.empty()) return; - EQApplicationPacket *vetapp = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(InternalVeteranReward) * rewards.size())); + auto vetapp = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(InternalVeteranReward) * rewards.size())); uchar *data = vetapp->pBuffer; for(int i = 0; i < rewards.size(); ++i) { InternalVeteranReward *ivr = (InternalVeteranReward*)data; @@ -5686,7 +5680,7 @@ void Client::AddCrystals(uint32 Radiant, uint32 Ebon) // Processes a client request to inspect a SoF+ client's equipment. void Client::ProcessInspectRequest(Client* requestee, Client* requester) { if(requestee && requester) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_InspectAnswer, sizeof(InspectResponse_Struct)); + auto outapp = new EQApplicationPacket(OP_InspectAnswer, sizeof(InspectResponse_Struct)); InspectResponse_Struct* insr = (InspectResponse_Struct*) outapp->pBuffer; insr->TargetID = requester->GetID(); insr->playerid = requestee->GetID(); @@ -5758,7 +5752,7 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { void Client::GuildBankAck() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankAck_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankAck_Struct)); GuildBankAck_Struct *gbas = (GuildBankAck_Struct*) outapp->pBuffer; @@ -5770,7 +5764,7 @@ void Client::GuildBankAck() void Client::GuildBankDepositAck(bool Fail, int8 action) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankDepositAck_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankDepositAck_Struct)); GuildBankDepositAck_Struct *gbdas = (GuildBankDepositAck_Struct*) outapp->pBuffer; @@ -5783,7 +5777,7 @@ void Client::GuildBankDepositAck(bool Fail, int8 action) void Client::ClearGuildBank() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankClear_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankClear_Struct)); GuildBankClear_Struct *gbcs = (GuildBankClear_Struct*) outapp->pBuffer; @@ -5798,7 +5792,7 @@ void Client::SendGroupCreatePacket() { // For SoD and later clients, this is sent the Group Leader upon initial creation of the group // - EQApplicationPacket *outapp=new EQApplicationPacket(OP_GroupUpdateB, 32 + strlen(GetName())); + auto outapp = new EQApplicationPacket(OP_GroupUpdateB, 32 + strlen(GetName())); char *Buffer = (char *)outapp->pBuffer; // Header @@ -5824,7 +5818,7 @@ void Client::SendGroupLeaderChangePacket(const char *LeaderName) { // For SoD and later, send name of Group Leader to this client - EQApplicationPacket *outapp=new EQApplicationPacket(OP_GroupLeaderChange, sizeof(GroupLeaderChange_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupLeaderChange, sizeof(GroupLeaderChange_Struct)); GroupLeaderChange_Struct *glcs = (GroupLeaderChange_Struct*)outapp->pBuffer; @@ -5836,14 +5830,14 @@ void Client::SendGroupLeaderChangePacket(const char *LeaderName) void Client::SendGroupJoinAcknowledge() { // For SoD and later, This produces the 'You have joined the group' message. - EQApplicationPacket* outapp=new EQApplicationPacket(OP_GroupAcknowledge, 4); + auto outapp = new EQApplicationPacket(OP_GroupAcknowledge, 4); FastQueuePacket(&outapp); } void Client::SendAdventureError(const char *error) { size_t error_size = strlen(error); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureInfo, (error_size + 2)); + auto outapp = new EQApplicationPacket(OP_AdventureInfo, (error_size + 2)); strn0cpy((char*)outapp->pBuffer, error, error_size); FastQueuePacket(&outapp); } @@ -5853,7 +5847,7 @@ void Client::SendAdventureDetails() if(adv_data) { ServerSendAdventureData_Struct *ad = (ServerSendAdventureData_Struct*)adv_data; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureData, sizeof(AdventureRequestResponse_Struct)); + auto outapp = new EQApplicationPacket(OP_AdventureData, sizeof(AdventureRequestResponse_Struct)); AdventureRequestResponse_Struct *arr = (AdventureRequestResponse_Struct*)outapp->pBuffer; arr->unknown000 = 0xBFC40100; arr->unknown2080 = 0x0A; @@ -5882,14 +5876,14 @@ void Client::SendAdventureDetails() else { ServerSendAdventureData_Struct *ad = (ServerSendAdventureData_Struct*)adv_data; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureData, sizeof(AdventureRequestResponse_Struct)); + auto outapp = new EQApplicationPacket(OP_AdventureData, sizeof(AdventureRequestResponse_Struct)); FastQueuePacket(&outapp); } } void Client::SendAdventureCount(uint32 count, uint32 total) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureUpdate, sizeof(AdventureCountUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_AdventureUpdate, sizeof(AdventureCountUpdate_Struct)); AdventureCountUpdate_Struct *acu = (AdventureCountUpdate_Struct*)outapp->pBuffer; acu->current = count; acu->total = total; @@ -5899,7 +5893,7 @@ void Client::SendAdventureCount(uint32 count, uint32 total) void Client::NewAdventure(int id, int theme, const char *text, int member_count, const char *members) { size_t text_size = strlen(text); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureDetails, text_size + 2); + auto outapp = new EQApplicationPacket(OP_AdventureDetails, text_size + 2); strn0cpy((char*)outapp->pBuffer, text, text_size); FastQueuePacket(&outapp); @@ -5941,7 +5935,7 @@ void Client::LeaveAdventure() if(!GetPendingAdventureLeave()) { PendingAdventureLeave(); - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeave, 64); + auto pack = new ServerPacket(ServerOP_AdventureLeave, 64); strcpy((char*)pack->pBuffer, GetName()); pack->Deflate(); worldserver.SendPacket(pack); @@ -5978,7 +5972,7 @@ void Client::ClearCurrentAdventure() void Client::AdventureFinish(bool win, int theme, int points) { UpdateLDoNPoints(points, theme); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureFinish, sizeof(AdventureFinish_Struct)); + auto outapp = new EQApplicationPacket(OP_AdventureFinish, sizeof(AdventureFinish_Struct)); AdventureFinish_Struct *af = (AdventureFinish_Struct*)outapp->pBuffer; af->win_lose = win ? 1 : 0; af->points = points; @@ -6074,7 +6068,8 @@ void Client::CheckEmoteHail(Mob *target, const char* message) void Client::MarkSingleCompassLoc(float in_x, float in_y, float in_z, uint8 count) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_DzCompass, sizeof(ExpeditionInfo_Struct) + sizeof(ExpeditionCompassEntry_Struct) * count); + auto outapp = new EQApplicationPacket(OP_DzCompass, sizeof(ExpeditionInfo_Struct) + + sizeof(ExpeditionCompassEntry_Struct) * count); ExpeditionCompass_Struct *ecs = (ExpeditionCompass_Struct*)outapp->pBuffer; //ecs->clientid = GetID(); ecs->count = count; @@ -6105,7 +6100,7 @@ void Client::SendZonePoints() } uint32 zpsize = sizeof(ZonePoints) + ((count + 1) * sizeof(ZonePoint_Entry)); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SendZonepoints, zpsize); + auto outapp = new EQApplicationPacket(OP_SendZonepoints, zpsize); ZonePoints* zp = (ZonePoints*)outapp->pBuffer; zp->count = count; @@ -6132,7 +6127,7 @@ void Client::SendZonePoints() void Client::SendTargetCommand(uint32 EntityID) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TargetCommand, sizeof(ClientTarget_Struct)); + auto outapp = new EQApplicationPacket(OP_TargetCommand, sizeof(ClientTarget_Struct)); ClientTarget_Struct *cts = (ClientTarget_Struct*)outapp->pBuffer; cts->new_target = EntityID; FastQueuePacket(&outapp); @@ -6322,7 +6317,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid FlyMode3); if(!npca->GetSwarmInfo()){ - AA_SwarmPetInfo* nSI = new AA_SwarmPetInfo; + auto nSI = new AA_SwarmPetInfo; npca->SetSwarmInfo(nSI); npca->GetSwarmInfo()->duration = new Timer(pet_duration*1000); } @@ -6773,10 +6768,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) std::string faction_item_string = ""; char faction_buf[256]; - for(std::map ::iterator iter = item_faction_bonuses.begin(); - iter != item_faction_bonuses.end(); - ++iter) - { + for (auto iter = item_faction_bonuses.begin(); iter != item_faction_bonuses.end(); ++iter) { memset(&faction_buf, 0, sizeof(faction_buf)); if(!database.GetFactionName((int32)((*iter).first), faction_buf, sizeof(faction_buf))) @@ -6876,14 +6868,15 @@ void Client::SendAltCurrencies() { return; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, - sizeof(AltCurrencyPopulate_Struct) + sizeof(AltCurrencyPopulateEntry_Struct) * count); + auto outapp = + new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyPopulate_Struct) + + sizeof(AltCurrencyPopulateEntry_Struct) * count); AltCurrencyPopulate_Struct *altc = (AltCurrencyPopulate_Struct*)outapp->pBuffer; altc->opcode = ALT_CURRENCY_OP_POPULATE; altc->count = count; uint32 i = 0; - std::list::iterator iter = zone->AlternateCurrencies.begin(); + auto iter = zone->AlternateCurrencies.begin(); while(iter != zone->AlternateCurrencies.end()) { const EQEmu::Item_Struct* item = database.GetItem((*iter).item_id); altc->entries[i].currency_number = (*iter).id; @@ -6934,7 +6927,7 @@ void Client::AddAlternateCurrencyValue(uint32 currency_id, int32 amount, int8 me } int new_value = 0; - std::map::iterator iter = alternate_currency.find(currency_id); + auto iter = alternate_currency.find(currency_id); if(iter == alternate_currency.end()) { new_value = amount; } else { @@ -6953,7 +6946,7 @@ void Client::AddAlternateCurrencyValue(uint32 currency_id, int32 amount, int8 me void Client::SendAlternateCurrencyValues() { - std::list::iterator iter = zone->AlternateCurrencies.begin(); + auto iter = zone->AlternateCurrencies.begin(); while(iter != zone->AlternateCurrencies.end()) { SendAlternateCurrencyValue((*iter).id, false); ++iter; @@ -6964,7 +6957,7 @@ void Client::SendAlternateCurrencyValue(uint32 currency_id, bool send_if_null) { uint32 value = GetAlternateCurrencyValue(currency_id); if(value > 0 || (value == 0 && send_if_null)) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); AltCurrencyUpdate_Struct *update = (AltCurrencyUpdate_Struct*)outapp->pBuffer; update->opcode = 7; strcpy(update->name, GetName()); @@ -6977,7 +6970,7 @@ void Client::SendAlternateCurrencyValue(uint32 currency_id, bool send_if_null) uint32 Client::GetAlternateCurrencyValue(uint32 currency_id) const { - std::map::const_iterator iter = alternate_currency.find(currency_id); + auto iter = alternate_currency.find(currency_id); if(iter == alternate_currency.end()) { return 0; } else { @@ -6997,7 +6990,7 @@ void Client::ProcessAlternateCurrencyQueue() { void Client::OpenLFGuildWindow() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, 8); + auto outapp = new EQApplicationPacket(OP_LFGuild, 8); outapp->WriteUInt32(6); @@ -7162,7 +7155,7 @@ void Client::SendXTargetPacket(uint32 Slot, Mob *m) PacketSize += strlen(XTargets[Slot].Name); } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_XTargetResponse, PacketSize); + auto outapp = new EQApplicationPacket(OP_XTargetResponse, PacketSize); outapp->WriteUInt32(GetMaxXTargets()); outapp->WriteUInt32(1); outapp->WriteUInt32(Slot); @@ -7300,7 +7293,7 @@ void Client::SetMaxXTargets(uint8 NewMax) XTargets[i].Name[0] = 0; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_XTargetResponse, 8); + auto outapp = new EQApplicationPacket(OP_XTargetResponse, 8); outapp->WriteUInt32(GetMaxXTargets()); outapp->WriteUInt32(0); FastQueuePacket(&outapp); @@ -7392,7 +7385,7 @@ void Client::SendWebLink(const char *website) size_t len = strlen(website) + 1; if(website != 0 && len > 1) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weblink, sizeof(Weblink_Struct) + len); + auto outapp = new EQApplicationPacket(OP_Weblink, sizeof(Weblink_Struct) + len); Weblink_Struct *wl = (Weblink_Struct*)outapp->pBuffer; memcpy(wl->weblink, website, len); wl->weblink[len] = '\0'; @@ -7425,7 +7418,8 @@ void Client::SendMercPersonalInfo() { if (mercCount > 0) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, sizeof(MercenaryDataUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_MercenaryDataUpdate, sizeof(MercenaryDataUpdate_Struct)); MercenaryDataUpdate_Struct* mdus = (MercenaryDataUpdate_Struct*)outapp->pBuffer; mdus->MercStatus = 0; mdus->MercCount = mercCount; @@ -7449,7 +7443,7 @@ void Client::SendMercPersonalInfo() uint32 stanceindex = 0; if (mdus->MercData[i].StanceCount != 0) { - std::list::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin(); + auto iter = zone->merc_stance_list[mercData->MercTemplateID].begin(); while(iter != zone->merc_stance_list[mercData->MercTemplateID].end()) { mdus->MercData[i].Stances[stanceindex].StanceIndex = stanceindex; @@ -7469,7 +7463,8 @@ void Client::SendMercPersonalInfo() { if(mercTypeCount > 0 && mercCount > 0) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct)); + auto outapp = new EQApplicationPacket(OP_MercenaryDataResponse, + sizeof(MercenaryMerchantList_Struct)); MercenaryMerchantList_Struct* mml = (MercenaryMerchantList_Struct*)outapp->pBuffer; mml->MercTypeCount = mercTypeCount; //We should only have one merc entry. mml->MercGrades[i] = 1; @@ -7494,7 +7489,7 @@ void Client::SendMercPersonalInfo() int stanceindex = 0; if(mml->Mercs[i].StanceCount != 0) { - std::list::iterator iter = zone->merc_stance_list[mercData->MercTemplateID].begin(); + auto iter = zone->merc_stance_list[mercData->MercTemplateID].begin(); while(iter != zone->merc_stance_list[mercData->MercTemplateID].end()) { mml->Mercs[i].Stances[stanceindex].StanceIndex = stanceindex; @@ -7521,7 +7516,7 @@ void Client::SendMercPersonalInfo() void Client::SendClearMercInfo() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, sizeof(NoMercenaryHired_Struct)); + auto outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, sizeof(NoMercenaryHired_Struct)); NoMercenaryHired_Struct *nmhs = (NoMercenaryHired_Struct*)outapp->pBuffer; nmhs->MercStatus = -1; nmhs->MercCount = 0; @@ -8327,7 +8322,7 @@ void Client::SendMarqueeMessage(uint32 type, uint32 priority, uint32 fade_in, ui void Client::PlayMP3(const char* fname) { std::string filename = fname; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PlayMP3, filename.length() + 1); + auto outapp = new EQApplicationPacket(OP_PlayMP3, filename.length() + 1); PlayMP3_Struct* buf = (PlayMP3_Struct*)outapp->pBuffer; strncpy(buf->filename, fname, filename.length()); QueuePacket(outapp); @@ -8388,8 +8383,7 @@ void Client::SendColoredText(uint32 color, std::string message) // arbitrary size limit if (message.size() > 512) // live does send this with empty strings sometimes ... return; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ColoredText, - sizeof(ColoredText_Struct) + message.size()); + auto outapp = new EQApplicationPacket(OP_ColoredText, sizeof(ColoredText_Struct) + message.size()); ColoredText_Struct *cts = (ColoredText_Struct *)outapp->pBuffer; cts->color = color; strcpy(cts->msg, message.c_str()); @@ -8400,7 +8394,7 @@ void Client::SendColoredText(uint32 color, std::string message) void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, bool faction) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Sound, sizeof(QuestReward_Struct)); + auto outapp = new EQApplicationPacket(OP_Sound, sizeof(QuestReward_Struct)); memset(outapp->pBuffer, 0, sizeof(outapp->pBuffer)); QuestReward_Struct* qr = (QuestReward_Struct*)outapp->pBuffer; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 5d11f315e..9712e031a 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -841,7 +841,7 @@ void Client::CompleteConnect() } /** Request adventure info **/ - ServerPacket *pack = new ServerPacket(ServerOP_AdventureDataRequest, 64); + auto pack = new ServerPacket(ServerOP_AdventureDataRequest, 64); strcpy((char*)pack->pBuffer, GetName()); worldserver.SendPacket(pack); delete pack; @@ -1022,7 +1022,7 @@ void Client::Handle_Connect_OP_ReqClientSpawn(const EQApplicationPacket *app) { conn_state = ClientSpawnRequested; - EQApplicationPacket* outapp = new EQApplicationPacket; + auto outapp = new EQApplicationPacket; // Send Zone Doors if (entity_list.MakeDoorSpawnPacket(outapp, this)) @@ -1084,7 +1084,7 @@ void Client::Handle_Connect_OP_ReqNewZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SendAAStats(const EQApplicationPacket *app) { SendAlternateAdvancementTimers(); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SendAAStats, 0); + auto outapp = new EQApplicationPacket(OP_SendAAStats, 0); QueuePacket(outapp); safe_delete(outapp); return; @@ -1098,7 +1098,7 @@ void Client::Handle_Connect_OP_SendAATable(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SendExpZonein(const EQApplicationPacket *app) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SendExpZonein, 0); + auto outapp = new EQApplicationPacket(OP_SendExpZonein, 0); QueuePacket(outapp); safe_delete(outapp); @@ -1165,7 +1165,7 @@ void Client::Handle_Connect_OP_WearChange(const EQApplicationPacket *app) void Client::Handle_Connect_OP_WorldObjectsSent(const EQApplicationPacket *app) { // New for SoF+ - EQApplicationPacket* outapp = new EQApplicationPacket(OP_WorldObjectsSent, 0); + auto outapp = new EQApplicationPacket(OP_WorldObjectsSent, 0); QueuePacket(outapp); safe_delete(outapp); @@ -1182,7 +1182,7 @@ void Client::Handle_Connect_OP_WorldObjectsSent(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ZoneComplete(const EQApplicationPacket *app) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_0x0347, 0); + auto outapp = new EQApplicationPacket(OP_0x0347, 0); QueuePacket(outapp); safe_delete(outapp); return; @@ -1812,7 +1812,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) it = zone->adventure_entry_list_flavor.find(m->CastToNPC()->GetAdventureTemplate()); if (it != zone->adventure_entry_list_flavor.end()) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureInfo, (it->second.size() + 2)); + auto outapp = new EQApplicationPacket(OP_AdventureInfo, (it->second.size() + 2)); strn0cpy((char*)outapp->pBuffer, it->second.c_str(), it->second.size()); FastQueuePacket(&outapp); } @@ -1821,7 +1821,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) if (m->CastToNPC()->GetAdventureTemplate() != 0) { std::string text = "Choose your difficulty and preferred adventure type."; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureInfo, (text.size() + 2)); + auto outapp = new EQApplicationPacket(OP_AdventureInfo, (text.size() + 2)); strn0cpy((char*)outapp->pBuffer, text.c_str(), text.size()); FastQueuePacket(&outapp); } @@ -1842,7 +1842,7 @@ void Client::Handle_OP_AdventureLeaderboardRequest(const EQApplicationPacket *ap } adventure_leaderboard_timer = new Timer(4000); - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, sizeof(ServerLeaderboardRequest_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, sizeof(ServerLeaderboardRequest_Struct)); ServerLeaderboardRequest_Struct *lr = (ServerLeaderboardRequest_Struct*)pack->pBuffer; strcpy(lr->player, GetName()); @@ -2220,7 +2220,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) price *= ams_in->charges; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureMerchantSell, sizeof(Adventure_Sell_Struct)); + auto outapp = new EQApplicationPacket(OP_AdventureMerchantSell, sizeof(Adventure_Sell_Struct)); Adventure_Sell_Struct *ams = (Adventure_Sell_Struct*)outapp->pBuffer; ams->slot = ams_in->slot; ams->unknown000 = 1; @@ -2313,7 +2313,8 @@ void Client::Handle_OP_AdventureRequest(const EQApplicationPacket *app) return; } - ServerPacket *packet = new ServerPacket(ServerOP_AdventureRequest, sizeof(ServerAdventureRequest_Struct)+(64 * group_members)); + auto packet = + new ServerPacket(ServerOP_AdventureRequest, sizeof(ServerAdventureRequest_Struct) + (64 * group_members)); ServerAdventureRequest_Struct *sar = (ServerAdventureRequest_Struct*)packet->pBuffer; sar->member_count = group_members; sar->risk = ars->risk; @@ -2374,7 +2375,7 @@ void Client::Handle_OP_AdventureStatsRequest(const EQApplicationPacket *app) } adventure_stats_timer = new Timer(8000); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureStatsReply, sizeof(AdventureStats_Struct)); + auto outapp = new EQApplicationPacket(OP_AdventureStatsReply, sizeof(AdventureStats_Struct)); AdventureStats_Struct *as = (AdventureStats_Struct*)outapp->pBuffer; if (database.GetAdventureStats(CharacterID(), as)) @@ -2412,7 +2413,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app return; } - std::list::iterator altc_iter = zone->AlternateCurrencies.begin(); + auto altc_iter = zone->AlternateCurrencies.begin(); bool found = false; while (altc_iter != zone->AlternateCurrencies.end()) { if ((*altc_iter).id == alt_cur_id) { @@ -2562,7 +2563,7 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app) VERIFY_PACKET_LENGTH(OP_AltCurrencyReclaim, app, AltCurrencyReclaim_Struct); AltCurrencyReclaim_Struct *reclaim = (AltCurrencyReclaim_Struct*)app->pBuffer; uint32 item_id = 0; - std::list::iterator iter = zone->AlternateCurrencies.begin(); + auto iter = zone->AlternateCurrencies.begin(); while (iter != zone->AlternateCurrencies.end()) { if ((*iter).id == reclaim->currency_id) { item_id = (*iter).item_id; @@ -2772,7 +2773,8 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) cost = 0; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrencySellSelection, sizeof(AltCurrencySelectItemReply_Struct)); + auto outapp = + new EQApplicationPacket(OP_AltCurrencySellSelection, sizeof(AltCurrencySelectItemReply_Struct)); AltCurrencySelectItemReply_Struct *reply = (AltCurrencySelectItemReply_Struct*)outapp->pBuffer; reply->unknown004 = 0xFF; reply->unknown005 = 0xFF; @@ -2846,7 +2848,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) } } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ApplyPoison, nullptr, sizeof(ApplyPoison_Struct)); + auto outapp = new EQApplicationPacket(OP_ApplyPoison, nullptr, sizeof(ApplyPoison_Struct)); ApplyPoison_Struct* ApplyPoisonResult = (ApplyPoison_Struct*)outapp->pBuffer; ApplyPoisonResult->success = ApplyPoisonSuccessResult; ApplyPoisonResult->inventorySlot = ApplyPoisonData->inventorySlot; @@ -3332,7 +3334,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) return; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_BankerChange, nullptr, sizeof(BankerChange_Struct)); + auto outapp = new EQApplicationPacket(OP_BankerChange, nullptr, sizeof(BankerChange_Struct)); BankerChange_Struct *bc = (BankerChange_Struct *)outapp->pBuffer; if (m_pp.platinum < 0) @@ -3621,7 +3623,7 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) { Message(13, "Ability recovery time not yet met."); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Begging, sizeof(BeggingResponse_Struct)); + auto outapp = new EQApplicationPacket(OP_Begging, sizeof(BeggingResponse_Struct)); BeggingResponse_Struct *brs = (BeggingResponse_Struct*)outapp->pBuffer; brs->Result = 0; FastQueuePacket(&outapp); @@ -3636,7 +3638,7 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) p_timers.Start(pTimerBeggingPickPocket, 8); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Begging, sizeof(BeggingResponse_Struct)); + auto outapp = new EQApplicationPacket(OP_Begging, sizeof(BeggingResponse_Struct)); BeggingResponse_Struct *brs = (BeggingResponse_Struct*)outapp->pBuffer; brs->Result = 0; // Default, Fail. @@ -3743,7 +3745,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) } } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_BlockedBuffs, sizeof(BlockedBuffs_Struct)); + auto outapp = new EQApplicationPacket(OP_BlockedBuffs, sizeof(BlockedBuffs_Struct)); BlockedBuffs_Struct *obbs = (BlockedBuffs_Struct*)outapp->pBuffer; @@ -3771,7 +3773,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) if ((bbs->Initialise == 0) && (bbs->Count > 0)) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_BlockedBuffs, sizeof(BlockedBuffs_Struct)); + auto outapp = new EQApplicationPacket(OP_BlockedBuffs, sizeof(BlockedBuffs_Struct)); BlockedBuffs_Struct *obbs = (BlockedBuffs_Struct*)outapp->pBuffer; @@ -4334,7 +4336,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) auto boatDelta = glm::vec4(ppu->delta_x, ppu->delta_y, ppu->delta_z, ppu->delta_heading); boat->SetDelta(boatDelta); // send an update to everyone nearby except the client controlling the boat - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); + auto outapp = + new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* ppus = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer; boat->MakeSpawnUpdate(ppus); entity_list.QueueCloseClients(boat,outapp,true,300,this,false); @@ -4532,7 +4535,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) hidden = false; improved_hidden = false; if(!invisible) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = + new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x03; @@ -4566,8 +4570,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) m_Position.w = tmpheading; animation = ppu->animation; - - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); + auto outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* ppu = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer; MakeSpawnUpdate(ppu); if (gmhideme) @@ -4624,7 +4627,7 @@ void Client::Handle_OP_Consent(const EQApplicationPacket *app) if(app->size<64){ Consent_Struct* c = (Consent_Struct*)app->pBuffer; if(strcmp(c->name, GetName()) != 0) { - ServerPacket* pack = new ServerPacket(ServerOP_Consent, sizeof(ServerOP_Consent_Struct)); + auto pack = new ServerPacket(ServerOP_Consent, sizeof(ServerOP_Consent_Struct)); ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; strcpy(scs->grantname, c->name); strcpy(scs->ownername, GetName()); @@ -4647,7 +4650,7 @@ void Client::Handle_OP_ConsentDeny(const EQApplicationPacket *app) { if(app->size<64){ Consent_Struct* c = (Consent_Struct*)app->pBuffer; - ServerPacket* pack = new ServerPacket(ServerOP_Consent, sizeof(ServerOP_Consent_Struct)); + auto pack = new ServerPacket(ServerOP_Consent, sizeof(ServerOP_Consent_Struct)); ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; strcpy(scs->grantname, c->name); strcpy(scs->ownername, GetName()); @@ -4680,7 +4683,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Consider, sizeof(Consider_Struct)); + auto outapp = new EQApplicationPacket(OP_Consider, sizeof(Consider_Struct)); Consider_Struct* con = (Consider_Struct*)outapp->pBuffer; con->playerid = GetID(); con->targetid = conin->targetid; @@ -4920,7 +4923,7 @@ void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) else boat->SetTarget(0); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ControlBoat, 0); + auto outapp = new EQApplicationPacket(OP_ControlBoat, 0); FastQueuePacket(&outapp); safe_delete(outapp); // have the boat signal itself, so quests can be triggered by boat use @@ -5165,7 +5168,7 @@ void Client::Handle_OP_DeleteSpawn(const EQApplicationPacket *app) //eqs->RemoveData(); // Flushing the queue of packet data to allow for proper zoning //just make sure this gets out - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogoutReply); + auto outapp = new EQApplicationPacket(OP_LogoutReply); FastQueuePacket(&outapp); outapp = new EQApplicationPacket(OP_DeleteSpawn, sizeof(EntityId_Struct)); @@ -5343,7 +5346,7 @@ void Client::Handle_OP_DuelResponse2(const EQApplicationPacket *app) Entity* initiator = entity_list.GetID(ds->duel_initiator); if (entity && initiator && entity == this && initiator->IsClient()) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RequestDuel, sizeof(Duel_Struct)); + auto outapp = new EQApplicationPacket(OP_RequestDuel, sizeof(Duel_Struct)); Duel_Struct* ds2 = (Duel_Struct*)outapp->pBuffer; ds2->duel_initiator = entity->GetID(); @@ -5411,7 +5414,7 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app) + len_msg + 1; // Construct outgoing packet - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Emote, len_packet); + auto outapp = new EQApplicationPacket(OP_Emote, len_packet); Emote_Struct* out = (Emote_Struct*)outapp->pBuffer; out->type = in->type; memcpy(out->message, name, len_name); @@ -5885,7 +5888,7 @@ void Client::Handle_OP_GMFind(const EQApplicationPacket *app) //Break down incoming GMSummon_Struct* request = (GMSummon_Struct*)app->pBuffer; //Create a new outgoing - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GMFind, sizeof(GMSummon_Struct)); + auto outapp = new EQApplicationPacket(OP_GMFind, sizeof(GMSummon_Struct)); GMSummon_Struct* foundplayer = (GMSummon_Struct*)outapp->pBuffer; //Copy the constants strcpy(foundplayer->charname, request->charname); @@ -5924,7 +5927,7 @@ void Client::Handle_OP_GMGoto(const EQApplicationPacket *app) else if (!worldserver.Connected()) Message(0, "Error: World server disconnected."); else { - ServerPacket* pack = new ServerPacket(ServerOP_GMGoto, sizeof(ServerGMGoto_Struct)); + auto pack = new ServerPacket(ServerOP_GMGoto, sizeof(ServerGMGoto_Struct)); memset(pack->pBuffer, 0, pack->size); ServerGMGoto_Struct* wsgmg = (ServerGMGoto_Struct*)pack->pBuffer; strcpy(wsgmg->myname, this->GetName()); @@ -5970,7 +5973,7 @@ void Client::Handle_OP_GMKick(const EQApplicationPacket *app) if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); + auto pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*)pack->pBuffer; strcpy(skp->adminname, gmk->gmname); strcpy(skp->name, gmk->name); @@ -6012,7 +6015,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app) if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_KillPlayer, sizeof(ServerKillPlayer_Struct)); + auto pack = new ServerPacket(ServerOP_KillPlayer, sizeof(ServerKillPlayer_Struct)); ServerKillPlayer_Struct* skp = (ServerKillPlayer_Struct*)pack->pBuffer; strcpy(skp->gmname, gmk->gmname); strcpy(skp->target, gmk->name); @@ -6122,7 +6125,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) GMSearchCorpse_Struct *gmscs = (GMSearchCorpse_Struct *)app->pBuffer; gmscs->Name[63] = '\0'; - char *escSearchString = new char[129]; + auto escSearchString = new char[129]; database.DoEscapeString(escSearchString, gmscs->Name, strlen(gmscs->Name)); std::string query = StringFormat("SELECT charname, zone_id, x, y, z, time_of_death, is_rezzed, is_buried " @@ -6184,7 +6187,7 @@ void Client::Handle_OP_GMServers(const EQApplicationPacket *app) if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_ZoneStatus, strlen(this->GetName()) + 2); + auto pack = new ServerPacket(ServerOP_ZoneStatus, strlen(this->GetName()) + 2); memset(pack->pBuffer, (uint8)admin, 1); strcpy((char *)&pack->pBuffer[1], this->GetName()); worldserver.SendPacket(pack); @@ -6286,7 +6289,7 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app) tarzone[0] = 0; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMZoneRequest, sizeof(GMZoneRequest_Struct)); + auto outapp = new EQApplicationPacket(OP_GMZoneRequest, sizeof(GMZoneRequest_Struct)); GMZoneRequest_Struct* gmzr2 = (GMZoneRequest_Struct*)outapp->pBuffer; strcpy(gmzr2->charname, this->GetName()); gmzr2->zone_id = gmzr->zone_id; @@ -6346,7 +6349,7 @@ void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) } else { - ServerPacket* pack = new ServerPacket(ServerOP_GroupCancelInvite, sizeof(GroupCancel_Struct)); + auto pack = new ServerPacket(ServerOP_GroupCancelInvite, sizeof(GroupCancel_Struct)); memcpy(pack->pBuffer, gf, sizeof(GroupCancel_Struct)); worldserver.SendPacket(pack); safe_delete(pack); @@ -6582,7 +6585,7 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) // Inviter is in another zone - Remove merc from group now if any LeaveGroup(); - ServerPacket* pack = new ServerPacket(ServerOP_GroupFollow, sizeof(ServerGroupFollow_Struct)); + auto pack = new ServerPacket(ServerOP_GroupFollow, sizeof(ServerGroupFollow_Struct)); ServerGroupFollow_Struct *sgfs = (ServerGroupFollow_Struct *)pack->pBuffer; sgfs->CharacterID = CharacterID(); strn0cpy(sgfs->gf.name1, gf->name1, sizeof(sgfs->gf.name1)); @@ -6626,7 +6629,8 @@ void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { //Make a new packet using all the same information but make sure it's a fixed GroupInvite opcode so we //Don't have to deal with GroupFollow2 crap. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupInvite, sizeof(GroupInvite_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupInvite, sizeof(GroupInvite_Struct)); memcpy(outapp->pBuffer, app->pBuffer, outapp->size); Invitee->CastToClient()->QueuePacket(outapp); safe_delete(outapp); @@ -6647,7 +6651,7 @@ void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) } else { - ServerPacket* pack = new ServerPacket(ServerOP_GroupInvite, sizeof(GroupInvite_Struct)); + auto pack = new ServerPacket(ServerOP_GroupInvite, sizeof(GroupInvite_Struct)); memcpy(pack->pBuffer, gis, sizeof(GroupInvite_Struct)); worldserver.SendPacket(pack); safe_delete(pack); @@ -7740,7 +7744,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } if (!guild_mgr.SetGuild(char_id, GUILD_NONE, 0)) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GuildManageRemove, sizeof(GuildManageRemove_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildManageRemove, sizeof(GuildManageRemove_Struct)); GuildManageRemove_Struct* gm = (GuildManageRemove_Struct*)outapp->pBuffer; gm->guildeqid = GuildID(); strcpy(gm->member, gc->othername); @@ -7876,7 +7880,7 @@ void Client::Handle_OP_Hide(const EQApplicationPacket *app) float random = zone->random.Real(0, 100); CheckIncreaseSkill(SkillHide, nullptr, 5); if (random < hidechance) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x03; @@ -7891,7 +7895,7 @@ void Client::Handle_OP_Hide(const EQApplicationPacket *app) hidden = true; } if (GetClass() == ROGUE){ - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SimpleMessage, sizeof(SimpleMessage_Struct)); + auto outapp = new EQApplicationPacket(OP_SimpleMessage, sizeof(SimpleMessage_Struct)); SimpleMessage_Struct *msg = (SimpleMessage_Struct *)outapp->pBuffer; msg->color = 0x010E; Mob *evadetar = GetTarget(); @@ -8194,7 +8198,7 @@ void Client::Handle_OP_ItemName(const EQApplicationPacket *app) ItemNamePacket_Struct *p = (ItemNamePacket_Struct*)app->pBuffer; const EQEmu::Item_Struct *item = 0; if ((item = database.GetItem(p->item_id)) != nullptr) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ItemName, sizeof(ItemNamePacket_Struct)); + auto outapp = new EQApplicationPacket(OP_ItemName, sizeof(ItemNamePacket_Struct)); p = (ItemNamePacket_Struct*)outapp->pBuffer; memset(p, 0, sizeof(ItemNamePacket_Struct)); strcpy(p->name, item->Name); @@ -8211,7 +8215,8 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) const EQEmu::Item_Struct* item = database.GetItem(ips->itemid); if (item) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ItemPreview, strlen(item->Name) + strlen(item->Lore) + strlen(item->IDFile) + 898); + auto outapp = new EQApplicationPacket(OP_ItemPreview, strlen(item->Name) + strlen(item->Lore) + + strlen(item->IDFile) + 898); int spacer; for (spacer = 0; spacer < 16; spacer++) { @@ -8658,7 +8663,9 @@ void Client::Handle_OP_LDoNButton(const EQApplicationPacket *app) bool* p = (bool*)app->pBuffer; if (*p == true) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestCreate, sizeof(ServerAdventureRequestCreate_Struct)+(64 * adv_requested_member_count)); + auto pack = + new ServerPacket(ServerOP_AdventureRequestCreate, + sizeof(ServerAdventureRequestCreate_Struct) + (64 * adv_requested_member_count)); ServerAdventureRequestCreate_Struct *sac = (ServerAdventureRequestCreate_Struct*)pack->pBuffer; strcpy(sac->leader, GetName()); sac->id = adv_requested_id; @@ -8824,7 +8831,7 @@ void Client::Handle_OP_LFGCommand(const EQApplicationPacket *app) UpdateWho(); // Issue outgoing packet to notify other clients - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LFGAppearance, sizeof(LFG_Appearance_Struct)); + auto outapp = new EQApplicationPacket(OP_LFGAppearance, sizeof(LFG_Appearance_Struct)); LFG_Appearance_Struct* lfga = (LFG_Appearance_Struct*)outapp->pBuffer; lfga->spawn_id = this->GetID(); lfga->lfg = (uint8)LFG; @@ -8847,7 +8854,7 @@ void Client::Handle_OP_LFGGetMatchesRequest(const EQApplicationPacket *app) if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_LFGMatches, sizeof(ServerLFGMatchesRequest_Struct)); + auto pack = new ServerPacket(ServerOP_LFGMatches, sizeof(ServerLFGMatchesRequest_Struct)); ServerLFGMatchesRequest_Struct* smrs = (ServerLFGMatchesRequest_Struct*)pack->pBuffer; smrs->FromID = GetID(); smrs->QuerierLevel = GetLevel(); @@ -8885,7 +8892,7 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) #endif // DARWIN return; - ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + strlen(pts->Comment) + 38); + auto pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + strlen(pts->Comment) + 38); pack->WriteUInt32(zone->GetZoneID()); pack->WriteUInt32(zone->GetInstanceID()); @@ -8920,7 +8927,9 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) #endif // __DARWIN return; - ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + strlen(gts->Comment) + strlen(guild_mgr.GetGuildName(GuildID())) + 43); + auto pack = + new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + strlen(gts->Comment) + + strlen(guild_mgr.GetGuildName(GuildID())) + 43); pack->WriteUInt32(zone->GetZoneID()); pack->WriteUInt32(zone->GetInstanceID()); @@ -8945,7 +8954,7 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) { VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_SearchPlayer_Struct); - ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + 37); + auto pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + 37); pack->WriteUInt32(zone->GetZoneID()); pack->WriteUInt32(zone->GetInstanceID()); @@ -8969,7 +8978,7 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) { VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_SearchGuild_Struct); - ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + 33); + auto pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + 33); pack->WriteUInt32(zone->GetZoneID()); pack->WriteUInt32(zone->GetInstanceID()); @@ -9069,7 +9078,7 @@ void Client::Handle_OP_LFPGetMatchesRequest(const EQApplicationPacket *app) if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_LFPMatches, sizeof(ServerLFPMatchesRequest_Struct)); + auto pack = new ServerPacket(ServerOP_LFPMatches, sizeof(ServerLFPMatchesRequest_Struct)); ServerLFPMatchesRequest_Struct* smrs = (ServerLFPMatchesRequest_Struct*)pack->pBuffer; smrs->FromID = GetID(); smrs->FromLevel = gmrs->FromLevel; @@ -9104,7 +9113,7 @@ void Client::Handle_OP_Logout(const EQApplicationPacket *app) SendLogoutPackets(); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogoutReply); + auto outapp = new EQApplicationPacket(OP_LogoutReply); FastQueuePacket(&outapp); Disconnect(); @@ -9181,7 +9190,7 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app) if (hidden || improved_hidden){ hidden = false; improved_hidden = false; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x03; @@ -9319,7 +9328,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) //get number of available stances for the current merc std::list mercStanceList = zone->merc_stance_list[merc->GetMercTemplateID()]; - std::list::iterator iter = mercStanceList.begin(); + auto iter = mercStanceList.begin(); while (iter != mercStanceList.end()) { numStances++; ++iter; @@ -9403,22 +9412,22 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) int i = 0; int StanceCount = 0; - for (std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) - { - std::list::iterator siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin(); + for (auto mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) { + auto siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin(); for (siter = zone->merc_stance_list[mercListItr->MercTemplateID].begin(); siter != zone->merc_stance_list[mercListItr->MercTemplateID].end(); ++siter) { StanceCount++; } } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct)); + auto outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct)); MercenaryMerchantList_Struct* mml = (MercenaryMerchantList_Struct*)outapp->pBuffer; mml->MercTypeCount = mercTypeCount; if (mercTypeCount > 0) { - for (std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); ++mercTypeListItr) { + for (auto mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); + ++mercTypeListItr) { mml->MercGrades[i] = mercTypeListItr->Type; // DBStringID for Type i++; } @@ -9428,8 +9437,8 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) if (mercCount > 0) { i = 0; - for (std::list::iterator mercListIter = mercDataList.begin(); mercListIter != mercDataList.end(); ++mercListIter) - { + for (auto mercListIter = mercDataList.begin(); mercListIter != mercDataList.end(); + ++mercListIter) { mml->Mercs[i].MercID = mercListIter->MercTemplateID; mml->Mercs[i].MercType = mercListIter->MercType; mml->Mercs[i].MercSubType = mercListIter->MercSubType; @@ -9444,7 +9453,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) mml->Mercs[i].MerchantSlot = i + 1; mml->Mercs[i].MercUnk02 = 1; int mercStanceCount = 0; - std::list::iterator iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); + auto iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); for (iter = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); iter != zone->merc_stance_list[mercListIter->MercTemplateID].end(); ++iter) { mercStanceCount++; @@ -9456,7 +9465,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) int stanceindex = 0; if (mercStanceCount > 0) { - std::list::iterator iter2 = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); + auto iter2 = zone->merc_stance_list[mercListIter->MercTemplateID].begin(); while (iter2 != zone->merc_stance_list[mercListIter->MercTemplateID].end()) { mml->Mercs[i].Stances[stanceindex].StanceIndex = stanceindex; @@ -10255,7 +10264,7 @@ void Client::Handle_OP_Petition(const EQApplicationPacket *app) Message(0, "You already have a petition in the queue, you must wait for it to be answered or use /deletepetition to delete it."); return; } - Petition* pet = new Petition(CharacterID()); + auto pet = new Petition(CharacterID()); pet->SetAName(this->AccountName()); pet->SetClass(this->GetClass()); pet->SetLevel(this->GetLevel()); @@ -10335,7 +10344,7 @@ void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app) Log.Out(Logs::General, Logs::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); PetitionUpdate_Struct* pet = (PetitionUpdate_Struct*)outapp->pBuffer; pet->petnumber = *((int*)app->pBuffer); pet->color = 0x00; @@ -10451,7 +10460,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) p_timers.Start(pTimerBeggingPickPocket, 8); if (victim == this){ Message(0, "You catch yourself red-handed."); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); + auto outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); sPickPocket_Struct* pick_out = (sPickPocket_Struct*)outapp->pBuffer; pick_out->coin = 0; pick_out->from = victim->GetID(); @@ -10464,7 +10473,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) } else if (victim->GetOwnerID()){ Message(0, "You cannot steal from pets!"); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); + auto outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); sPickPocket_Struct* pick_out = (sPickPocket_Struct*)outapp->pBuffer; pick_out->coin = 0; pick_out->from = victim->GetID(); @@ -10480,7 +10489,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) } else{ Message(0, "Stealing from clients not yet supported."); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); + auto outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct)); sPickPocket_Struct* pick_out = (sPickPocket_Struct*)outapp->pBuffer; pick_out->coin = 0; pick_out->from = victim->GetID(); @@ -10613,7 +10622,7 @@ void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) } //success, send them an update - EQApplicationPacket *outapp = new EQApplicationPacket(OP_UpdateLeadershipAA, sizeof(UpdateLeadershipAA_Struct)); + auto outapp = new EQApplicationPacket(OP_UpdateLeadershipAA, sizeof(UpdateLeadershipAA_Struct)); UpdateLeadershipAA_Struct *u = (UpdateLeadershipAA_Struct *)outapp->pBuffer; u->ability_id = aaid; u->new_rank = m_pp.leader_abilities.ranks[aaid]; @@ -10661,7 +10670,7 @@ void Client::Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *a return; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PVPLeaderBoardDetailsReply, sizeof(PVPLeaderBoardDetailsReply_Struct)); + auto outapp = new EQApplicationPacket(OP_PVPLeaderBoardDetailsReply, sizeof(PVPLeaderBoardDetailsReply_Struct)); PVPLeaderBoardDetailsReply_Struct *pvplbdrs = (PVPLeaderBoardDetailsReply_Struct *)outapp->pBuffer; // TODO: Record and send this data. @@ -10689,7 +10698,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) } /*PVPLeaderBoardRequest_Struct *pvplbrs = (PVPLeaderBoardRequest_Struct *)app->pBuffer;*/ //unused - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PVPLeaderBoardReply, sizeof(PVPLeaderBoard_Struct)); + auto outapp = new EQApplicationPacket(OP_PVPLeaderBoardReply, sizeof(PVPLeaderBoard_Struct)); /*PVPLeaderBoard_Struct *pvplb = (PVPLeaderBoard_Struct *)outapp->pBuffer;*/ //unused // TODO: Record and send this data. @@ -10725,7 +10734,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) break; } //This sends an "invite" to the client in question. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; strn0cpy(rg->leader_name, ri->leader_name, 64); strn0cpy(rg->player_name, ri->player_name, 64); @@ -11031,7 +11040,8 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) if (c) r->SendGroupDisband(c); else{ - ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupDisband, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = + new ServerPacket(ServerOP_RaidGroupDisband, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct* rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->zoneid = zone->GetZoneID(); @@ -11086,7 +11096,10 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) } } else{ - ServerPacket *pack = new ServerPacket(ServerOP_RaidChangeGroup, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket( + ServerOP_RaidChangeGroup, + sizeof( + ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = r->GetID(); strn0cpy(rga->playername, r->members[x].membername, 64); @@ -11111,7 +11124,8 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) r->SendGroupDisband(c); } else{ - ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupDisband, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidGroupDisband, + sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct* rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = r->GetID(); rga->zoneid = zone->GetZoneID(); @@ -11155,7 +11169,9 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) } } else{ - ServerPacket *pack = new ServerPacket(ServerOP_RaidChangeGroup, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket( + ServerOP_RaidChangeGroup, + sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = r->GetID(); strn0cpy(rga->playername, r->members[x].membername, 64); @@ -11173,7 +11189,8 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) r->SendGroupDisband(c); } else{ - ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupDisband, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidGroupDisband, + sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct* rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = r->GetID(); rga->zoneid = zone->GetZoneID(); @@ -11301,7 +11318,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) } randResult = zone->random.Int(randLow, randHigh); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RandomReply, sizeof(RandomReply_Struct)); + auto outapp = new EQApplicationPacket(OP_RandomReply, sizeof(RandomReply_Struct)); RandomReply_Struct* rr = (RandomReply_Struct*)outapp->pBuffer; rr->low = randLow; rr->high = randHigh; @@ -11504,7 +11521,7 @@ void Client::Handle_OP_RemoveBlockedBuffs(const EQApplicationPacket *app) { std::set::iterator Iterator; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RemoveBlockedBuffs, sizeof(BlockedBuffs_Struct)); + auto outapp = new EQApplicationPacket(OP_RemoveBlockedBuffs, sizeof(BlockedBuffs_Struct)); BlockedBuffs_Struct *obbs = (BlockedBuffs_Struct*)outapp->pBuffer; @@ -12156,7 +12173,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) if (!item){ //error finding item, client didnt get the update packet for whatever reason, roleplay a tad Message(15, "%s tells you 'Sorry, that item is for display purposes only.' as they take the item off the shelf.", tmp->GetCleanName()); - EQApplicationPacket* delitempacket = new EQApplicationPacket(OP_ShopDelItem, sizeof(Merchant_DelItem_Struct)); + auto delitempacket = new EQApplicationPacket(OP_ShopDelItem, sizeof(Merchant_DelItem_Struct)); Merchant_DelItem_Struct* delitem = (Merchant_DelItem_Struct*)delitempacket->pBuffer; delitem->itemslot = mp->itemslot; delitem->npcid = mp->npcid; @@ -12183,7 +12200,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) if (item->Stackable && mp->quantity > item->StackSize) mp->quantity = item->StackSize; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ShopPlayerBuy, sizeof(Merchant_Sell_Struct)); + auto outapp = new EQApplicationPacket(OP_ShopPlayerBuy, sizeof(Merchant_Sell_Struct)); Merchant_Sell_Struct* mpo = (Merchant_Sell_Struct*)outapp->pBuffer; mpo->quantity = mp->quantity; mpo->playerid = mp->playerid; @@ -12270,7 +12287,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) int32 new_charges = prevcharges - mp->quantity; zone->SaveTempItem(merchantid, tmp->GetNPCTypeID(), item_id, new_charges); if (new_charges <= 0){ - EQApplicationPacket* delitempacket = new EQApplicationPacket(OP_ShopDelItem, sizeof(Merchant_DelItem_Struct)); + auto delitempacket = new EQApplicationPacket(OP_ShopDelItem, sizeof(Merchant_DelItem_Struct)); Merchant_DelItem_Struct* delitem = (Merchant_DelItem_Struct*)delitempacket->pBuffer; delitem->itemslot = mp->itemslot; delitem->npcid = mp->npcid; @@ -12295,7 +12312,9 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) // start QS code // stacking purchases not supported at this time - entire process will need some work to catch them properly if (RuleB(QueryServ, PlayerLogMerchantTransactions)) { - ServerPacket* qspack = new ServerPacket(ServerOP_QSPlayerLogMerchantTransactions, sizeof(QSMerchantLogTransaction_Struct)+sizeof(QSTransactionItems_Struct)); + auto qspack = + new ServerPacket(ServerOP_QSPlayerLogMerchantTransactions, + sizeof(QSMerchantLogTransaction_Struct) + sizeof(QSTransactionItems_Struct)); QSMerchantLogTransaction_Struct* qsaudit = (QSMerchantLogTransaction_Struct*)qspack->pBuffer; qsaudit->zone_id = zone->GetZoneID(); @@ -12457,7 +12476,9 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) // start QS code if (RuleB(QueryServ, PlayerLogMerchantTransactions)) { - ServerPacket* qspack = new ServerPacket(ServerOP_QSPlayerLogMerchantTransactions, sizeof(QSMerchantLogTransaction_Struct)+sizeof(QSTransactionItems_Struct)); + auto qspack = + new ServerPacket(ServerOP_QSPlayerLogMerchantTransactions, + sizeof(QSMerchantLogTransaction_Struct) + sizeof(QSTransactionItems_Struct)); QSMerchantLogTransaction_Struct* qsaudit = (QSMerchantLogTransaction_Struct*)qspack->pBuffer; qsaudit->zone_id = zone->GetZoneID(); @@ -12499,7 +12520,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) if (inst->IsCharged()) mp->quantity = 1; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ShopPlayerSell, sizeof(Merchant_Purchase_Struct)); + auto outapp = new EQApplicationPacket(OP_ShopPlayerSell, sizeof(Merchant_Purchase_Struct)); Merchant_Purchase_Struct* mco = (Merchant_Purchase_Struct*)outapp->pBuffer; mco->npcid = vendor->GetID(); mco->itemslot = mp->itemslot; @@ -12541,7 +12562,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) int action = 1; if (merchantid == 0) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ShopRequest, sizeof(Merchant_Click_Struct)); + auto outapp = new EQApplicationPacket(OP_ShopRequest, sizeof(Merchant_Click_Struct)); Merchant_Click_Struct* mco = (Merchant_Click_Struct*)outapp->pBuffer; mco->npcid = mc->npcid; mco->playerid = 0; @@ -12576,7 +12597,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) action = 0; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ShopRequest, sizeof(Merchant_Click_Struct)); + auto outapp = new EQApplicationPacket(OP_ShopRequest, sizeof(Merchant_Click_Struct)); Merchant_Click_Struct* mco = (Merchant_Click_Struct*)outapp->pBuffer; mco->npcid = mc->npcid; @@ -12615,7 +12636,7 @@ void Client::Handle_OP_Sneak(const EQApplicationPacket *app) sneaking = false; hidden = false; improved_hidden = false; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x03; @@ -12631,7 +12652,7 @@ void Client::Handle_OP_Sneak(const EQApplicationPacket *app) if (!was && random < hidechance) { sneaking = true; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x0F; @@ -13039,7 +13060,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { //Targeting something we shouldn't with /target //but the client allows this without MQ so you don't flag it - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TargetReject, sizeof(TargetReject_Struct)); + auto outapp = new EQApplicationPacket(OP_TargetReject, sizeof(TargetReject_Struct)); outapp->pBuffer[0] = 0x2f; outapp->pBuffer[1] = 0x01; outapp->pBuffer[4] = 0x0d; @@ -13060,7 +13081,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) } else { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TargetReject, sizeof(TargetReject_Struct)); + auto outapp = new EQApplicationPacket(OP_TargetReject, sizeof(TargetReject_Struct)); outapp->pBuffer[0] = 0x2f; outapp->pBuffer[1] = 0x01; outapp->pBuffer[4] = 0x0d; @@ -13291,14 +13312,18 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) event_entry._detail_count = event_details.size(); - ServerPacket* qs_pack = new ServerPacket(ServerOP_QSPlayerLogTrades, sizeof(QSPlayerLogTrade_Struct)+(sizeof(QSTradeItems_Struct)* event_entry._detail_count)); + auto qs_pack = new ServerPacket( + ServerOP_QSPlayerLogTrades, + sizeof(QSPlayerLogTrade_Struct) + + (sizeof(QSTradeItems_Struct) * event_entry._detail_count)); QSPlayerLogTrade_Struct* qs_buf = (QSPlayerLogTrade_Struct*)qs_pack->pBuffer; memcpy(qs_buf, &event_entry, sizeof(QSPlayerLogTrade_Struct)); int offset = 0; - for (std::list::iterator iter = event_details.begin(); iter != event_details.end(); ++iter, ++offset) { + for (auto iter = event_details.begin(); iter != event_details.end(); + ++iter, ++offset) { QSTradeItems_Struct* detail = reinterpret_cast(*iter); qs_buf->items[offset] = *detail; safe_delete(detail); @@ -13323,14 +13348,14 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) trade->Reset(); } // All done - EQApplicationPacket* outapp = new EQApplicationPacket(OP_FinishTrade, 0); + auto outapp = new EQApplicationPacket(OP_FinishTrade, 0); other->QueuePacket(outapp); this->FastQueuePacket(&outapp); } } // Trading with a Mob object that is not a Client. else if (with) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_FinishTrade, 0); + auto outapp = new EQApplicationPacket(OP_FinishTrade, 0); QueuePacket(outapp); safe_delete(outapp); if (with->IsNPC()) { @@ -13345,14 +13370,17 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) event_entry._detail_count = event_details.size(); - ServerPacket* qs_pack = new ServerPacket(ServerOP_QSPlayerLogHandins, sizeof(QSPlayerLogHandin_Struct)+(sizeof(QSHandinItems_Struct)* event_entry._detail_count)); + auto qs_pack = + new ServerPacket(ServerOP_QSPlayerLogHandins, + sizeof(QSPlayerLogHandin_Struct) + + (sizeof(QSHandinItems_Struct) * event_entry._detail_count)); QSPlayerLogHandin_Struct* qs_buf = (QSPlayerLogHandin_Struct*)qs_pack->pBuffer; memcpy(qs_buf, &event_entry, sizeof(QSPlayerLogHandin_Struct)); int offset = 0; - for (std::list::iterator iter = event_details.begin(); iter != event_details.end(); ++iter, ++offset) { + for (auto iter = event_details.begin(); iter != event_details.end(); ++iter, ++offset) { QSHandinItems_Struct* detail = reinterpret_cast(*iter); qs_buf->items[offset] = *detail; safe_delete(detail); @@ -13521,7 +13549,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) // This refreshes the Trader window to display the End Trader button if (ClientVersion() >= EQEmu::versions::ClientVersion::RoF) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Trader, sizeof(TraderStatus_Struct)); + auto outapp = new EQApplicationPacket(OP_Trader, sizeof(TraderStatus_Struct)); TraderStatus_Struct* tss = (TraderStatus_Struct*)outapp->pBuffer; tss->Code = BazaarTrader_StartTraderMode2; QueuePacket(outapp); @@ -13627,7 +13655,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) //npcs always accept trade->Start(msg->to_mob_id); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeRequestAck, sizeof(TradeRequest_Struct)); + auto outapp = new EQApplicationPacket(OP_TradeRequestAck, sizeof(TradeRequest_Struct)); TradeRequest_Struct* acc = (TradeRequest_Struct*)outapp->pBuffer; acc->from_mob_id = msg->to_mob_id; acc->to_mob_id = msg->from_mob_id; @@ -13677,7 +13705,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) { // This is when a potential purchaser right clicks on this client who is in Trader mode to // browse their goods. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TraderShop, sizeof(TraderClick_Struct)); + auto outapp = new EQApplicationPacket(OP_TraderShop, sizeof(TraderClick_Struct)); TraderClick_Struct* outtcs = (TraderClick_Struct*)outapp->pBuffer; @@ -13955,7 +13983,7 @@ void Client::Handle_OP_VetClaimRequest(const EQApplicationPacket *app) return; } // try to claim something! - EQApplicationPacket *vetapp = new EQApplicationPacket(OP_VetClaimReply, sizeof(VeteranClaim)); + auto vetapp = new EQApplicationPacket(OP_VetClaimReply, sizeof(VeteranClaim)); VeteranClaim *cr = (VeteranClaim *)vetapp->pBuffer; strcpy(cr->name, GetName()); cr->claim_id = vcr->claim_id; @@ -14279,7 +14307,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) void Client::Handle_OP_YellForHelp(const EQApplicationPacket *app) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_YellForHelp, 4); + auto outapp = new EQApplicationPacket(OP_YellForHelp, 4); *(uint32 *)outapp->pBuffer = GetID(); entity_list.QueueCloseClients(this, outapp, true, 100.0); safe_delete(outapp); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index e5fd2ec99..984a66240 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -726,7 +726,7 @@ void Client::OnDisconnect(bool hard_disconnect) { /* Remove ourself from all proximities */ ClearAllProximities(); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogoutReply); + auto outapp = new EQApplicationPacket(OP_LogoutReply); FastQueuePacket(&outapp); Disconnect(); @@ -817,7 +817,7 @@ void Client::BulkSendInventoryItems() last_pos = ob.tellp(); } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_CharInventory); + auto outapp = new EQApplicationPacket(OP_CharInventory); outapp->size = ob.size(); outapp->pBuffer = ob.detach(); QueuePacket(outapp); @@ -1131,7 +1131,7 @@ void Client::BreakInvis() { if (invisible) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x03; @@ -1444,7 +1444,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app) trade->sp, trade->cp ); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeCoins,sizeof(TradeCoin_Struct)); + auto outapp = new EQApplicationPacket(OP_TradeCoins, sizeof(TradeCoin_Struct)); TradeCoin_Struct* tcs = (TradeCoin_Struct*)outapp->pBuffer; tcs->trader = trader->GetID(); tcs->slot = mc->cointype2; @@ -1513,7 +1513,7 @@ void Client::OPGMTraining(const EQApplicationPacket *app) void Client::OPGMEndTraining(const EQApplicationPacket *app) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GMEndTrainingResponse, 0); + auto outapp = new EQApplicationPacket(OP_GMEndTrainingResponse, 0); GMTrainEnd_Struct *p = (GMTrainEnd_Struct *)app->pBuffer; FastQueuePacket(&outapp); @@ -1675,7 +1675,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) // The following packet decreases the skill points left in the Training Window and // produces the 'You have increased your skill / learned the basics of' message. // - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMTrainSkillConfirm, sizeof(GMTrainSkillConfirm_Struct)); + auto outapp = new EQApplicationPacket(OP_GMTrainSkillConfirm, sizeof(GMTrainSkillConfirm_Struct)); GMTrainSkillConfirm_Struct *gmtsc = (GMTrainSkillConfirm_Struct *)outapp->pBuffer; gmtsc->SkillID = gmskill->skill_id; @@ -1733,7 +1733,7 @@ void Client::OPGMSummon(const EQApplicationPacket *app) } else if (tmp < '0' || tmp > '9') // dont send to world if it's not a player's name { - ServerPacket* pack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct)); + auto pack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct)); ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) pack->pBuffer; strcpy(szp->adminname, this->GetName()); szp->adminrank = this->Admin(); @@ -1775,7 +1775,7 @@ void Client::DoStaminaUpdate() { if(!stamina_timer.Check()) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct)); + auto outapp = new EQApplicationPacket(OP_Stamina, sizeof(Stamina_Struct)); Stamina_Struct* sta = (Stamina_Struct*)outapp->pBuffer; if(zone->GetZoneID() != 151) { @@ -2001,7 +2001,8 @@ void Client::HandleRespawnFromHover(uint32 Option) m_Position.z = corpse->GetZ(); } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 10); + auto outapp = + new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 10); ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer; gmg->bind_zone_id = zone->GetZoneID(); @@ -2033,7 +2034,8 @@ void Client::HandleRespawnFromHover(uint32 Option) { PendingRezzSpellID = 0; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + chosen->name.length() + 1); + auto outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + + chosen->name.length() + 1); ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer; gmg->bind_zone_id = zone->GetZoneID(); @@ -2100,7 +2102,7 @@ void Client::ClearHover() // Our Entity ID is currently zero, set in Client::Death SetID(entity_list.GetFreeID()); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ZoneEntry, sizeof(ServerZoneEntry_Struct)); + auto outapp = new EQApplicationPacket(OP_ZoneEntry, sizeof(ServerZoneEntry_Struct)); ServerZoneEntry_Struct* sze = (ServerZoneEntry_Struct*)outapp->pBuffer; FillSpawnStruct(&sze->player,CastToMob()); @@ -2152,7 +2154,7 @@ void Client::HandleLFGuildResponse(ServerPacket *pack) --i; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, PacketSize); + auto outapp = new EQApplicationPacket(OP_LFGuild, PacketSize); outapp->WriteUInt32(3); outapp->WriteUInt32(0xeb63); // Don't know the significance of this value. outapp->WriteUInt32(NumberOfMatches); @@ -2180,7 +2182,7 @@ void Client::HandleLFGuildResponse(ServerPacket *pack) } case QSG_LFGuild_RequestPlayerInfo: { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, sizeof(LFGuild_PlayerToggle_Struct)); + auto outapp = new EQApplicationPacket(OP_LFGuild, sizeof(LFGuild_PlayerToggle_Struct)); LFGuild_PlayerToggle_Struct *pts = (LFGuild_PlayerToggle_Struct *)outapp->pBuffer; pts->Command = 0; @@ -2210,7 +2212,7 @@ void Client::HandleLFGuildResponse(ServerPacket *pack) --i; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, PacketSize); + auto outapp = new EQApplicationPacket(OP_LFGuild, PacketSize); outapp->WriteUInt32(4); outapp->WriteUInt32(0xeb63); outapp->WriteUInt32(NumberOfMatches); @@ -2244,7 +2246,7 @@ void Client::HandleLFGuildResponse(ServerPacket *pack) TimeZone = pack->ReadUInt32(); TimePosted = pack->ReadUInt32(); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, sizeof(LFGuild_GuildToggle_Struct)); + auto outapp = new EQApplicationPacket(OP_LFGuild, sizeof(LFGuild_GuildToggle_Struct)); LFGuild_GuildToggle_Struct *gts = (LFGuild_GuildToggle_Struct *)outapp->pBuffer; gts->Command = 1; @@ -2271,7 +2273,7 @@ void Client::HandleLFGuildResponse(ServerPacket *pack) void Client::SendLFGuildStatus() { - ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + 17); + auto pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + 17); pack->WriteUInt32(zone->GetZoneID()); pack->WriteUInt32(zone->GetInstanceID()); @@ -2286,7 +2288,8 @@ void Client::SendLFGuildStatus() void Client::SendGuildLFGuildStatus() { - ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + +strlen(guild_mgr.GetGuildName(GuildID())) + 18); + auto pack = new ServerPacket(ServerOP_QueryServGeneric, + strlen(GetName()) + +strlen(guild_mgr.GetGuildName(GuildID())) + 18); pack->WriteUInt32(zone->GetZoneID()); pack->WriteUInt32(zone->GetInstanceID()); diff --git a/zone/command.cpp b/zone/command.cpp index 2d341ef7d..dd2b8941e 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -426,8 +426,8 @@ int command_init(void) database.GetCommandSettings(command_settings); std::map working_cl = commandlist; - for (std::map::iterator iter_cl = working_cl.begin(); iter_cl != working_cl.end(); ++iter_cl) { - std::map>>::iterator iter_cs = command_settings.find(iter_cl->first); + for (auto iter_cl = working_cl.begin(); iter_cl != working_cl.end(); ++iter_cl) { + auto iter_cs = command_settings.find(iter_cl->first); if (iter_cs == command_settings.end()) { if (iter_cl->second->access == 0) Log.Out(Logs::General, Logs::Commands, "command_init(): Warning: Command '%s' defaulting to access level 0!", iter_cl->first.c_str()); @@ -439,7 +439,8 @@ int command_init(void) if (iter_cs->second.second.empty()) continue; - for (std::vector::iterator iter_aka = iter_cs->second.second.begin(); iter_aka != iter_cs->second.second.end(); ++iter_aka) { + for (auto iter_aka = iter_cs->second.second.begin(); iter_aka != iter_cs->second.second.end(); + ++iter_aka) { if (iter_aka->empty()) continue; if (commandlist.find(*iter_aka) != commandlist.end()) { @@ -501,14 +502,14 @@ int command_add(std::string command_name, const char *desc, int access, CmdFuncP Log.Out(Logs::General, Logs::Error, "command_add() - Command '%s' is a duplicate command name - check command.cpp.", command_name.c_str()); return -1; } - for (std::map::iterator iter = commandlist.begin(); iter != commandlist.end(); ++iter) { + for (auto iter = commandlist.begin(); iter != commandlist.end(); ++iter) { if (iter->second->function != function) continue; Log.Out(Logs::General, Logs::Error, "command_add() - Command '%s' equates to an alias of '%s' - check command.cpp.", command_name.c_str(), iter->first.c_str()); return -1; } - CommandRecord *c = new CommandRecord; + auto c = new CommandRecord; c->access = access; c->desc = desc; c->function = function; @@ -995,7 +996,7 @@ void command_summon(Client *c, const Seperator *sep) //c->Message(0, "Summoning player from another zone not yet implemented."); //return; - ServerPacket* pack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct)); + auto pack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct)); ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) pack->pBuffer; strcpy(szp->adminname, c->GetName()); szp->adminrank = c->Admin(); @@ -1390,7 +1391,7 @@ void command_timezone(Client *c, const Seperator *sep) database.SetZoneTZ(zone->GetZoneID(), zone->GetInstanceVersion(), ntz); // Update all clients with new TZ. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); + auto outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); TimeOfDay_Struct* tod = (TimeOfDay_Struct*)outapp->pBuffer; zone->zone_time.GetCurrentEQTimeOfDay(time(0), tod); entity_list.QueueClients(c, outapp); @@ -1503,7 +1504,7 @@ void command_zclip(Client *c, const Seperator *sep) zone->newzone_data.fog_maxclip[0]=atof(sep->arg[5]); if(sep->arg[6][0]!=0) zone->newzone_data.fog_maxclip[1]=atof(sep->arg[6]); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); + auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size); entity_list.QueueClients(c, outapp); safe_delete(outapp); @@ -1617,7 +1618,7 @@ void command_weather(Client *c, const Seperator *sep) if(sep->arg[2][0] != 0 && sep->arg[3][0] != 0) { c->Message(0, "Sending weather packet... TYPE=%s, INTENSITY=%s", sep->arg[2], sep->arg[3]); zone->zone_weather = atoi(sep->arg[2]); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weather, 8); + auto outapp = new EQApplicationPacket(OP_Weather, 8); outapp->pBuffer[0] = atoi(sep->arg[2]); outapp->pBuffer[4] = atoi(sep->arg[3]); // This number changes in the packets, intensity? entity_list.QueueClients(c, outapp); @@ -1630,7 +1631,7 @@ void command_weather(Client *c, const Seperator *sep) else if(sep->arg[1][0] == '2') { entity_list.Message(0, 0, "Snowflakes begin to fall from the sky."); zone->zone_weather = 2; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weather, 8); + auto outapp = new EQApplicationPacket(OP_Weather, 8); outapp->pBuffer[0] = 0x01; outapp->pBuffer[4] = 0x02; // This number changes in the packets, intensity? entity_list.QueueClients(c, outapp); @@ -1639,7 +1640,7 @@ void command_weather(Client *c, const Seperator *sep) else if(sep->arg[1][0] == '1') { entity_list.Message(0, 0, "Raindrops begin to fall from the sky."); zone->zone_weather = 1; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weather, 8); + auto outapp = new EQApplicationPacket(OP_Weather, 8); outapp->pBuffer[4] = 0x01; // This is how it's done in Fear, and you can see a decent distance with it at this value entity_list.QueueClients(c, outapp); safe_delete(outapp); @@ -1649,7 +1650,7 @@ void command_weather(Client *c, const Seperator *sep) if(zone->zone_weather == 1) { // Doing this because if you have rain/snow on, you can only turn one off. entity_list.Message(0, 0, "The sky clears as the rain ceases to fall."); zone->zone_weather = 0; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weather, 8); + auto outapp = new EQApplicationPacket(OP_Weather, 8); // To shutoff weather you send an empty 8 byte packet (You get this everytime you zone even if the sky is clear) entity_list.QueueClients(c, outapp); safe_delete(outapp); @@ -1657,7 +1658,7 @@ void command_weather(Client *c, const Seperator *sep) else if(zone->zone_weather == 2) { entity_list.Message(0, 0, "The sky clears as the snow stops falling."); zone->zone_weather = 0; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weather, 8); + auto outapp = new EQApplicationPacket(OP_Weather, 8); // To shutoff weather you send an empty 8 byte packet (You get this everytime you zone even if the sky is clear) outapp->pBuffer[0] = 0x01; // Snow has it's own shutoff packet entity_list.QueueClients(c, outapp); @@ -1666,7 +1667,7 @@ void command_weather(Client *c, const Seperator *sep) else { entity_list.Message(0, 0, "The sky clears."); zone->zone_weather = 0; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weather, 8); + auto outapp = new EQApplicationPacket(OP_Weather, 8); // To shutoff weather you send an empty 8 byte packet (You get this everytime you zone even if the sky is clear) entity_list.QueueClients(c, outapp); safe_delete(outapp); @@ -1688,7 +1689,7 @@ void command_zheader(Client *c, const Seperator *sep) c->Message(0, "Successfully loaded zone header for %s from database.", sep->argplus[1]); else c->Message(0, "Failed to load zone header %s from database", sep->argplus[1]); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); + auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size); entity_list.QueueClients(c, outapp); safe_delete(outapp); @@ -1704,7 +1705,7 @@ void command_zsky(Client *c, const Seperator *sep) c->Message(0, "ERROR: Sky type can not be less than 0 or greater than 255!"); else { zone->newzone_data.sky = atoi(sep->arg[1]); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); + auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size); entity_list.QueueClients(c, outapp); safe_delete(outapp); @@ -1728,7 +1729,7 @@ void command_zcolor(Client *c, const Seperator *sep) zone->newzone_data.fog_green[z] = atoi(sep->arg[2]); zone->newzone_data.fog_blue[z] = atoi(sep->arg[3]); } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); + auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size); entity_list.QueueClients(c, outapp); safe_delete(outapp); @@ -1742,7 +1743,7 @@ void command_spon(Client *c, const Seperator *sep) void command_spoff(Client *c, const Seperator *sep) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ManaChange, 0); + auto outapp = new EQApplicationPacket(OP_ManaChange, 0); outapp->priority = 5; c->QueuePacket(outapp); safe_delete(outapp); @@ -1761,7 +1762,7 @@ void command_itemtest(Client *c, const Seperator *sep) fread(chBuffer, sizeof(chBuffer), sizeof(char), f); fclose(f); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ItemLinkResponse, strlen(chBuffer)+5); + auto outapp = new EQApplicationPacket(OP_ItemLinkResponse, strlen(chBuffer) + 5); memcpy(&outapp->pBuffer[4], chBuffer, strlen(chBuffer)); c->QueuePacket(outapp); safe_delete(outapp); @@ -1884,7 +1885,7 @@ void command_worldshutdown(Client *c, const Seperator *sep) if(sep->IsNumber(1) && sep->IsNumber(2) && ((time=atoi(sep->arg[1]))>0) && ((interval=atoi(sep->arg[2]))>0)) { worldserver.SendEmoteMessage(0,0,15,":SYSTEM MSG:World coming down in %i minutes, everyone log out before this time.", (time / 60 )); c->Message(0, "Sending shutdown packet now, World will shutdown in: %i minutes with an interval of: %i seconds", (time / 60), interval); - ServerPacket* pack = new ServerPacket(ServerOP_ShutdownAll,sizeof(WorldShutDown_Struct)); + auto pack = new ServerPacket(ServerOP_ShutdownAll, sizeof(WorldShutDown_Struct)); WorldShutDown_Struct* wsd = (WorldShutDown_Struct*)pack->pBuffer; wsd->time=time*1000; wsd->interval=(interval*1000); @@ -1894,7 +1895,7 @@ void command_worldshutdown(Client *c, const Seperator *sep) else if(strcasecmp(sep->arg[1], "now") == 0){ worldserver.SendEmoteMessage(0,0,15,":SYSTEM MSG:World coming down, everyone log out now."); c->Message(0, "Sending shutdown packet"); - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_ShutdownAll; pack->size=0; worldserver.SendPacket(pack); @@ -1902,7 +1903,7 @@ void command_worldshutdown(Client *c, const Seperator *sep) } else if(strcasecmp(sep->arg[1], "disable") == 0){ c->Message(0, "Shutdown prevented, next time I may not be so forgiving..."); - ServerPacket* pack = new ServerPacket(ServerOP_ShutdownAll,sizeof(WorldShutDown_Struct)); + auto pack = new ServerPacket(ServerOP_ShutdownAll, sizeof(WorldShutDown_Struct)); WorldShutDown_Struct* wsd = (WorldShutDown_Struct*)pack->pBuffer; wsd->time=0; wsd->interval=0; @@ -1991,7 +1992,7 @@ void command_setlsinfo(Client *c, const Seperator *sep) if(sep->argnum != 2) c->Message(0, "Format: #setlsinfo email password"); else { - ServerPacket* pack = new ServerPacket(ServerOP_LSAccountUpdate, sizeof(ServerLSAccountUpdate_Struct)); + auto pack = new ServerPacket(ServerOP_LSAccountUpdate, sizeof(ServerLSAccountUpdate_Struct)); ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer; s->useraccountid = c->LSAccountID(); strn0cpy(s->useraccount, c->AccountName(), 30); @@ -2040,7 +2041,8 @@ void command_wp(Client *c, const Seperator *sep) void command_iplookup(Client *c, const Seperator *sep) { - ServerPacket* pack = new ServerPacket(ServerOP_IPLookup, sizeof(ServerGenericWorldQuery_Struct) + strlen(sep->argplus[1]) + 1); + auto pack = + new ServerPacket(ServerOP_IPLookup, sizeof(ServerGenericWorldQuery_Struct) + strlen(sep->argplus[1]) + 1); ServerGenericWorldQuery_Struct* s = (ServerGenericWorldQuery_Struct *) pack->pBuffer; strcpy(s->from, c->GetName()); s->admin = c->Admin(); @@ -2453,7 +2455,7 @@ void command_npctypespawn(Client *c, const Seperator *sep) const NPCType* tmp = 0; if ((tmp = database.LoadNPCTypesData(atoi(sep->arg[1])))) { //tmp->fixedZ = 1; - NPC* npc = new NPC(tmp, 0, c->GetPosition(), FlyMode3); + auto npc = new NPC(tmp, 0, c->GetPosition(), FlyMode3); if (npc && sep->IsNumber(2)) npc->SetNPCFactionID(atoi(sep->arg[2])); @@ -2900,12 +2902,13 @@ void command_findzone(Client *c, const Seperator *sep) std::string query; int id = atoi((const char *)sep->arg[1]); if (id == 0) { // If id evaluates to 0, then search as if user entered a string. - char *escName = new char[strlen(sep->arg[1]) * 2 + 1]; - database.DoEscapeString(escName, sep->arg[1], strlen(sep->arg[1])); + auto escName = new char[strlen(sep->arg[1]) * 2 + 1]; + database.DoEscapeString(escName, sep->arg[1], strlen(sep->arg[1])); - query = StringFormat("SELECT zoneidnumber, short_name, long_name FROM zone " - "WHERE long_name RLIKE '%s' AND version = 0", escName); - safe_delete_array(escName); + query = StringFormat("SELECT zoneidnumber, short_name, long_name FROM zone " + "WHERE long_name RLIKE '%s' AND version = 0", + escName); + safe_delete_array(escName); } else // Otherwise, look for just that zoneidnumber. query = StringFormat("SELECT zoneidnumber, short_name, long_name FROM zone " @@ -2983,7 +2986,7 @@ void command_reloadqst(Client *c, const Seperator *sep) void command_reloadworld(Client *c, const Seperator *sep) { c->Message(0, "Reloading quest cache and repopping zones worldwide."); - ServerPacket* pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct)); + auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct)); ReloadWorld_Struct* RW = (ReloadWorld_Struct*) pack->pBuffer; RW->Option = ((atoi(sep->arg[1]) == 1) ? 1 : 0); worldserver.SendPacket(pack); @@ -3016,7 +3019,7 @@ void command_zoneshutdown(Client *c, const Seperator *sep) else if (sep->arg[1][0] == 0) c->Message(0, "Usage: #zoneshutdown zoneshortname"); else { - ServerPacket* pack = new ServerPacket(ServerOP_ZoneShutdown, sizeof(ServerZoneStateChange_struct)); + auto pack = new ServerPacket(ServerOP_ZoneShutdown, sizeof(ServerZoneStateChange_struct)); ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; strcpy(s->adminname, c->GetName()); if (sep->arg[1][0] >= '0' && sep->arg[1][0] <= '9') @@ -3036,7 +3039,7 @@ void command_zonebootup(Client *c, const Seperator *sep) c->Message(0, "Usage: #zonebootup ZoneServerID# zoneshortname"); } else { - ServerPacket* pack = new ServerPacket(ServerOP_ZoneBootup, sizeof(ServerZoneStateChange_struct)); + auto pack = new ServerPacket(ServerOP_ZoneBootup, sizeof(ServerZoneStateChange_struct)); ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; s->ZoneServerID = atoi(sep->arg[1]); strcpy(s->adminname, c->GetName()); @@ -3056,7 +3059,7 @@ void command_kick(Client *c, const Seperator *sep) if (client != 0) { if (client->Admin() <= c->Admin()) { client->Message(0, "You have been kicked by %s", c->GetName()); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMKick,0); + auto outapp = new EQApplicationPacket(OP_GMKick, 0); client->QueuePacket(outapp); client->Kick(); c->Message(0, "Kick: local: kicking %s", sep->arg[1]); @@ -3065,7 +3068,7 @@ void command_kick(Client *c, const Seperator *sep) else if (!worldserver.Connected()) c->Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); + auto pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer; strcpy(skp->adminname, c->GetName()); strcpy(skp->name, sep->arg[1]); @@ -3091,7 +3094,7 @@ void command_attack(Client *c, const Seperator *sep) void command_lock(Client *c, const Seperator *sep) { - ServerPacket* outpack = new ServerPacket(ServerOP_Lock, sizeof(ServerLock_Struct)); + auto outpack = new ServerPacket(ServerOP_Lock, sizeof(ServerLock_Struct)); ServerLock_Struct* lss = (ServerLock_Struct*) outpack->pBuffer; strcpy(lss->myname, c->GetName()); lss->mode = 1; @@ -3101,7 +3104,7 @@ void command_lock(Client *c, const Seperator *sep) void command_unlock(Client *c, const Seperator *sep) { - ServerPacket* outpack = new ServerPacket(ServerOP_Lock, sizeof(ServerLock_Struct)); + auto outpack = new ServerPacket(ServerOP_Lock, sizeof(ServerLock_Struct)); ServerLock_Struct* lss = (ServerLock_Struct*) outpack->pBuffer; strcpy(lss->myname, c->GetName()); lss->mode = 0; @@ -3111,7 +3114,7 @@ void command_unlock(Client *c, const Seperator *sep) void command_motd(Client *c, const Seperator *sep) { - ServerPacket* outpack = new ServerPacket(ServerOP_Motd, sizeof(ServerMotd_Struct)); + auto outpack = new ServerPacket(ServerOP_Motd, sizeof(ServerMotd_Struct)); ServerMotd_Struct* mss = (ServerMotd_Struct*) outpack->pBuffer; strn0cpy(mss->myname, c->GetName(),64); strn0cpy(mss->motd, sep->argplus[1],512); @@ -3147,7 +3150,7 @@ void command_equipitem(Client *c, const Seperator *sep) int16 movecount; if (from_inst && from_inst->IsClassCommon()) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveItem, sizeof(MoveItem_Struct)); + auto outapp = new EQApplicationPacket(OP_MoveItem, sizeof(MoveItem_Struct)); MoveItem_Struct* mi = (MoveItem_Struct*)outapp->pBuffer; mi->from_slot = EQEmu::legacy::SlotCursor; mi->to_slot = slot_id; @@ -3215,7 +3218,7 @@ void command_equipitem(Client *c, const Seperator *sep) void command_zonelock(Client *c, const Seperator *sep) { - ServerPacket* pack = new ServerPacket(ServerOP_LockZone, sizeof(ServerLockZone_Struct)); + auto pack = new ServerPacket(ServerOP_LockZone, sizeof(ServerLockZone_Struct)); ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer; strn0cpy(s->adminname, c->GetName(), sizeof(s->adminname)); if (strcasecmp(sep->arg[1], "list") == 0) { @@ -3994,7 +3997,7 @@ void command_zuwcoords(Client *c, const Seperator *sep) zone->newzone_data.underworld = atof(sep->arg[1]); //float newdata = atof(sep->arg[1]); //memcpy(&zone->zone_header_data[130], &newdata, sizeof(float)); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); + auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size); entity_list.QueueClients(c, outapp); safe_delete(outapp); @@ -4026,7 +4029,7 @@ void command_zsafecoords(Client *c, const Seperator *sep) //memcpy(&zone->zone_header_data[118], &newdatay, sizeof(float)); //memcpy(&zone->zone_header_data[122], &newdataz, sizeof(float)); //zone->SetSafeCoords(); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); + auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size); entity_list.QueueClients(c, outapp); safe_delete(outapp); @@ -4385,7 +4388,7 @@ void command_uptime(Client *c, const Seperator *sep) c->Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct)); + auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct)); ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; strcpy(sus->adminname, c->GetName()); if (sep->IsNumber(1) && atoi(sep->arg[1]) > 0) @@ -4425,7 +4428,7 @@ void command_flag(Client *c, const Seperator *sep) c->Message(0, "Unable to set GM Flag."); else { c->Message(0, "Set GM Flag on account."); - ServerPacket* pack = new ServerPacket(ServerOP_FlagUpdate, 6); + auto pack = new ServerPacket(ServerOP_FlagUpdate, 6); *((uint32*) pack->pBuffer) = database.GetAccountIDByName(sep->argplus[2]); *((int16*) &pack->pBuffer[4]) = atoi(sep->arg[1]); worldserver.SendPacket(pack); @@ -4888,7 +4891,7 @@ void command_zonestatus(Client *c, const Seperator *sep) if (!worldserver.Connected()) c->Message(0, "Error: World server disconnected"); else { - ServerPacket* pack = new ServerPacket(ServerOP_ZoneStatus, strlen(c->GetName())+2); + auto pack = new ServerPacket(ServerOP_ZoneStatus, strlen(c->GetName()) + 2); memset(pack->pBuffer, (uint8) c->Admin(), 1); strcpy((char *) &pack->pBuffer[1], c->GetName()); worldserver.SendPacket(pack); @@ -4961,14 +4964,14 @@ void command_findaliases(Client *c, const Seperator *sep) c->Message(0, "Usage: #findaliases [alias | command]"); return; } - - std::map::iterator find_iter = commandaliases.find(sep->arg[1]); + + auto find_iter = commandaliases.find(sep->arg[1]); if (find_iter == commandaliases.end()) { c->Message(15, "No commands or aliases match '%s'", sep->arg[1]); return; } - std::map::iterator command_iter = commandlist.find(find_iter->second); + auto command_iter = commandlist.find(find_iter->second); if (find_iter->second.empty() || command_iter == commandlist.end()) { c->Message(0, "An unknown condition occurred..."); return; @@ -4977,7 +4980,7 @@ void command_findaliases(Client *c, const Seperator *sep) c->Message(0, "Available command aliases for '%s':", command_iter->first.c_str()); int commandaliasesshown = 0; - for (std::map::iterator alias_iter = commandaliases.begin(); alias_iter != commandaliases.end(); ++alias_iter) { + for (auto alias_iter = commandaliases.begin(); alias_iter != commandaliases.end(); ++alias_iter) { if (strcasecmp(find_iter->second.c_str(), alias_iter->second.c_str()) || c->Admin() < command_iter->second->access) continue; @@ -5845,7 +5848,7 @@ void command_suspend(Client *c, const Seperator *sep) } } - char *escName = new char[strlen(sep->arg[1]) * 2 + 1]; + auto escName = new char[strlen(sep->arg[1]) * 2 + 1]; database.DoEscapeString(escName, sep->arg[1], strlen(sep->arg[1])); int accountID = database.GetAccountIDByChar(escName); safe_delete_array(escName); @@ -5872,16 +5875,16 @@ void command_suspend(Client *c, const Seperator *sep) return; } - ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); - ServerKickPlayer_Struct* sks = (ServerKickPlayer_Struct*) pack->pBuffer; + auto pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); + ServerKickPlayer_Struct *sks = (ServerKickPlayer_Struct *)pack->pBuffer; - strn0cpy(sks->adminname, c->GetName(), sizeof(sks->adminname)); - strn0cpy(sks->name, sep->arg[1], sizeof(sks->name)); - sks->adminrank = c->Admin(); + strn0cpy(sks->adminname, c->GetName(), sizeof(sks->adminname)); + strn0cpy(sks->name, sep->arg[1], sizeof(sks->name)); + sks->adminrank = c->Admin(); - worldserver.SendPacket(pack); + worldserver.SendPacket(pack); - safe_delete(pack); + safe_delete(pack); } void command_ipban(Client *c, const Seperator *sep) @@ -5926,13 +5929,13 @@ void command_revoke(Client *c, const Seperator *sep) c->Message(13, "#revoke: Couldn't find %s in this zone, passing request to worldserver.", sep->arg[1]); - ServerPacket * outapp = new ServerPacket (ServerOP_Revoke,sizeof(RevokeStruct)); - RevokeStruct* revoke = (RevokeStruct*)outapp->pBuffer; - strn0cpy(revoke->adminname, c->GetName(), 64); - strn0cpy(revoke->name, sep->arg[1], 64); - revoke->toggle = flag; - worldserver.SendPacket(outapp); - safe_delete(outapp); + auto outapp = new ServerPacket(ServerOP_Revoke, sizeof(RevokeStruct)); + RevokeStruct *revoke = (RevokeStruct *)outapp->pBuffer; + strn0cpy(revoke->adminname, c->GetName(), 64); + strn0cpy(revoke->name, sep->arg[1], 64); + revoke->toggle = flag; + worldserver.SendPacket(outapp); + safe_delete(outapp); } void command_oocmute(Client *c, const Seperator *sep) @@ -5940,10 +5943,10 @@ void command_oocmute(Client *c, const Seperator *sep) if(sep->arg[1][0] == 0 || !(sep->arg[1][0] == '1' || sep->arg[1][0] == '0')) c->Message(0, "Usage: #oocmute [1/0]"); else { - ServerPacket * outapp = new ServerPacket (ServerOP_OOCMute,1); - *(outapp->pBuffer)=atoi(sep->arg[1]); - worldserver.SendPacket(outapp); - safe_delete(outapp); + auto outapp = new ServerPacket(ServerOP_OOCMute, 1); + *(outapp->pBuffer) = atoi(sep->arg[1]); + worldserver.SendPacket(outapp); + safe_delete(outapp); } } @@ -7773,7 +7776,7 @@ void command_task(Client *c, const Seperator *sep) { } void command_reloadtitles(Client *c, const Seperator *sep) { - ServerPacket* pack = new ServerPacket(ServerOP_ReloadTitles, 0); + auto pack = new ServerPacket(ServerOP_ReloadTitles, 0); worldserver.SendPacket(pack); safe_delete(pack); c->Message(15, "Player Titles Reloaded."); @@ -9862,7 +9865,7 @@ void command_globalview(Client *c, const Seperator *sep) QGlobalCache::Combine(globalMap, zone_c->GetBucket(), ntype, c->CharacterID(), zone->GetZoneID()); } - std::list::iterator iter = globalMap.begin(); + auto iter = globalMap.begin(); uint32 gcount = 0; c->Message(0, "Name, Value"); @@ -9895,7 +9898,7 @@ void command_globalview(Client *c, const Seperator *sep) QGlobalCache::Combine(globalMap, zone_c->GetBucket(), ntype, c->CharacterID(), zone->GetZoneID()); } - std::list::iterator iter = globalMap.begin(); + auto iter = globalMap.begin(); uint32 gcount = 0; c->Message(0, "Name, Value"); @@ -9921,7 +9924,8 @@ void command_cvs(Client *c, const Seperator *sep) { if(c) { - ServerPacket *pack = new ServerPacket(ServerOP_ClientVersionSummary, sizeof(ServerRequestClientVersionSummary_Struct)); + auto pack = + new ServerPacket(ServerOP_ClientVersionSummary, sizeof(ServerRequestClientVersionSummary_Struct)); ServerRequestClientVersionSummary_Struct *srcvss = (ServerRequestClientVersionSummary_Struct*)pack->pBuffer; @@ -9981,7 +9985,7 @@ void command_reloadallrules(Client *c, const Seperator *sep) { if(c) { - ServerPacket *pack = new ServerPacket(ServerOP_ReloadRules, 0); + auto pack = new ServerPacket(ServerOP_ReloadRules, 0); worldserver.SendPacket(pack); c->Message(13, "Successfully sent the packet to world to reload rules globally. (including world)"); safe_delete(pack); @@ -9993,7 +9997,7 @@ void command_reloadworldrules(Client *c, const Seperator *sep) { if(c) { - ServerPacket *pack = new ServerPacket(ServerOP_ReloadRulesWorld, 0); + auto pack = new ServerPacket(ServerOP_ReloadRulesWorld, 0); worldserver.SendPacket(pack); c->Message(13, "Successfully sent the packet to world to reload rules. (only world)"); safe_delete(pack); @@ -10006,7 +10010,7 @@ void command_camerashake(Client *c, const Seperator *sep) { if(sep->arg[1][0] && sep->arg[2][0]) { - ServerPacket *pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct)); + auto pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct)); ServerCameraShake_Struct* scss = (ServerCameraShake_Struct*) pack->pBuffer; scss->duration = atoi(sep->arg[1]); scss->intensity = atoi(sep->arg[2]); @@ -10261,10 +10265,10 @@ void command_augmentitem(Client *c, const Seperator *sep) if (!c) return; - AugmentItem_Struct* in_augment = new AugmentItem_Struct[sizeof(AugmentItem_Struct)]; - in_augment->container_slot = 1000; // - in_augment->augment_slot = -1; - if(c->GetTradeskillObject() != nullptr) + auto in_augment = new AugmentItem_Struct[sizeof(AugmentItem_Struct)]; + in_augment->container_slot = 1000; // + in_augment->augment_slot = -1; + if (c->GetTradeskillObject() != nullptr) Object::HandleAugmentation(c, in_augment, c->GetTradeskillObject()); safe_delete_array(in_augment); } @@ -10629,7 +10633,7 @@ void command_logs(Client *c, const Seperator *sep){ if (sep->argnum > 0) { /* #logs reload_all */ if (strcasecmp(sep->arg[1], "reload_all") == 0){ - ServerPacket *pack = new ServerPacket(ServerOP_ReloadLogs, 0); + auto pack = new ServerPacket(ServerOP_ReloadLogs, 0); worldserver.SendPacket(pack); c->Message(13, "Successfully sent the packet to world to reload log settings from the database for all zones"); safe_delete(pack); @@ -10827,7 +10831,7 @@ void command_reloadperlexportsettings(Client *c, const Seperator *sep) { if (c) { - ServerPacket *pack = new ServerPacket(ServerOP_ReloadPerlExportSettings, 0); + auto pack = new ServerPacket(ServerOP_ReloadPerlExportSettings, 0); worldserver.SendPacket(pack); c->Message(13, "Successfully sent the packet to world to reload Perl Export settings"); safe_delete(pack); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index ff8243003..bb88e305b 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -58,13 +58,13 @@ extern WorldServer worldserver; extern npcDecayTimes_Struct npcCorpseDecayTimes[100]; void Corpse::SendEndLootErrorPacket(Client* client) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LootComplete, 0); + auto outapp = new EQApplicationPacket(OP_LootComplete, 0); client->QueuePacket(outapp); safe_delete(outapp); } void Corpse::SendLootReqErrorPacket(Client* client, uint8 response) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct)); + auto outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct)); moneyOnCorpseStruct* d = (moneyOnCorpseStruct*) outapp->pBuffer; d->response = response; d->unknown1 = 0x5a; @@ -75,7 +75,8 @@ void Corpse::SendLootReqErrorPacket(Client* client, uint8 response) { Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std::string in_charname, const glm::vec4& position, std::string time_of_death, bool rezzed, bool was_at_graveyard) { uint32 item_count = database.GetCharacterCorpseItemCount(in_dbid); - char *buffer = new char[sizeof(PlayerCorpse_Struct) + (item_count * sizeof(player_lootitem::ServerLootItem_Struct))]; + auto buffer = + new char[sizeof(PlayerCorpse_Struct) + (item_count * sizeof(player_lootitem::ServerLootItem_Struct))]; PlayerCorpse_Struct *pcs = (PlayerCorpse_Struct*)buffer; database.LoadCharacterCorpseData(in_dbid, pcs); @@ -89,27 +90,26 @@ Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std: } /* Create Corpse Entity */ - Corpse* pc = new Corpse( - in_dbid, // uint32 in_dbid - in_charid, // uint32 in_charid - in_charname.c_str(), // char* in_charname - &itemlist, // ItemList* in_itemlist - pcs->copper, // uint32 in_copper - pcs->silver, // uint32 in_silver - pcs->gold, // uint32 in_gold - pcs->plat, // uint32 in_plat - position, - pcs->size, // float in_size - pcs->gender, // uint8 in_gender - pcs->race, // uint16 in_race - pcs->class_, // uint8 in_class - pcs->deity, // uint8 in_deity - pcs->level, // uint8 in_level - pcs->texture, // uint8 in_texture - pcs->helmtexture, // uint8 in_helmtexture - pcs->exp, // uint32 in_rezexp - was_at_graveyard // bool wasAtGraveyard - ); + auto pc = new Corpse(in_dbid, // uint32 in_dbid + in_charid, // uint32 in_charid + in_charname.c_str(), // char* in_charname + &itemlist, // ItemList* in_itemlist + pcs->copper, // uint32 in_copper + pcs->silver, // uint32 in_silver + pcs->gold, // uint32 in_gold + pcs->plat, // uint32 in_plat + position, + pcs->size, // float in_size + pcs->gender, // uint8 in_gender + pcs->race, // uint16 in_race + pcs->class_, // uint8 in_class + pcs->deity, // uint8 in_deity + pcs->level, // uint8 in_level + pcs->texture, // uint8 in_texture + pcs->helmtexture, // uint8 in_helmtexture + pcs->exp, // uint32 in_rezexp + was_at_graveyard // bool wasAtGraveyard + ); if (pcs->locked) pc->Lock(); @@ -658,7 +658,7 @@ void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, ui is_corpse_changed = true; - ServerLootItem_Struct* item = new ServerLootItem_Struct; + auto item = new ServerLootItem_Struct; memset(item, 0, sizeof(ServerLootItem_Struct)); item->item_id = itemnum; @@ -798,7 +798,7 @@ bool Corpse::Process() { database.SendCharacterCorpseToGraveyard(corpse_db_id, zone->graveyard_zoneid(), (zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, zone->GetGraveyardPoint()); corpse_graveyard_timer.Disable(); - ServerPacket* pack = new ServerPacket(ServerOP_SpawnPlayerCorpse, sizeof(SpawnPlayerCorpse_Struct)); + auto pack = new ServerPacket(ServerOP_SpawnPlayerCorpse, sizeof(SpawnPlayerCorpse_Struct)); SpawnPlayerCorpse_Struct* spc = (SpawnPlayerCorpse_Struct*)pack->pBuffer; spc->player_corpse_id = corpse_db_id; spc->zone_id = zone->graveyard_zoneid(); @@ -942,7 +942,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a if(Loot_Request_Type >= 2 || (Loot_Request_Type == 1 && client->Admin() >= 100 && client->GetGM())) { this->being_looted_by = client->GetID(); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct)); + auto outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct)); moneyOnCorpseStruct* d = (moneyOnCorpseStruct*) outapp->pBuffer; d->response = 1; @@ -1260,7 +1260,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { } void Corpse::EndLoot(Client* client, const EQApplicationPacket* app) { - EQApplicationPacket* outapp = new EQApplicationPacket; + auto outapp = new EQApplicationPacket; outapp->SetOpcode(OP_LootComplete); outapp->size = 0; client->QueuePacket(outapp); @@ -1390,7 +1390,7 @@ void Corpse::CompleteResurrection(){ } void Corpse::Spawn() { - EQApplicationPacket* app = new EQApplicationPacket; + auto app = new EQApplicationPacket; this->CreateSpawnPacket(app, this); entity_list.QueueClients(this, app); safe_delete(app); diff --git a/zone/doors.cpp b/zone/doors.cpp index b70da219e..c80b749f9 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -115,7 +115,7 @@ bool Doors::Process() { if (opentype == 40 || GetTriggerType() == 1) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); + auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; md->doorid = door_id; md->action = invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR; @@ -137,7 +137,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) Log.Out(Logs::Detail, Logs::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); Log.Out(Logs::Detail, Logs::Doors, " size %d, invert %d, dest: %s %s", size, invert_state, dest_zone, to_string(m_Destination).c_str()); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); + auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; md->doorid = door_id; ///////////////////////////////////////////////////////////////// @@ -170,7 +170,8 @@ void Doors::HandleClick(Client* sender, uint8 trigger) if(!sender->GetPendingAdventureDoorClick()) { sender->PendingAdventureDoorClick(); - ServerPacket *pack = new ServerPacket(ServerOP_AdventureClickDoor, sizeof(ServerPlayerClickedAdventureDoor_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureClickDoor, + sizeof(ServerPlayerClickedAdventureDoor_Struct)); ServerPlayerClickedAdventureDoor_Struct *ads = (ServerPlayerClickedAdventureDoor_Struct*)pack->pBuffer; strcpy(ads->player, sender->GetName()); ads->zone_id = zone->GetZoneID(); @@ -447,7 +448,7 @@ void Doors::NPCOpen(NPC* sender, bool alt_mode) return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); + auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md=(MoveDoor_Struct*)outapp->pBuffer; md->doorid = door_id; md->action = invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR; @@ -473,7 +474,7 @@ void Doors::NPCOpen(NPC* sender, bool alt_mode) void Doors::ForceOpen(Mob *sender, bool alt_mode) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); + auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md=(MoveDoor_Struct*)outapp->pBuffer; md->doorid = door_id; md->action = invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR; @@ -498,7 +499,7 @@ void Doors::ForceOpen(Mob *sender, bool alt_mode) void Doors::ForceClose(Mob *sender, bool alt_mode) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); + auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md=(MoveDoor_Struct*)outapp->pBuffer; md->doorid = door_id; md->action = invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR; // change from original (open to close) @@ -527,7 +528,7 @@ void Doors::ToggleState(Mob *sender) return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); + auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md=(MoveDoor_Struct*)outapp->pBuffer; md->doorid = door_id; diff --git a/zone/effects.cpp b/zone/effects.cpp index 69b5c0819..ad9de822c 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -703,7 +703,7 @@ void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration) { if (timer_id < MAX_DISCIPLINE_TIMERS) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); + auto outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; dts->TimerID = timer_id; dts->Duration = duration; diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 3607bbe05..37be828ae 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -972,7 +972,7 @@ void PerlembParser::ExportQGlobals(bool isPlayerQuest, bool isGlobalPlayerQuest, QGlobalCache::Combine(globalMap, zone_c->GetBucket(), npcmob->GetNPCTypeID(), char_id, zone->GetZoneID()); } - std::list::iterator iter = globalMap.begin(); + auto iter = globalMap.begin(); while(iter != globalMap.end()) { globhash[(*iter).name] = (*iter).value; @@ -1020,7 +1020,7 @@ void PerlembParser::ExportQGlobals(bool isPlayerQuest, bool isGlobalPlayerQuest, QGlobalCache::Combine(globalMap, zone_c->GetBucket(), 0, char_id, zone->GetZoneID()); } - std::list::iterator iter = globalMap.begin(); + auto iter = globalMap.begin(); while(iter != globalMap.end()) { globhash[(*iter).name] = (*iter).value; diff --git a/zone/embperl.cpp b/zone/embperl.cpp index e86a3e187..d881cad5e 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -280,8 +280,7 @@ int Embperl::dosub(const char * subname, const std::vector * args, PUSHMARK(SP); if(args && !args->empty()) { - for(std::vector::const_iterator i = args->begin(); i != args->end(); ++i) - { + for (auto i = args->begin(); i != args->end(); ++i) { XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length()))); } } diff --git a/zone/entity.cpp b/zone/entity.cpp index bdf59d8b0..f788b06c2 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -650,14 +650,14 @@ void EntityList::AddNPC(NPC *npc, bool SendSpawnPacket, bool dontqueue) npc->SetSpawned(); if (SendSpawnPacket) { if (dontqueue) { // aka, SEND IT NOW BITCH! - EQApplicationPacket *app = new EQApplicationPacket; + auto app = new EQApplicationPacket; npc->CreateSpawnPacket(app, npc); QueueClients(npc, app); npc->SendArmorAppearance(); npc->SetAppearance(npc->GetGuardPointAnim(),false); safe_delete(app); } else { - NewSpawn_Struct *ns = new NewSpawn_Struct; + auto ns = new NewSpawn_Struct; memset(ns, 0, sizeof(NewSpawn_Struct)); npc->FillSpawnStruct(ns, nullptr); // Not working on player newspawns, so it's safe to use a ForWho of 0 AddToSpawnQueue(npc->GetID(), &ns); @@ -691,14 +691,14 @@ void EntityList::AddMerc(Merc *merc, bool SendSpawnPacket, bool dontqueue) { if (dontqueue) { // Send immediately - EQApplicationPacket *outapp = new EQApplicationPacket(); + auto outapp = new EQApplicationPacket(); merc->CreateSpawnPacket(outapp); outapp->priority = 6; QueueClients(merc, outapp, true); safe_delete(outapp); } else { // Queue the packet - NewSpawn_Struct *ns = new NewSpawn_Struct; + auto ns = new NewSpawn_Struct; memset(ns, 0, sizeof(NewSpawn_Struct)); merc->FillSpawnStruct(ns, 0); AddToSpawnQueue(merc->GetID(), &ns); @@ -882,7 +882,7 @@ bool EntityList::MakeDoorSpawnPacket(EQApplicationPacket *app, Client *client) return false; uint32 length = count * sizeof(Door_Struct); - uchar *packet_buffer = new uchar[length]; + auto packet_buffer = new uchar[length]; memset(packet_buffer, 0, length); uchar *ptr = packet_buffer; Doors *door; @@ -1226,7 +1226,7 @@ void EntityList::SendZoneSpawnsBulk(Client *client) if (maxspawns > mob_list.size()) maxspawns = mob_list.size(); - BulkZoneSpawnPacket *bzsp = new BulkZoneSpawnPacket(client, maxspawns); + auto bzsp = new BulkZoneSpawnPacket(client, maxspawns); int32 race=-1; for (auto it = mob_list.begin(); it != mob_list.end(); ++it) { @@ -1291,7 +1291,7 @@ void EntityList::SendZoneCorpsesBulk(Client *client) Corpse *spawn; uint32 maxspawns = 100; - BulkZoneSpawnPacket *bzsp = new BulkZoneSpawnPacket(client, maxspawns); + auto bzsp = new BulkZoneSpawnPacket(client, maxspawns); for (auto it = corpse_list.begin(); it != corpse_list.end(); ++it) { spawn = it->second; @@ -1308,7 +1308,7 @@ void EntityList::SendZoneObjects(Client *client) { auto it = object_list.begin(); while (it != object_list.end()) { - EQApplicationPacket *app = new EQApplicationPacket; + auto app = new EQApplicationPacket; it->second->CreateSpawnPacket(app); client->FastQueuePacket(&app); ++it; @@ -1949,7 +1949,7 @@ void EntityList::QueueClientsGuild(Mob *sender, const EQApplicationPacket *app, void EntityList::QueueClientsGuildBankItemUpdate(const GuildBankItemUpdate_Struct *gbius, uint32 GuildID) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct)); GuildBankItemUpdate_Struct *outgbius = (GuildBankItemUpdate_Struct*)outapp->pBuffer; @@ -2132,7 +2132,7 @@ void EntityList::RemoveAllDoors() void EntityList::DespawnAllDoors() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RemoveAllDoors, 0); + auto outapp = new EQApplicationPacket(OP_RemoveAllDoors, 0); this->QueueClients(0,outapp); safe_delete(outapp); } @@ -2142,7 +2142,7 @@ void EntityList::RespawnAllDoors() auto it = client_list.begin(); while (it != client_list.end()) { if (it->second) { - EQApplicationPacket *outapp = new EQApplicationPacket(); + auto outapp = new EQApplicationPacket(); MakeDoorSpawnPacket(outapp, it->second); it->second->FastQueuePacket(&outapp); } @@ -2631,7 +2631,7 @@ void EntityList::ListNPCs(Client* client, const char *arg1, const char *arg2, ui } } else if (searchtype == 1) { client->Message(0, "Searching by name method. (%s)",arg1); - char* tmp = new char[strlen(arg1) + 1]; + auto tmp = new char[strlen(arg1) + 1]; strcpy(tmp, arg1); strupr(tmp); while (it != npc_list.end()) { @@ -2746,7 +2746,7 @@ int32 EntityList::DeletePlayerCorpses() void EntityList::SendPetitionToAdmins() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PetitionUpdate,sizeof(PetitionUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); PetitionUpdate_Struct *pcus = (PetitionUpdate_Struct*) outapp->pBuffer; pcus->petnumber = 0; // Petition Number pcus->color = 0; @@ -2766,7 +2766,7 @@ void EntityList::SendPetitionToAdmins() void EntityList::SendPetitionToAdmins(Petition *pet) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PetitionUpdate,sizeof(PetitionUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); PetitionUpdate_Struct *pcus = (PetitionUpdate_Struct*) outapp->pBuffer; pcus->petnumber = pet->GetID(); // Petition Number if (pet->CheckedOut()) { @@ -2799,7 +2799,7 @@ void EntityList::SendPetitionToAdmins(Petition *pet) void EntityList::ClearClientPetitionQueue() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PetitionUpdate,sizeof(PetitionUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); PetitionUpdate_Struct *pet = (PetitionUpdate_Struct*) outapp->pBuffer; pet->color = 0x00; pet->status = 0xFFFFFFFF; @@ -2867,7 +2867,7 @@ void BulkZoneSpawnPacket::SendBuffer() return; uint32 tmpBufSize = (index * sizeof(NewSpawn_Struct)); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZoneSpawns, (unsigned char *)data, tmpBufSize); + auto outapp = new EQApplicationPacket(OP_ZoneSpawns, (unsigned char *)data, tmpBufSize); if (pSendTo) { pSendTo->FastQueuePacket(&outapp); @@ -3034,7 +3034,7 @@ bool EntityList::MakeTrackPacket(Client *client) [](const std::pair &a, const std::pair &b) { return a.first->GetSpawnTimeStamp() > b.first->GetSpawnTimeStamp(); }); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_Track, sizeof(Track_Struct) * tracking_list.size()); + auto outapp = new EQApplicationPacket(OP_Track, sizeof(Track_Struct) * tracking_list.size()); Tracking_Struct *outtrack = (Tracking_Struct *)outapp->pBuffer; outapp->priority = 6; @@ -3686,7 +3686,7 @@ void EntityList::QuestJournalledSayClose(Mob *sender, Client *QuestInitiator, // Send the message to the quest initiator such that the client will enter it into the NPC Quest Journal if (QuestInitiator) { - char *buf = new char[strlen(mobname) + strlen(message) + 10]; + auto buf = new char[strlen(mobname) + strlen(message) + 10]; sprintf(buf, "%s says, '%s'", mobname, message); QuestInitiator->QuestJournalledMessage(mobname, buf); safe_delete_array(buf); @@ -3756,7 +3756,7 @@ void EntityList::SendGroupLeave(uint32 gid, const char *name) g = c->GetGroup(); if (g) { if (g->GetID() == gid) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer; strcpy(gj->membername, name); gj->action = groupActLeave; @@ -3785,7 +3785,7 @@ void EntityList::SendGroupJoin(uint32 gid, const char *name) g = it->second->GetGroup(); if (g) { if (g->GetID() == gid) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer; strcpy(gj->membername, name); gj->action = groupActJoin; @@ -3825,11 +3825,11 @@ uint16 EntityList::CreateGroundObject(uint32 itemid, const glm::vec4& position, if (!is) return 0; - ItemInst *i = new ItemInst(is, is->MaxCharges); + auto i = new ItemInst(is, is->MaxCharges); if (!i) return 0; - Object *object = new Object(i, position.x, position.y, position.z, position.w,decay_time); + auto object = new Object(i, position.x, position.y, position.z, position.w, decay_time); entity_list.AddObject(object, true); safe_delete(i); @@ -3844,7 +3844,7 @@ uint16 EntityList::CreateGroundObjectFromModel(const char *model, const glm::vec if (!model) return 0; - Object *object = new Object(model, position.x, position.y, position.z, position.w, type); + auto object = new Object(model, position.x, position.y, position.z, position.w, type); entity_list.AddObject(object, true); if (!object) @@ -3858,7 +3858,7 @@ uint16 EntityList::CreateDoor(const char *model, const glm::vec4& position, uint if (!model) return 0; // fell through everything, this is bad/incomplete from perl - Doors *door = new Doors(model, position, opentype, size); + auto door = new Doors(model, position, opentype, size); RemoveAllDoors(); zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion()); entity_list.AddDoor(door); @@ -4033,7 +4033,7 @@ void EntityList::ZoneWho(Client *c, Who_All_Struct *Who) } PacketLength = PacketLength + sizeof(WhoAllReturnStruct) + (47 * Entries); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_WhoAllResponse, PacketLength); + auto outapp = new EQApplicationPacket(OP_WhoAllResponse, PacketLength); char *Buffer = (char *)outapp->pBuffer; WhoAllReturnStruct *WARS = (WhoAllReturnStruct *)Buffer; WARS->id = 0; @@ -4219,7 +4219,7 @@ uint16 EntityList::GetClientCount(){ uint16 ClientCount = 0; std::list client_list; entity_list.GetClientList(client_list); - std::list::iterator iter = client_list.begin(); + auto iter = client_list.begin(); while (iter != client_list.end()) { Client *entry = (*iter); entry->GetCleanName(); @@ -4353,7 +4353,7 @@ void EntityList::SendFindableNPCList(Client *c) if (!c) return; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendFindableNPCs, sizeof(FindableNPC_Struct)); + auto outapp = new EQApplicationPacket(OP_SendFindableNPCs, sizeof(FindableNPC_Struct)); FindableNPC_Struct *fnpcs = (FindableNPC_Struct *)outapp->pBuffer; @@ -4388,7 +4388,7 @@ void EntityList::UpdateFindableNPCState(NPC *n, bool Remove) if (!n || !n->IsFindable()) return; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendFindableNPCs, sizeof(FindableNPC_Struct)); + auto outapp = new EQApplicationPacket(OP_SendFindableNPCs, sizeof(FindableNPC_Struct)); FindableNPC_Struct *fnpcs = (FindableNPC_Struct *)outapp->pBuffer; @@ -4479,9 +4479,9 @@ void EntityList::AddLootToNPCS(uint32 item_id, uint32 count) if (npc_count == 0) return; - NPC **npcs = new NPC*[npc_count]; - int *counts = new int[npc_count]; - bool *marked = new bool[npc_count]; + auto npcs = new NPC *[npc_count]; + auto counts = new int[npc_count]; + auto marked = new bool[npc_count]; memset(counts, 0, sizeof(int) * npc_count); memset(marked, 0, sizeof(bool) * npc_count); @@ -4523,7 +4523,7 @@ void EntityList::AddLootToNPCS(uint32 item_id, uint32 count) void EntityList::CameraEffect(uint32 duration, uint32 intensity) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_CameraEffect, sizeof(Camera_Struct)); + auto outapp = new EQApplicationPacket(OP_CameraEffect, sizeof(Camera_Struct)); Camera_Struct* cs = (Camera_Struct*) outapp->pBuffer; cs->duration = duration; // Duration in milliseconds cs->intensity = ((intensity * 6710886) + 1023410176); // Intensity ranges from 1023410176 to 1090519040, so simplify it from 0 to 10. @@ -4557,7 +4557,7 @@ NPC *EntityList::GetClosestBanker(Mob *sender, uint32 &distance) void EntityList::ExpeditionWarning(uint32 minutes_left) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_DzExpeditionEndsWarning, sizeof(ExpeditionExpireWarning)); + auto outapp = new EQApplicationPacket(OP_DzExpeditionEndsWarning, sizeof(ExpeditionExpireWarning)); ExpeditionExpireWarning *ew = (ExpeditionExpireWarning*)outapp->pBuffer; ew->minutes_remaining = minutes_left; diff --git a/zone/exp.cpp b/zone/exp.cpp index 2e231cc36..93c689b7c 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -522,7 +522,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { uint32 tmpxp2 = GetEXPForLevel(GetLevel()); // Quag: crash bug fix... Divide by zero when tmpxp1 and 2 equalled each other, most likely the error case from GetEXPForLevel() (invalid class, etc) if (tmpxp1 != tmpxp2 && tmpxp1 != 0xFFFFFFFF && tmpxp2 != 0xFFFFFFFF) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ExpUpdate, sizeof(ExpUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_ExpUpdate, sizeof(ExpUpdate_Struct)); ExpUpdate_Struct* eu = (ExpUpdate_Struct*)outapp->pBuffer; float tmpxp = (float) ( (float) set_exp-tmpxp2 ) / ( (float) tmpxp1-tmpxp2 ); eu->exp = (uint32)(330.0f * tmpxp); @@ -545,7 +545,7 @@ void Client::SetLevel(uint8 set_level, bool command) return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct)); LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer; lu->level = set_level; if(m_pp.level2 != 0) @@ -838,7 +838,7 @@ void Client::AddLeadershipEXP(uint32 group_exp, uint32 raid_exp) { } void Client::SendLeadershipEXPUpdate() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LeadershipExpUpdate, sizeof(LeadershipExpUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_LeadershipExpUpdate, sizeof(LeadershipExpUpdate_Struct)); LeadershipExpUpdate_Struct* eu = (LeadershipExpUpdate_Struct *) outapp->pBuffer; eu->group_leadership_exp = m_pp.group_leadership_exp; @@ -860,7 +860,7 @@ uint32 Client::GetCharMaxLevelFromQGlobal() { QGlobalCache::Combine(globalMap, char_c->GetBucket(), ntype, this->CharacterID(), zone->GetZoneID()); } - std::list::iterator iter = globalMap.begin(); + auto iter = globalMap.begin(); uint32 gcount = 0; while(iter != globalMap.end()) { if((*iter).name.compare("CharMaxLevel") == 0){ diff --git a/zone/forage.cpp b/zone/forage.cpp index 991947f8d..be3e0a3b3 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -283,14 +283,14 @@ void Client::GoFish() if(tmp != nullptr) { auto positionNPC = GetPosition(); positionNPC.x = positionNPC.x + 3; - NPC* npc = new NPC(tmp, nullptr, positionNPC, FlyMode3); - npc->AddLootTable(); + auto npc = new NPC(tmp, nullptr, positionNPC, FlyMode3); + npc->AddLootTable(); - npc->AddToHateList(this, 1, 0, false); //no help yelling + npc->AddToHateList(this, 1, 0, false); // no help yelling - entity_list.AddNPC(npc); + entity_list.AddNPC(npc); - Message(MT_Emote, "You fish up a little more than you bargained for..."); + Message(MT_Emote, "You fish up a little more than you bargained for..."); } } } diff --git a/zone/groups.cpp b/zone/groups.cpp index 6ce658922..2162e735e 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -272,7 +272,7 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte int x=1; //build the template join packet - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer; strcpy(gj->membername, NewMemberName); gj->action = groupActJoin; @@ -534,7 +534,7 @@ void Group::SendGroupJoinOOZ(Mob* NewMember) { } //send updates to clients out of zone... - ServerPacket* pack = new ServerPacket(ServerOP_GroupJoin, sizeof(ServerGroupJoin_Struct)); + auto pack = new ServerPacket(ServerOP_GroupJoin, sizeof(ServerGroupJoin_Struct)); ServerGroupJoin_Struct* gj = (ServerGroupJoin_Struct*)pack->pBuffer; gj->gid = GetID(); gj->zoneid = zone->GetZoneID(); @@ -634,7 +634,7 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender) return true; } - ServerPacket* pack = new ServerPacket(ServerOP_GroupLeave, sizeof(ServerGroupLeave_Struct)); + auto pack = new ServerPacket(ServerOP_GroupLeave, sizeof(ServerGroupLeave_Struct)); ServerGroupLeave_Struct* gl = (ServerGroupLeave_Struct*)pack->pBuffer; gl->gid = GetID(); gl->zoneid = zone->GetZoneID(); @@ -643,7 +643,7 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender) worldserver.SendPacket(pack); safe_delete(pack); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* gu = (GroupJoin_Struct*) outapp->pBuffer; gu->action = groupActLeave; strcpy(gu->membername, oldmember->GetCleanName()); @@ -847,7 +847,8 @@ void Group::GroupMessage(Mob* sender, uint8 language, uint8 lang_skill, const ch members[i]->CastToClient()->ChannelMessageSend(sender->GetName(),members[i]->GetName(),2,language,lang_skill,message); } - ServerPacket* pack = new ServerPacket(ServerOP_OOZGroupMessage, sizeof(ServerGroupChannelMessage_Struct) + strlen(message) + 1); + auto pack = + new ServerPacket(ServerOP_OOZGroupMessage, sizeof(ServerGroupChannelMessage_Struct) + strlen(message) + 1); ServerGroupChannelMessage_Struct* gcm = (ServerGroupChannelMessage_Struct*)pack->pBuffer; gcm->zoneid = zone->GetZoneID(); gcm->groupid = GetID(); @@ -872,7 +873,7 @@ uint32 Group::GetTotalGroupDamage(Mob* other) { } void Group::DisbandGroup() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate_Struct)); GroupUpdate_Struct* gu = (GroupUpdate_Struct*) outapp->pBuffer; gu->action = groupActDisband; @@ -916,7 +917,7 @@ void Group::DisbandGroup() { ClearAllNPCMarks(); - ServerPacket* pack = new ServerPacket(ServerOP_DisbandGroup, sizeof(ServerDisbandGroup_Struct)); + auto pack = new ServerPacket(ServerOP_DisbandGroup, sizeof(ServerDisbandGroup_Struct)); ServerDisbandGroup_Struct* dg = (ServerDisbandGroup_Struct*)pack->pBuffer; dg->zoneid = zone->GetZoneID(); dg->groupid = GetID(); @@ -987,7 +988,7 @@ void Group::SendUpdate(uint32 type, Mob* member) if(!member->IsClient()) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate2_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate2_Struct)); GroupUpdate2_Struct* gu = (GroupUpdate2_Struct*)outapp->pBuffer; gu->action = type; strcpy(gu->yourname,member->GetName()); @@ -1021,7 +1022,7 @@ void Group::SendLeadershipAAUpdate() // If a group member is not in the same zone as the leader when the leader purchases a new AA, they will not become // aware of it until they are next in the same zone as the leader. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer; gu->action = groupActAAUpdate; gu->leader_aas = LeaderAbilities; @@ -1428,7 +1429,7 @@ void Group::MarkNPC(Mob* Target, int Number) MarkedNPCs[Number - 1] = EntityID; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MarkNPC, sizeof(MarkNPC_Struct)); + auto outapp = new EQApplicationPacket(OP_MarkNPC, sizeof(MarkNPC_Struct)); MarkNPC_Struct* mnpcs = (MarkNPC_Struct *)outapp->pBuffer; @@ -1613,7 +1614,7 @@ void Group::NotifyMainTank(Client *c, uint8 toggle) } else { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupRoles, sizeof(GroupRole_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupRoles, sizeof(GroupRole_Struct)); GroupRole_Struct *grs = (GroupRole_Struct*)outapp->pBuffer; @@ -1646,7 +1647,7 @@ void Group::NotifyMainAssist(Client *c, uint8 toggle) if (c->ClientVersion() < EQEmu::versions::ClientVersion::SoD) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct)); + auto outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct)); DelegateAbility_Struct* das = (DelegateAbility_Struct*)outapp->pBuffer; @@ -1666,7 +1667,7 @@ void Group::NotifyMainAssist(Client *c, uint8 toggle) } else { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupRoles, sizeof(GroupRole_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupRoles, sizeof(GroupRole_Struct)); GroupRole_Struct *grs = (GroupRole_Struct*)outapp->pBuffer; @@ -1708,7 +1709,7 @@ void Group::NotifyPuller(Client *c, uint8 toggle) } else { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupRoles, sizeof(GroupRole_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupRoles, sizeof(GroupRole_Struct)); GroupRole_Struct *grs = (GroupRole_Struct*)outapp->pBuffer; @@ -1760,7 +1761,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) // informing them of the change and update the group_leaders table. // if(OldMainAssistName == MainAssistName) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct)); + auto outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct)); DelegateAbility_Struct* das = (DelegateAbility_Struct*)outapp->pBuffer; @@ -1918,7 +1919,7 @@ void Group::NotifyAssistTarget(Client *c) if(!c) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SetGroupTarget, sizeof(MarkNPC_Struct)); + auto outapp = new EQApplicationPacket(OP_SetGroupTarget, sizeof(MarkNPC_Struct)); MarkNPC_Struct* mnpcs = (MarkNPC_Struct *)outapp->pBuffer; @@ -1991,7 +1992,7 @@ void Group::NotifyMarkNPC(Client *c) if(!NPCMarkerName.size()) return; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct)); + auto outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct)); DelegateAbility_Struct* das = (DelegateAbility_Struct*)outapp->pBuffer; @@ -2033,7 +2034,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) if(!NPCMarkerName.size()) return; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct)); + auto outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct)); DelegateAbility_Struct* das = (DelegateAbility_Struct*)outapp->pBuffer; @@ -2067,8 +2068,8 @@ void Group::SaveGroupLeaderAA() { // Stores the Group Leaders Leadership AA data from the Player Profile as a blob in the group_leaders table. // This is done so that group members not in the same zone as the Leader still have access to this information. - char *queryBuffer = new char[sizeof(GroupLeadershipAA_Struct) * 2 + 1]; - database.DoEscapeString(queryBuffer, (char*)&LeaderAbilities, sizeof(GroupLeadershipAA_Struct)); + auto queryBuffer = new char[sizeof(GroupLeadershipAA_Struct) * 2 + 1]; + database.DoEscapeString(queryBuffer, (char *)&LeaderAbilities, sizeof(GroupLeadershipAA_Struct)); std::string query = "UPDATE group_leaders SET leadershipaa = '"; query += queryBuffer; @@ -2117,7 +2118,7 @@ void Group::SendMarkedNPCsToMember(Client *c, bool Clear) if(!c) return; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MarkNPC, sizeof(MarkNPC_Struct)); + auto outapp = new EQApplicationPacket(OP_MarkNPC, sizeof(MarkNPC_Struct)); MarkNPC_Struct *mnpcs = (MarkNPC_Struct *)outapp->pBuffer; @@ -2252,7 +2253,7 @@ void Group::ChangeLeader(Mob* newleader) Mob* oldleader = GetLeader(); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* gu = (GroupJoin_Struct*) outapp->pBuffer; gu->action = groupActMakeLeader; diff --git a/zone/guild.cpp b/zone/guild.cpp index ceaa40fd4..6cba3677a 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -26,7 +26,7 @@ extern WorldServer worldserver; void Client::SendGuildMOTD(bool GetGuildMOTDReply) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMOTD, sizeof(GuildMOTD_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildMOTD, sizeof(GuildMOTD_Struct)); // When the Client gets an OP_GuildMOTD, it compares the text to the version it has previously stored. // If the text in the OP_GuildMOTD packet is the same, it does nothing. If not the same, it displays @@ -68,7 +68,8 @@ void Client::SendGuildURL() if(IsInAGuild()) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildUpdateURLAndChannel, sizeof(GuildUpdateURLAndChannel_Struct)); + auto outapp = + new EQApplicationPacket(OP_GuildUpdateURLAndChannel, sizeof(GuildUpdateURLAndChannel_Struct)); GuildUpdateURLAndChannel_Struct *guuacs = (GuildUpdateURLAndChannel_Struct*) outapp->pBuffer; @@ -89,7 +90,8 @@ void Client::SendGuildChannel() if(IsInAGuild()) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildUpdateURLAndChannel, sizeof(GuildUpdateURLAndChannel_Struct)); + auto outapp = + new EQApplicationPacket(OP_GuildUpdateURLAndChannel, sizeof(GuildUpdateURLAndChannel_Struct)); GuildUpdateURLAndChannel_Struct *guuacs = (GuildUpdateURLAndChannel_Struct*) outapp->pBuffer; @@ -119,7 +121,8 @@ void Client::SendGuildRanks() { while(i < permissions) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildUpdateURLAndChannel, sizeof(GuildUpdateRanks_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildUpdateURLAndChannel, + sizeof(GuildUpdateRanks_Struct)); GuildUpdateRanks_Struct *guuacs = (GuildUpdateRanks_Struct*) outapp->pBuffer; //guuacs->Unknown0008 = this->GuildID(); strncpy(guuacs->Unknown0012, this->GetCleanName(), 64); @@ -187,7 +190,7 @@ void Client::SendGuildMembers() { if(data == nullptr) return; //invalid guild, shouldent happen. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GuildMemberList); + auto outapp = new EQApplicationPacket(OP_GuildMemberList); outapp->size = len; outapp->pBuffer = data; data = nullptr; @@ -196,7 +199,8 @@ void Client::SendGuildMembers() { FastQueuePacket(&outapp); - ServerPacket* pack = new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct)); + auto pack = + new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct)); ServerRequestOnlineGuildMembers_Struct *srogms = (ServerRequestOnlineGuildMembers_Struct*)pack->pBuffer; @@ -235,7 +239,7 @@ void Client::RefreshGuildInfo() { if(WasBanker != GuildBanker) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SetGuildRank, sizeof(GuildSetRank_Struct)); + auto outapp = new EQApplicationPacket(OP_SetGuildRank, sizeof(GuildSetRank_Struct)); GuildSetRank_Struct *gsrs = (GuildSetRank_Struct*)outapp->pBuffer; @@ -328,7 +332,7 @@ void EntityList::SendGuildList() { } void Client::SendGuildJoin(GuildJoin_Struct* gj){ - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GuildManageAdd, sizeof(GuildJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildManageAdd, sizeof(GuildJoin_Struct)); GuildJoin_Struct* outgj=(GuildJoin_Struct*)outapp->pBuffer; outgj->class_ = gj->class_; outgj->guild_id = gj->guild_id; diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index a801dc895..dfd022541 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -33,7 +33,7 @@ extern volatile bool is_zone_loaded; void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { Log.Out(Logs::Detail, Logs::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); - ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); + auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; s->name_change = name; @@ -58,7 +58,7 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin Log.Out(Logs::Detail, Logs::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); - ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); + auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; s->old_guild_id = old_guild_id; @@ -74,7 +74,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID) if(!GetCharInfo(CharID, gci)) return; - ServerPacket* pack = new ServerPacket(ServerOP_GuildRankUpdate, sizeof(ServerGuildRankUpdate_Struct)); + auto pack = new ServerPacket(ServerOP_GuildRankUpdate, sizeof(ServerGuildRankUpdate_Struct)); ServerGuildRankUpdate_Struct *sgrus = (ServerGuildRankUpdate_Struct*)pack->pBuffer; @@ -90,7 +90,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID) void ZoneGuildManager::SendGuildDelete(uint32 guild_id) { Log.Out(Logs::Detail, Logs::Guilds, "Sending guild delete for guild %d to world", guild_id); - ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); + auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; worldserver.SendPacket(pack); @@ -346,7 +346,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { ServerGuildRankUpdate_Struct *sgrus = (ServerGuildRankUpdate_Struct*)pack->pBuffer; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SetGuildRank, sizeof(GuildSetRank_Struct)); + auto outapp = new EQApplicationPacket(OP_SetGuildRank, sizeof(GuildSetRank_Struct)); GuildSetRank_Struct *gsrs = (GuildSetRank_Struct*)outapp->pBuffer; @@ -390,7 +390,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { if(is_zone_loaded) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer; @@ -421,7 +421,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { break; } Log.Out(Logs::Detail, Logs::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer; char Name[64]; gmus->LastSeen = time(nullptr); @@ -464,7 +464,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { if(GuildID == GUILD_NONE) break; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LFGuild, sizeof(LFGuild_GuildToggle_Struct)); + auto outapp = new EQApplicationPacket(OP_LFGuild, sizeof(LFGuild_GuildToggle_Struct)); LFGuild_GuildToggle_Struct *gts = (LFGuild_GuildToggle_Struct *)outapp->pBuffer; gts->Command = 1; @@ -487,7 +487,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { void ZoneGuildManager::SendGuildMemberUpdateToWorld(const char *MemberName, uint32 GuildID, uint16 ZoneID, uint32 LastSeen) { - ServerPacket* pack = new ServerPacket(ServerOP_GuildMemberUpdate, sizeof(ServerGuildMemberUpdate_Struct)); + auto pack = new ServerPacket(ServerOP_GuildMemberUpdate, sizeof(ServerGuildMemberUpdate_Struct)); ServerGuildMemberUpdate_Struct *sgmus = (ServerGuildMemberUpdate_Struct*)pack->pBuffer; sgmus->GuildID = GuildID; @@ -501,7 +501,8 @@ void ZoneGuildManager::SendGuildMemberUpdateToWorld(const char *MemberName, uint void ZoneGuildManager::RequestOnlineGuildMembers(uint32 FromID, uint32 GuildID) { - ServerPacket* pack = new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct)); + auto pack = + new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct)); ServerRequestOnlineGuildMembers_Struct *srogm = (ServerRequestOnlineGuildMembers_Struct*)pack->pBuffer; srogm->FromID = FromID; @@ -526,7 +527,7 @@ void ZoneGuildManager::ProcessApproval() void ZoneGuildManager::AddGuildApproval(const char* guildname,Client* owner) { - GuildApproval* tmp = new GuildApproval(guildname,owner,GetFreeID()); + auto tmp = new GuildApproval(guildname, owner, GetFreeID()); list.Insert(tmp); } @@ -586,7 +587,7 @@ GuildApproval* ZoneGuildManager::FindGuildByOwnerApproval(Client* owner) GuildBankManager::~GuildBankManager() { - std::list::iterator Iterator = Banks.begin(); + auto Iterator = Banks.begin(); while(Iterator != Banks.end()) { @@ -606,57 +607,56 @@ bool GuildBankManager::Load(uint32 guildID) return false; } - GuildBank *bank = new GuildBank; + auto bank = new GuildBank; - bank->GuildID = guildID; + bank->GuildID = guildID; - for(int i = 0; i < GUILD_BANK_MAIN_AREA_SIZE; ++i) - bank->Items.MainArea[i].ItemID = 0; + for (int i = 0; i < GUILD_BANK_MAIN_AREA_SIZE; ++i) + bank->Items.MainArea[i].ItemID = 0; - for(int i = 0; i < GUILD_BANK_DEPOSIT_AREA_SIZE; ++i) - bank->Items.DepositArea[i].ItemID = 0; + for (int i = 0; i < GUILD_BANK_DEPOSIT_AREA_SIZE; ++i) + bank->Items.DepositArea[i].ItemID = 0; - char donator[64], whoFor[64]; + char donator[64], whoFor[64]; - for (auto row = results.begin(); row != results.end(); ++row) - { - int area = atoi(row[0]); - int slot = atoi(row[1]); - int itemID = atoi(row[2]); - int qty = atoi(row[3]); + for (auto row = results.begin(); row != results.end(); ++row) { + int area = atoi(row[0]); + int slot = atoi(row[1]); + int itemID = atoi(row[2]); + int qty = atoi(row[3]); - if(row[4]) - strn0cpy(donator, row[4], sizeof(donator)); - else - donator[0] = '\0'; + if (row[4]) + strn0cpy(donator, row[4], sizeof(donator)); + else + donator[0] = '\0'; - int permissions = atoi(row[5]); + int permissions = atoi(row[5]); - if(row[6]) - strn0cpy(whoFor, row[6], sizeof(whoFor)); - else - whoFor[0] = '\0'; + if (row[6]) + strn0cpy(whoFor, row[6], sizeof(whoFor)); + else + whoFor[0] = '\0'; - if(slot < 0) - continue; + if (slot < 0) + continue; - GuildBankItem *itemSection = nullptr; + GuildBankItem *itemSection = nullptr; - if (area == GuildBankMainArea && slot < GUILD_BANK_MAIN_AREA_SIZE) - itemSection = bank->Items.MainArea; - else if (area != GuildBankMainArea && slot < GUILD_BANK_DEPOSIT_AREA_SIZE) - itemSection = bank->Items.DepositArea; - else - continue; + if (area == GuildBankMainArea && slot < GUILD_BANK_MAIN_AREA_SIZE) + itemSection = bank->Items.MainArea; + else if (area != GuildBankMainArea && slot < GUILD_BANK_DEPOSIT_AREA_SIZE) + itemSection = bank->Items.DepositArea; + else + continue; - itemSection[slot].ItemID = itemID; - itemSection[slot].Quantity = qty; + itemSection[slot].ItemID = itemID; + itemSection[slot].Quantity = qty; - strn0cpy(itemSection[slot].Donator, donator, sizeof(donator)); + strn0cpy(itemSection[slot].Donator, donator, sizeof(donator)); - itemSection[slot].Permissions = permissions; + itemSection[slot].Permissions = permissions; - strn0cpy(itemSection[slot].WhoFor, whoFor, sizeof(whoFor)); + strn0cpy(itemSection[slot].WhoFor, whoFor, sizeof(whoFor)); } Banks.push_back(bank); @@ -666,7 +666,7 @@ bool GuildBankManager::Load(uint32 guildID) bool GuildBankManager::IsLoaded(uint32 GuildID) { - std::list::iterator Iterator = GetGuildBank(GuildID); + auto Iterator = GetGuildBank(GuildID); return (Iterator != Banks.end()); } @@ -679,7 +679,7 @@ void GuildBankManager::SendGuildBank(Client *c) if(!IsLoaded(c->GuildID())) Load(c->GuildID()); - std::list::iterator Iterator = GetGuildBank(c->GuildID()); + auto Iterator = GetGuildBank(c->GuildID()); if(Iterator == Banks.end()) { @@ -754,7 +754,7 @@ void GuildBankManager::SendGuildBank(Client *c) if(!Item) continue; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct)); GuildBankItemUpdate_Struct *gbius = (GuildBankItemUpdate_Struct*)outapp->pBuffer; @@ -792,7 +792,7 @@ void GuildBankManager::SendGuildBank(Client *c) bool Useable = Item->IsEquipable(c->GetBaseRace(), c->GetBaseClass()); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankItemUpdate_Struct)); GuildBankItemUpdate_Struct *gbius = (GuildBankItemUpdate_Struct*)outapp->pBuffer; @@ -821,7 +821,7 @@ void GuildBankManager::SendGuildBank(Client *c) } bool GuildBankManager::IsAreaFull(uint32 GuildID, uint16 Area) { - std::list::iterator Iterator = GetGuildBank(GuildID); + auto Iterator = GetGuildBank(GuildID); if(Iterator == Banks.end()) return true; @@ -852,7 +852,7 @@ bool GuildBankManager::IsAreaFull(uint32 GuildID, uint16 Area) bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 QtyOrCharges, const char *Donator, uint8 Permissions, const char *WhoFor) { - std::list::iterator Iterator = GetGuildBank(GuildID); + auto Iterator = GetGuildBank(GuildID); if(Iterator == Banks.end()) { @@ -1064,7 +1064,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, uint32 Quantity) { - std::list::iterator Iterator = GetGuildBank(GuildID); + auto Iterator = GetGuildBank(GuildID); if(Iterator == Banks.end()) return nullptr; @@ -1114,7 +1114,7 @@ ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID, bool GuildBankManager::HasItem(uint32 GuildID, uint32 ItemID) { - std::list::iterator Iterator = GetGuildBank(GuildID); + auto Iterator = GetGuildBank(GuildID); if(Iterator == Banks.end()) return false; @@ -1132,7 +1132,7 @@ bool GuildBankManager::HasItem(uint32 GuildID, uint32 ItemID) std::list::iterator GuildBankManager::GetGuildBank(uint32 GuildID) { - std::list::iterator Iterator = Banks.begin(); + auto Iterator = Banks.begin(); while(Iterator != Banks.end()) { @@ -1220,7 +1220,7 @@ bool GuildBankManager::MergeStacks(uint32 GuildID, uint16 SlotID) if(SlotID > (GUILD_BANK_MAIN_AREA_SIZE - 1)) return false; - std::list::iterator Iterator = GetGuildBank(GuildID); + auto Iterator = GetGuildBank(GuildID); if(Iterator == Banks.end()) return false; @@ -1312,7 +1312,7 @@ bool GuildBankManager::SplitStack(uint32 GuildID, uint16 SlotID, uint32 Quantity if(SlotID > (GUILD_BANK_MAIN_AREA_SIZE - 1)) return false; - std::list::iterator Iterator = GetGuildBank(GuildID); + auto Iterator = GetGuildBank(GuildID); if(Iterator == Banks.end()) return false; @@ -1363,7 +1363,7 @@ bool GuildBankManager::AllowedToWithdraw(uint32 GuildID, uint16 Area, uint16 Slo if(SlotID > (GUILD_BANK_MAIN_AREA_SIZE - 1)) return false; - std::list::iterator Iterator = GetGuildBank(GuildID); + auto Iterator = GetGuildBank(GuildID); if(Iterator == Banks.end()) return false; @@ -1498,7 +1498,7 @@ void GuildApproval::GuildApproved() strncat(petitext,owner->CastToClient()->GetName(),len); strncat(petitext," Members:",len); strncat(petitext,gmembers,len); - Petition* pet = new Petition(owner->CastToClient()->CharacterID()); + auto pet = new Petition(owner->CastToClient()->CharacterID()); pet->SetAName(owner->CastToClient()->AccountName()); pet->SetClass(owner->CastToClient()->GetClass()); pet->SetLevel(owner->CastToClient()->GetLevel()); @@ -1514,7 +1514,7 @@ void GuildApproval::GuildApproved() petition_list.UpdateGMQueue(); petition_list.UpdateZoneListQueue(); worldserver.SendEmoteMessage(0, 0, 80, 15, "%s has made a petition. #%i", owner->CastToClient()->GetName(), pet->GetID()); - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_RefreshGuild; pack->size = tmp; pack->pBuffer = new uchar[pack->size]; diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 962cfb010..b98ca6923 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -599,7 +599,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range, Mob* ae_cent ++iterator; } - std::list::iterator iter = id_list.begin(); + auto iter = id_list.begin(); while (iter != id_list.end()) { Mob *cur = entity_list.GetMobID((*iter)); diff --git a/zone/horse.cpp b/zone/horse.cpp index 2cf76886b..a2cebcdc9 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -83,35 +83,35 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { auto row = results.begin(); - NPCType* npc_type = new NPCType; - memset(npc_type, 0, sizeof(NPCType)); - strcpy(npc_type->name,"Unclaimed_Mount"); //this should never get used + auto npc_type = new NPCType; + memset(npc_type, 0, sizeof(NPCType)); + strcpy(npc_type->name, "Unclaimed_Mount"); // this should never get used - strcpy(npc_type->special_abilities, "19,1^20,1^24,1"); - npc_type->cur_hp = 1; - npc_type->max_hp = 1; - npc_type->race = atoi(row[0]); - npc_type->gender = atoi(row[1]); // Drogmor's are female horses. Yuck. - npc_type->class_ = 1; - npc_type->deity= 1; - npc_type->level = 1; - npc_type->npc_id = 0; - npc_type->loottable_id = 0; - npc_type->texture = atoi(row[2]); // mount color - npc_type->helmtexture = atoi(row[2]); // mount color - npc_type->runspeed = atof(row[3]); + strcpy(npc_type->special_abilities, "19,1^20,1^24,1"); + npc_type->cur_hp = 1; + npc_type->max_hp = 1; + npc_type->race = atoi(row[0]); + npc_type->gender = atoi(row[1]); // Drogmor's are female horses. Yuck. + npc_type->class_ = 1; + npc_type->deity = 1; + npc_type->level = 1; + npc_type->npc_id = 0; + npc_type->loottable_id = 0; + npc_type->texture = atoi(row[2]); // mount color + npc_type->helmtexture = atoi(row[2]); // mount color + npc_type->runspeed = atof(row[3]); - npc_type->light = 0; - npc_type->STR = 75; - npc_type->STA = 75; - npc_type->DEX = 75; - npc_type->AGI = 75; - npc_type->INT = 75; - npc_type->WIS = 75; - npc_type->CHA = 75; - horses_auto_delete.Insert(npc_type); + npc_type->light = 0; + npc_type->STR = 75; + npc_type->STA = 75; + npc_type->DEX = 75; + npc_type->AGI = 75; + npc_type->INT = 75; + npc_type->WIS = 75; + npc_type->CHA = 75; + horses_auto_delete.Insert(npc_type); - return npc_type; + return npc_type; } void Client::SummonHorse(uint16 spell_id) { @@ -126,7 +126,7 @@ void Client::SummonHorse(uint16 spell_id) { // No Horse, lets get them one. - Horse* horse = new Horse(this, spell_id, GetPosition()); + auto horse = new Horse(this, spell_id, GetPosition()); //we want to manage the spawn packet ourself. //another reason is we dont want quests executing on it. diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 0ca5cc96e..29f4574e1 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -629,7 +629,7 @@ void Client::DropItem(int16 slot_id) return; // Package as zone object - Object* object = new Object(this, inst); + auto object = new Object(this, inst); entity_list.AddObject(object, true); object->StartDecay(); @@ -653,7 +653,7 @@ void Client::DropInst(const ItemInst* inst) } // Package as zone object - Object* object = new Object(this, inst); + auto object = new Object(this, inst); entity_list.AddObject(object, true); object->StartDecay(); } @@ -743,7 +743,9 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd if(m_inv[slot_id]) { delete_count += m_inv.GetItem(slot_id)->GetTotalItemCount(); } - ServerPacket* qspack = new ServerPacket(ServerOP_QSPlayerLogDeletes, sizeof(QSPlayerLogDelete_Struct) + (sizeof(QSDeleteItems_Struct) * delete_count)); + auto qspack = + new ServerPacket(ServerOP_QSPlayerLogDeletes, + sizeof(QSPlayerLogDelete_Struct) + (sizeof(QSDeleteItems_Struct) * delete_count)); QSPlayerLogDelete_Struct* qsaudit = (QSPlayerLogDelete_Struct*)qspack->pBuffer; uint16 parent_offset = 0; @@ -1283,7 +1285,7 @@ packet with the item number in it, but I cant seem to find it right now const EQEmu::Item_Struct* item = inst->GetItem(); const char* name2 = &item->Name[0]; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ItemLinkText,strlen(name2)+68); + auto outapp = new EQApplicationPacket(OP_ItemLinkText, strlen(name2) + 68); char buffer2[135] = {0}; char itemlink[135] = {0}; sprintf(itemlink,"%c0%06u0%05u-%05u-%05u-%05u-%05u00000000%c", @@ -1843,7 +1845,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { if(m_inv[resync_slot]) { SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade); } else { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_DeleteItem, sizeof(DeleteItem_Struct)); + auto outapp = new EQApplicationPacket(OP_DeleteItem, sizeof(DeleteItem_Struct)); DeleteItem_Struct* delete_slot = (DeleteItem_Struct*)outapp->pBuffer; delete_slot->from_slot = resync_slot; delete_slot->to_slot = 0xFFFFFFFF; @@ -1885,7 +1887,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { if(m_inv[resync_slot]) { SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade); } else { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_DeleteItem, sizeof(DeleteItem_Struct)); + auto outapp = new EQApplicationPacket(OP_DeleteItem, sizeof(DeleteItem_Struct)); DeleteItem_Struct* delete_slot = (DeleteItem_Struct*)outapp->pBuffer; delete_slot->from_slot = resync_slot; delete_slot->to_slot = 0xFFFFFFFF; @@ -1930,7 +1932,8 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { if(m_inv[from_slot_id]) { move_count += m_inv[from_slot_id]->GetTotalItemCount(); } if(to_slot_id != from_slot_id) { if(m_inv[to_slot_id]) { move_count += m_inv[to_slot_id]->GetTotalItemCount(); } } - ServerPacket* qspack = new ServerPacket(ServerOP_QSPlayerLogMoves, sizeof(QSPlayerLogMove_Struct) + (sizeof(QSMoveItems_Struct) * move_count)); + auto qspack = new ServerPacket(ServerOP_QSPlayerLogMoves, + sizeof(QSPlayerLogMove_Struct) + (sizeof(QSMoveItems_Struct) * move_count)); QSPlayerLogMove_Struct* qsaudit = (QSPlayerLogMove_Struct*)qspack->pBuffer; qsaudit->char_id = character_id; @@ -2046,7 +2049,7 @@ void Client::DyeArmor(DyeStruct* dye){ } } } - EQApplicationPacket* outapp=new EQApplicationPacket(OP_Dye,0); + auto outapp = new EQApplicationPacket(OP_Dye, 0); QueuePacket(outapp); safe_delete(outapp); @@ -3093,7 +3096,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool instmap[EQEmu::legacy::SlotPowerSource] = m_inv[EQEmu::legacy::SlotPowerSource]; // call InterrogateInventory_ for error check - for (std::map::iterator instmap_itr = instmap.begin(); (instmap_itr != instmap.end()) && (!error); ++instmap_itr) { + for (auto instmap_itr = instmap.begin(); (instmap_itr != instmap.end()) && (!error); ++instmap_itr) { InterrogateInventory_(true, requester, instmap_itr->first, INVALID_INDEX, instmap_itr->second, nullptr, log, silent, error, 0); } @@ -3108,7 +3111,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool } // call InterrogateInventory_ for report - for (std::map::iterator instmap_itr = instmap.begin(); (instmap_itr != instmap.end()); ++instmap_itr) { + for (auto instmap_itr = instmap.begin(); (instmap_itr != instmap.end()); ++instmap_itr) { InterrogateInventory_(false, requester, instmap_itr->first, INVALID_INDEX, instmap_itr->second, nullptr, log, silent, error, 0); } diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 1aab9eb51..65b21ff77 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -229,7 +229,7 @@ void NPC::AddLootDrop(const EQEmu::Item_Struct *item2, ItemList* itemlist, int16 if(!itemlist && !wearchange) return; - ServerLootItem_Struct* item = new ServerLootItem_Struct; + auto item = new ServerLootItem_Struct; #if EQDEBUG>=11 Log.Out(Logs::General, Logs::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); #endif diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 52eb2388f..320b084a0 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -46,7 +46,7 @@ void unregister_event(std::string package_name, std::string name, int evt); void load_encounter(std::string name) { if(lua_encounters_loaded.count(name) > 0) return; - Encounter *enc = new Encounter(name.c_str()); + auto enc = new Encounter(name.c_str()); entity_list.AddEncounter(enc); lua_encounters[name] = enc; lua_encounters_loaded[name] = true; @@ -56,7 +56,7 @@ void load_encounter(std::string name) { void load_encounter_with_data(std::string name, std::string info_str) { if(lua_encounters_loaded.count(name) > 0) return; - Encounter *enc = new Encounter(name.c_str()); + auto enc = new Encounter(name.c_str()); entity_list.AddEncounter(enc); lua_encounters[name] = enc; lua_encounters_loaded[name] = true; @@ -1216,8 +1216,8 @@ void lua_add_spawn_point(luabind::adl::object table) { lua_remove_spawn_point(spawn2_id); - Spawn2 *t = new Spawn2(spawn2_id, spawngroup_id, x, y, z, heading, respawn, variance, timeleft, grid, condition_id, - condition_min_value, enabled, static_cast(animation)); + auto t = new Spawn2(spawn2_id, spawngroup_id, x, y, z, heading, respawn, variance, timeleft, grid, + condition_id, condition_min_value, enabled, static_cast(animation)); zone->spawn2_list.Insert(t); } } @@ -1344,7 +1344,7 @@ void lua_create_npc(luabind::adl::object table, float x, float y, float z, float return; } - NPCType* npc_type = new NPCType; + auto npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); diff --git a/zone/map.cpp b/zone/map.cpp index c652d809c..5bfb3291b 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -233,7 +233,7 @@ Map *Map::LoadMapFile(std::string file) { filename += file; filename += ".map"; - Map *m = new Map(); + auto m = new Map(); if (m->Load(filename)) { return m; } diff --git a/zone/merc.cpp b/zone/merc.cpp index 369a8ef4f..51eac564d 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2150,7 +2150,8 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { std::list buffSpellList = GetMercSpellsBySpellType(this, SpellType_Buff); - for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); ++itr) { + for (auto itr = buffSpellList.begin(); + itr != buffSpellList.end(); ++itr) { MercSpell selectedMercSpell = *itr; if(!((spells[selectedMercSpell.spellid].targettype == ST_Target || spells[selectedMercSpell.spellid].targettype == ST_Pet || @@ -2309,7 +2310,8 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { std::list buffSpellList = GetMercSpellsBySpellType(this, SpellType_InCombatBuff); Mob* tar = this; - for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); ++itr) { + for (auto itr = buffSpellList.begin(); + itr != buffSpellList.end(); ++itr) { MercSpell selectedMercSpell = *itr; if(!(spells[selectedMercSpell.spellid].targettype == ST_Self)) { @@ -2454,7 +2456,7 @@ void Merc::CheckHateList() { std::list npc_list; entity_list.GetNPCList(npc_list); - for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { + for (auto itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; float dist = DistanceSquaredNoZ(m_Position, npc->GetPosition()); int radius = RuleI(Mercs, AggroRadius); @@ -2507,7 +2509,7 @@ bool Merc::CheckAENuke(Merc* caster, Mob* tar, uint16 spell_id, uint8 &numTarget std::list npc_list; entity_list.GetNPCList(npc_list); - for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { + for (auto itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; if(DistanceSquaredNoZ(npc->GetPosition(), tar->GetPosition()) <= spells[spell_id].aoerange * spells[spell_id].aoerange) { @@ -3066,7 +3068,8 @@ MercSpell Merc::GetBestMercSpellForVeryFastHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsVeryFastHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3098,7 +3101,8 @@ MercSpell Merc::GetBestMercSpellForFastHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsFastHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3130,7 +3134,8 @@ MercSpell Merc::GetBestMercSpellForHealOverTime(Merc* caster) { if(caster) { std::list mercHoTSpellList = GetMercSpellsForSpellEffect(caster, SE_HealOverTime); - for(std::list::iterator mercSpellListItr = mercHoTSpellList.begin(); mercSpellListItr != mercHoTSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercHoTSpellList.begin(); mercSpellListItr != mercHoTSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsHealOverTimeSpell(mercSpellListItr->spellid)) { @@ -3170,7 +3175,8 @@ MercSpell Merc::GetBestMercSpellForPercentageHeal(Merc* caster) { if(caster && caster->AI_HasSpells()) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsCompleteHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3202,7 +3208,8 @@ MercSpell Merc::GetBestMercSpellForRegularSingleTargetHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsRegularSingleTargetHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3234,7 +3241,8 @@ MercSpell Merc::GetFirstMercSpellForSingleTargetHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if((IsRegularSingleTargetHealSpell(mercSpellListItr->spellid) || IsFastHealSpell(mercSpellListItr->spellid)) @@ -3267,7 +3275,8 @@ MercSpell Merc::GetBestMercSpellForGroupHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CurrentHP); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsRegularGroupHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3299,7 +3308,8 @@ MercSpell Merc::GetBestMercSpellForGroupHealOverTime(Merc* caster) { if(caster) { std::list mercHoTSpellList = GetMercSpellsForSpellEffect(caster, SE_HealOverTime); - for(std::list::iterator mercSpellListItr = mercHoTSpellList.begin(); mercSpellListItr != mercHoTSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercHoTSpellList.begin(); mercSpellListItr != mercHoTSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsGroupHealOverTimeSpell(mercSpellListItr->spellid)) { @@ -3339,7 +3349,8 @@ MercSpell Merc::GetBestMercSpellForGroupCompleteHeal(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_CompleteHeal); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsGroupCompleteHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3371,7 +3382,8 @@ MercSpell Merc::GetBestMercSpellForAETaunt(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_Taunt); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if((spells[mercSpellListItr->spellid].targettype == ST_AECaster || spells[mercSpellListItr->spellid].targettype == ST_AETarget @@ -3405,7 +3417,8 @@ MercSpell Merc::GetBestMercSpellForTaunt(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_Taunt); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if((spells[mercSpellListItr->spellid].targettype == ST_Target) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3437,7 +3450,8 @@ MercSpell Merc::GetBestMercSpellForHate(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_InstantHate); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { result.spellid = mercSpellListItr->spellid; @@ -3493,7 +3507,7 @@ MercSpell Merc::GetBestMercSpellForCure(Merc* caster, Mob *tar) { //Check for group cure first if(countNeedsCured > 2) { - for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); ++itr) { + for (auto itr = cureList.begin(); itr != cureList.end(); ++itr) { MercSpell selectedMercSpell = *itr; if(IsGroupSpell(itr->spellid) && CheckSpellRecastTimers(caster, itr->spellid)) { @@ -3533,7 +3547,7 @@ MercSpell Merc::GetBestMercSpellForCure(Merc* caster, Mob *tar) { //no group cure for target- try to find single target spell if(!spellSelected) { - for(std::list::iterator itr = cureList.begin(); itr != cureList.end(); ++itr) { + for (auto itr = cureList.begin(); itr != cureList.end(); ++itr) { MercSpell selectedMercSpell = *itr; if(CheckSpellRecastTimers(caster, itr->spellid)) { @@ -3589,7 +3603,8 @@ MercSpell Merc::GetBestMercSpellForStun(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsForSpellEffect(caster, SE_Stun); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { result.spellid = mercSpellListItr->spellid; @@ -3684,7 +3699,8 @@ MercSpell Merc::GetBestMercSpellForTargetedAENuke(Merc* caster, Mob* tar) { if(caster) { std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsAENukeSpell(mercSpellListItr->spellid) && !IsAERainNukeSpell(mercSpellListItr->spellid) && !IsPBAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3735,7 +3751,8 @@ MercSpell Merc::GetBestMercSpellForPBAENuke(Merc* caster, Mob* tar) { if(caster) { std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsPBAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { uint8 numTargets = 0; @@ -3785,7 +3802,8 @@ MercSpell Merc::GetBestMercSpellForAERainNuke(Merc* caster, Mob* tar) { if(caster) { std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsAERainNukeSpell(mercSpellListItr->spellid) && zone->random.Roll(castChance) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { uint8 numTargets = 0; @@ -3823,7 +3841,8 @@ MercSpell Merc::GetBestMercSpellForNuke(Merc* caster) { if(caster) { std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsPureNukeSpell(mercSpellListItr->spellid) && !IsAENukeSpell(mercSpellListItr->spellid) && zone->random.Roll(castChance) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -3866,7 +3885,8 @@ MercSpell Merc::GetBestMercSpellForNukeByTargetResists(Merc* caster, Mob* target std::list mercSpellList = GetMercSpellsBySpellType(caster, SpellType_Nuke); - for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { + for (auto mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); + ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsPureNukeSpell(mercSpellListItr->spellid) && !IsAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { @@ -4105,7 +4125,7 @@ bool Merc::CheckAETaunt() { std::list npc_list; entity_list.GetNPCList(npc_list); - for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { + for (auto itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; float dist = DistanceSquaredNoZ(m_Position, npc->GetPosition()); int range = GetActSpellRange(mercSpell.spellid, spells[mercSpell.spellid].range); @@ -4168,7 +4188,7 @@ bool Merc::TryHide() { return false; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x03; @@ -4190,7 +4210,7 @@ bool Merc::CheckConfidence() { std::list npc_list; entity_list.GetNPCList(npc_list); - for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { + for (auto itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* mob = *itr; float ConRating = 1.0; int CurrentCon = 0; @@ -4667,7 +4687,7 @@ bool Merc::LoadMercSpells() { int16 attack_proc_spell = -1; int8 proc_chance = 0; - for (std::list::iterator mercSpellEntryItr = spellList.begin(); mercSpellEntryItr != spellList.end(); ++mercSpellEntryItr) { + for (auto mercSpellEntryItr = spellList.begin(); mercSpellEntryItr != spellList.end(); ++mercSpellEntryItr) { if (proficiency_id == mercSpellEntryItr->proficiencyid && GetLevel() >= mercSpellEntryItr->minlevel && GetLevel() <= mercSpellEntryItr->maxlevel && mercSpellEntryItr->spellid > 0) { MercSpell mercSpell; @@ -4725,7 +4745,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, if(npc_type_to_copy != nullptr) { //This is actually a very terrible method of assigning stats, and should be changed at some point. See the comment in merc's deconstructor. - NPCType* npc_type = new NPCType; + auto npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); memcpy(npc_type, npc_type_to_copy, sizeof(NPCType)); if(c && !updateFromDB) @@ -4771,7 +4791,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, npc_type->maxlevel = 0; //We should hard-set this to override scalerate's functionality in the NPC class when it is constructed. npc_type->no_target_hotkey = 1; - Merc* merc = new Merc(npc_type, c->GetX(), c->GetY(), c->GetZ(), 0); + auto merc = new Merc(npc_type, c->GetX(), c->GetY(), c->GetZ(), 0); merc->GiveNPCTypeData(npc_type); // for clean up, works a bit like pets if(merc) @@ -6063,7 +6083,7 @@ void Client::SendMercMerchantResponsePacket(int32 response_type) { // This response packet brings up the Mercenary Manager window if (ClientVersion() >= EQEmu::versions::ClientVersion::SoD) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryHire, sizeof(MercenaryMerchantResponse_Struct)); + auto outapp = new EQApplicationPacket(OP_MercenaryHire, sizeof(MercenaryMerchantResponse_Struct)); MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer; mmr->ResponseType = response_type; // send specified response type FastQueuePacket(&outapp); @@ -6073,7 +6093,7 @@ void Client::SendMercMerchantResponsePacket(int32 response_type) { void Client::SendMercenaryUnknownPacket(uint8 type) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1); + auto outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1); outapp->WriteUInt8(type); FastQueuePacket(&outapp); Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnknownPacket Type: %i, Client: %s.", type, GetName()); @@ -6082,7 +6102,7 @@ void Client::SendMercenaryUnknownPacket(uint8 type) { void Client::SendMercenaryUnsuspendPacket(uint8 type) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1); + auto outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1); outapp->WriteUInt8(type); FastQueuePacket(&outapp); Log.Out(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnsuspendPacket Type: %i, Client: %s.", type, GetName()); @@ -6091,7 +6111,7 @@ void Client::SendMercenaryUnsuspendPacket(uint8 type) { void Client::SendMercSuspendResponsePacket(uint32 suspended_time) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenarySuspendResponse, sizeof(SuspendMercenaryResponse_Struct)); + auto 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 FastQueuePacket(&outapp); @@ -6102,7 +6122,7 @@ void Client::SendMercSuspendResponsePacket(uint32 suspended_time) { void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspended_time, int32 update_interval, int32 unk01) { // Send Mercenary Status/Timer packet - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryTimer, sizeof(MercenaryStatus_Struct)); + auto outapp = new EQApplicationPacket(OP_MercenaryTimer, sizeof(MercenaryStatus_Struct)); MercenaryStatus_Struct* mss = (MercenaryStatus_Struct*)outapp->pBuffer; mss->MercEntityID = entity_id; // Seen 0 (no merc spawned) or unknown value when merc is spawned mss->MercState = merc_state; // Seen 5 (normal) or 1 (suspended) @@ -6115,7 +6135,7 @@ void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspen } void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryAssign, sizeof(MercenaryAssign_Struct)); + auto outapp = new EQApplicationPacket(OP_MercenaryAssign, sizeof(MercenaryAssign_Struct)); MercenaryAssign_Struct* mas = (MercenaryAssign_Struct*)outapp->pBuffer; mas->MercEntityID = entityID; mas->MercUnk01 = unk01; @@ -6194,7 +6214,7 @@ int NPC::GetNumMercTypes(uint32 clientVersion) { int count = 0; std::list mercTypeList = GetMercTypesList(); - for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); ++mercTypeListItr) { + for (auto mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); ++mercTypeListItr) { if(mercTypeListItr->ClientVersion <= clientVersion) count++; } @@ -6207,7 +6227,7 @@ int NPC::GetNumMercs(uint32 clientVersion) { int count = 0; std::list mercDataList = GetMercsList(); - for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) { + for (auto mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) { if(mercListItr->ClientVersion <= clientVersion) count++; } @@ -6221,8 +6241,8 @@ std::list NPC::GetMercTypesList(uint32 clientVersion) { if(GetNumMercTypes() > 0) { - for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); ++mercTypeListItr) - { + for (auto mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); + ++mercTypeListItr) { if(mercTypeListItr->ClientVersion <= clientVersion) { MercType mercType; @@ -6242,8 +6262,7 @@ std::list NPC::GetMercsList(uint32 clientVersion) { if(GetNumMercs() > 0) { - for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) - { + for (auto mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) { if(mercListItr->ClientVersion <= clientVersion) { MercTemplate *merc_template = zone->GetMercTemplate(mercListItr->MercTemplateID); diff --git a/zone/mob.cpp b/zone/mob.cpp index 5b1e132a9..aa7862601 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1367,7 +1367,7 @@ void Mob::SendHPUpdate(bool skip_self) this->CastToClient()->SendHPUpdateMarquee(); - EQApplicationPacket* hp_app2 = new EQApplicationPacket(OP_HPUpdate,sizeof(SpawnHPUpdate_Struct)); + auto hp_app2 = new EQApplicationPacket(OP_HPUpdate, sizeof(SpawnHPUpdate_Struct)); SpawnHPUpdate_Struct* ds = (SpawnHPUpdate_Struct*)hp_app2->pBuffer; ds->cur_hp = CastToClient()->GetHP() - itembonuses.HP; ds->spawn_id = GetID(); @@ -1382,7 +1382,7 @@ void Mob::SendHPUpdate(bool skip_self) // this one just warps the mob to the current location void Mob::SendPosition() { - EQApplicationPacket* app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); + auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer; MakeSpawnUpdateNoDelta(spu); move_tic_count = 0; @@ -1392,7 +1392,7 @@ void Mob::SendPosition() // this one is for mobs on the move, with deltas - this makes them walk void Mob::SendPosUpdate(uint8 iSendToSelf) { - EQApplicationPacket* app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); + auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer; MakeSpawnUpdate(spu); @@ -1501,7 +1501,7 @@ void Mob::ShowStats(Client* client) } void Mob::DoAnim(const int animnum, int type, bool ackreq, eqFilterType filter) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Animation, sizeof(Animation_Struct)); + auto outapp = new EQApplicationPacket(OP_Animation, sizeof(Animation_Struct)); Animation_Struct* anim = (Animation_Struct*)outapp->pBuffer; anim->spawnid = GetID(); if(type == 0){ @@ -1737,7 +1737,7 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, } } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Illusion, sizeof(Illusion_Struct)); + auto outapp = new EQApplicationPacket(OP_Illusion, sizeof(Illusion_Struct)); Illusion_Struct* is = (Illusion_Struct*) outapp->pBuffer; is->spawnid = GetID(); strcpy(is->charname, GetCleanName()); @@ -2005,7 +2005,7 @@ uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) { void Mob::SendAppearancePacket(uint32 type, uint32 value, bool WholeZone, bool iIgnoreSelf, Client *specific_target) { if (!GetID()) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* appearance = (SpawnAppearance_Struct*)outapp->pBuffer; appearance->spawn_id = this->GetID(); appearance->type = type; @@ -2020,7 +2020,7 @@ void Mob::SendAppearancePacket(uint32 type, uint32 value, bool WholeZone, bool i } void Mob::SendLevelAppearance(){ - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelAppearance, sizeof(LevelAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_LevelAppearance, sizeof(LevelAppearance_Struct)); LevelAppearance_Struct* la = (LevelAppearance_Struct*)outapp->pBuffer; la->parm1 = 0x4D; la->parm2 = la->parm1 + 1; @@ -2041,7 +2041,7 @@ void Mob::SendLevelAppearance(){ void Mob::SendStunAppearance() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelAppearance, sizeof(LevelAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_LevelAppearance, sizeof(LevelAppearance_Struct)); LevelAppearance_Struct* la = (LevelAppearance_Struct*)outapp->pBuffer; la->parm1 = 58; la->parm2 = 60; @@ -2055,7 +2055,7 @@ void Mob::SendStunAppearance() } void Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 parm4, uint32 parm5, Client *specific_target){ - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelAppearance, sizeof(LevelAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_LevelAppearance, sizeof(LevelAppearance_Struct)); LevelAppearance_Struct* la = (LevelAppearance_Struct*)outapp->pBuffer; la->spawn_id = GetID(); la->parm1 = parm1; @@ -2085,7 +2085,7 @@ void Mob::SendAppearanceEffect(uint32 parm1, uint32 parm2, uint32 parm3, uint32 } void Mob::SendTargetable(bool on, Client *specific_target) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Untargetable, sizeof(Untargetable_Struct)); + auto outapp = new EQApplicationPacket(OP_Untargetable, sizeof(Untargetable_Struct)); Untargetable_Struct *ut = (Untargetable_Struct*)outapp->pBuffer; ut->id = GetID(); ut->targetable_flag = on == true ? 1 : 0; @@ -2104,7 +2104,7 @@ void Mob::CameraEffect(uint32 duration, uint32 intensity, Client *c, bool global if(global == true) { - ServerPacket* pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct)); + auto pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct)); ServerCameraShake_Struct* scss = (ServerCameraShake_Struct*) pack->pBuffer; scss->duration = duration; scss->intensity = intensity; @@ -2113,7 +2113,7 @@ void Mob::CameraEffect(uint32 duration, uint32 intensity, Client *c, bool global return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_CameraEffect, sizeof(Camera_Struct)); + auto outapp = new EQApplicationPacket(OP_CameraEffect, sizeof(Camera_Struct)); Camera_Struct* cs = (Camera_Struct*) outapp->pBuffer; cs->duration = duration; // Duration in milliseconds cs->intensity = ((intensity * 6710886) + 1023410176); // Intensity ranges from 1023410176 to 1090519040, so simplify it from 0 to 10. @@ -2128,7 +2128,7 @@ void Mob::CameraEffect(uint32 duration, uint32 intensity, Client *c, bool global void Mob::SendSpellEffect(uint32 effectid, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk020, bool perm_effect, Client *c) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpellEffect, sizeof(SpellEffect_Struct)); + auto outapp = new EQApplicationPacket(OP_SpellEffect, sizeof(SpellEffect_Struct)); SpellEffect_Struct* se = (SpellEffect_Struct*) outapp->pBuffer; se->EffectID = effectid; // ID of the Particle Effect se->EntityID = GetID(); @@ -2180,7 +2180,7 @@ void Mob::TempName(const char *newname) entity_list.MakeNameUnique(temp_name); // Send the new name to all clients - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MobRename, sizeof(MobRename_Struct)); + auto outapp = new EQApplicationPacket(OP_MobRename, sizeof(MobRename_Struct)); MobRename_Struct* mr = (MobRename_Struct*) outapp->pBuffer; strn0cpy(mr->old_name, old_name, 64); strn0cpy(mr->old_name_again, old_name, 64); @@ -2769,7 +2769,7 @@ void Mob::SendArmorAppearance(Client *one_client) void Mob::SendWearChange(uint8 material_slot, Client *one_client) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); + auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); WearChange_Struct* wc = (WearChange_Struct*)outapp->pBuffer; wc->spawn_id = GetID(); @@ -2793,7 +2793,7 @@ void Mob::SendWearChange(uint8 material_slot, Client *one_client) void Mob::SendTextureWC(uint8 slot, uint16 texture, uint32 hero_forge_model, uint32 elite_material, uint32 unknown06, uint32 unknown18) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); + auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); WearChange_Struct* wc = (WearChange_Struct*)outapp->pBuffer; wc->spawn_id = this->GetID(); @@ -2823,7 +2823,7 @@ void Mob::SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uin color |= (color) ? (0xFF << 24) : 0; armor_tint[material_slot] = color; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); + auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); WearChange_Struct* wc = (WearChange_Struct*)outapp->pBuffer; wc->spawn_id = this->GetID(); @@ -2840,7 +2840,7 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 h { armor_tint[material_slot] = color; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); + auto outapp = new EQApplicationPacket(OP_WearChange, sizeof(WearChange_Struct)); WearChange_Struct* wc = (WearChange_Struct*)outapp->pBuffer; wc->spawn_id = this->GetID(); @@ -3447,7 +3447,7 @@ void Mob::SetEntityVariable(const char *id, const char *m_var) const char* Mob::GetEntityVariable(const char *id) { - std::map::iterator iter = m_EntityVariables.find(id); + auto iter = m_EntityVariables.find(id); if(iter != m_EntityVariables.end()) { return iter->second.c_str(); @@ -3457,7 +3457,7 @@ const char* Mob::GetEntityVariable(const char *id) bool Mob::EntityVariableExists(const char *id) { - std::map::iterator iter = m_EntityVariables.find(id); + auto iter = m_EntityVariables.find(id); if(iter != m_EntityVariables.end()) { return true; @@ -4253,7 +4253,7 @@ std::string Mob::GetGlobal(const char *varname) { if(qglobals) QGlobalCache::Combine(globalMap, qglobals->GetBucket(), qgNpcid, qgCharid, zone->GetZoneID()); - std::list::iterator iter = globalMap.begin(); + auto iter = globalMap.begin(); while(iter != globalMap.end()) { if ((*iter).name.compare(varname) == 0) return (*iter).value; @@ -4339,7 +4339,7 @@ void Mob::DelGlobal(const char *varname) { if(zone) { - ServerPacket* pack = new ServerPacket(ServerOP_QGlobalDelete, sizeof(ServerQGlobalDelete_Struct)); + auto pack = new ServerPacket(ServerOP_QGlobalDelete, sizeof(ServerQGlobalDelete_Struct)); ServerQGlobalDelete_Struct *qgu = (ServerQGlobalDelete_Struct*)pack->pBuffer; qgu->npc_id = qgNpcid; @@ -4378,7 +4378,7 @@ void Mob::InsertQuestGlobal(int charid, int npcid, int zoneid, const char *varna if(zone) { //first delete our global - ServerPacket* pack = new ServerPacket(ServerOP_QGlobalDelete, sizeof(ServerQGlobalDelete_Struct)); + auto pack = new ServerPacket(ServerOP_QGlobalDelete, sizeof(ServerQGlobalDelete_Struct)); ServerQGlobalDelete_Struct *qgd = (ServerQGlobalDelete_Struct*)pack->pBuffer; qgd->npc_id = npcid; qgd->char_id = charid; @@ -4491,7 +4491,7 @@ void Mob::DoKnockback(Mob *caster, uint32 pushback, uint32 pushup) { CastToClient()->SetKnockBackExemption(true); - EQApplicationPacket* outapp_push = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); + auto outapp_push = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)outapp_push->pBuffer; double look_heading = caster->CalculateHeadingToTarget(GetX(), GetY()); @@ -4880,7 +4880,7 @@ void Mob::RemoveNimbusEffect(int effectid) else if (effectid == nimbus_effect3) nimbus_effect3 = 0; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RemoveNimbusEffect, sizeof(RemoveNimbusEffect_Struct)); + auto outapp = new EQApplicationPacket(OP_RemoveNimbusEffect, sizeof(RemoveNimbusEffect_Struct)); RemoveNimbusEffect_Struct* rne = (RemoveNimbusEffect_Struct*)outapp->pBuffer; rne->spawnid = GetID(); rne->nimbus_effect = effectid; @@ -4904,7 +4904,7 @@ void Mob::SetBodyType(bodyType new_body, bool overwrite_orig) { bodytype = new_body; if(needs_spawn_packet) { - EQApplicationPacket* app = new EQApplicationPacket; + auto app = new EQApplicationPacket; CreateDespawnPacket(app, true); entity_list.QueueClients(this, app); CreateSpawnPacket(app, this); diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 7958035ab..2b618e7e2 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -561,7 +561,7 @@ void Client::AI_Stop() { Mob::AI_Stop(); this->Message_StringID(13,PLAYER_REGAIN); - EQApplicationPacket *app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct)); + auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct)); Charm_Struct *ps = (Charm_Struct*)app->pBuffer; ps->owner_id = 0; ps->pet_id = this->GetID(); @@ -2526,7 +2526,7 @@ void NPC::AddSpellToNPCList(int16 iPriority, int16 iSpellID, uint16 iType, void NPC::RemoveSpellFromNPCList(int16 spell_id) { - std::vector::iterator iter = AIspells.begin(); + auto iter = AIspells.begin(); while(iter != AIspells.end()) { if((*iter).spellid == spell_id) @@ -2543,7 +2543,7 @@ void NPC::AISpellsList(Client *c) if (!c) return; - for (std::vector::iterator it = AIspells.begin(); it != AIspells.end(); ++it) + for (auto it = AIspells.begin(); it != AIspells.end(); ++it) c->Message(0, "%s (%d): Type %d, Priority %d", spells[it->spellid].name, it->spellid, it->type, it->priority); diff --git a/zone/net.cpp b/zone/net.cpp index b173b67a0..0f6ad0bbe 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -358,12 +358,12 @@ int main(int argc, char** argv) { parse = new QuestParserCollection(); #ifdef LUA_EQEMU - LuaParser *lua_parser = new LuaParser(); + auto lua_parser = new LuaParser(); parse->RegisterQuestInterface(lua_parser, "lua"); #endif #ifdef EMBPERL - PerlembParser *perl_parser = new PerlembParser(); + auto perl_parser = new PerlembParser(); parse->RegisterQuestInterface(perl_parser, "pl"); /* Load Perl Event Export Settings */ @@ -448,7 +448,7 @@ int main(int argc, char** argv) { struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); Log.Out(Logs::Detail, Logs::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); - Client* client = new Client(eqsi); + auto client = new Client(eqsi); entity_list.AddClient(client); } diff --git a/zone/npc.cpp b/zone/npc.cpp index 8b09f448c..54c375f8c 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -303,7 +303,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int if trap_list = trap_ent_iter->second; if(trap_list.size() > 0) { - std::list::iterator trap_list_iter = trap_list.begin(); + auto trap_list_iter = trap_list.begin(); std::advance(trap_list_iter, zone->random.Int(0, trap_list.size() - 1)); LDoNTrapTemplate* tt = (*trap_list_iter); if(tt) @@ -479,7 +479,7 @@ void NPC::CheckMinMaxLevel(Mob *them) uint16 themlevel = them->GetLevel(); uint8 material; - std::list::iterator cur = itemlist.begin(); + auto cur = itemlist.begin(); while(cur != itemlist.end()) { if(!(*cur)) @@ -522,7 +522,7 @@ void NPC::QueryLoot(Client* to) to->Message(0, "Coin: %ip %ig %is %ic", platinum, gold, silver, copper); int x = 0; - for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { + for (auto cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const EQEmu::Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { Log.Out(Logs::General, Logs::Error, "Database error, invalid item"); @@ -848,7 +848,7 @@ bool NPC::SpawnZoneController(){ if (!RuleB(Zone, UseZoneController)) return false; - NPCType* npc_type = new NPCType; + auto npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); strncpy(npc_type->name, "zone_controller", 60); @@ -883,7 +883,7 @@ bool NPC::SpawnZoneController(){ point.y = 1000; point.z = 500; - NPC* npc = new NPC(npc_type, nullptr, point, FlyMode3); + auto npc = new NPC(npc_type, nullptr, point, FlyMode3); npc->GiveNPCTypeData(npc_type); entity_list.AddNPC(npc); @@ -1016,7 +1016,7 @@ NPC* NPC::SpawnNPC(const char* spawncommand, const glm::vec4& position, Client* } //Time to create the NPC!! - NPCType* npc_type = new NPCType; + auto npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); strncpy(npc_type->name, sep.arg[0], 60); @@ -1050,7 +1050,7 @@ NPC* NPC::SpawnNPC(const char* spawncommand, const glm::vec4& position, Client* npc_type->prim_melee_type = 28; npc_type->sec_melee_type = 28; - NPC* npc = new NPC(npc_type, nullptr, position, FlyMode3); + auto npc = new NPC(npc_type, nullptr, position, FlyMode3); npc->GiveNPCTypeData(npc_type); entity_list.AddNPC(npc); @@ -2464,7 +2464,7 @@ void NPC::DoQuestPause(Mob *other) { void NPC::ChangeLastName(const char* in_lastname) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMLastName, sizeof(GMLastName_Struct)); + auto outapp = new EQApplicationPacket(OP_GMLastName, sizeof(GMLastName_Struct)); GMLastName_Struct* gmn = (GMLastName_Struct*)outapp->pBuffer; strcpy(gmn->name, GetName()); strcpy(gmn->gmname, GetName()); diff --git a/zone/object.cpp b/zone/object.cpp index f6330d872..f6338ab50 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -425,7 +425,7 @@ void Object::CreateDeSpawnPacket(EQApplicationPacket* app) bool Object::Process(){ if(m_type == OT_DROPPEDITEM && decay_timer.Enabled() && decay_timer.Check()) { // Send click to all clients (removes entity on client) - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClickObject, sizeof(ClickObject_Struct)); + auto outapp = new EQApplicationPacket(OP_ClickObject, sizeof(ClickObject_Struct)); ClickObject_Struct* click_object = (ClickObject_Struct*)outapp->pBuffer; click_object->drop_id = GetID(); entity_list.QueueClients(nullptr, outapp, false); @@ -487,7 +487,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) args.push_back(m_inst); if(parse->EventPlayer(EVENT_PLAYER_PICKUP, sender, buf, this->GetID(), &args)) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClickObject, sizeof(ClickObject_Struct)); + auto outapp = new EQApplicationPacket(OP_ClickObject, sizeof(ClickObject_Struct)); memcpy(outapp->pBuffer, click_object, sizeof(ClickObject_Struct)); ClickObject_Struct* co = (ClickObject_Struct*)outapp->pBuffer; co->drop_id = 0; @@ -518,7 +518,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) } // Send click to all clients (removes entity on client) - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClickObject, sizeof(ClickObject_Struct)); + auto outapp = new EQApplicationPacket(OP_ClickObject, sizeof(ClickObject_Struct)); memcpy(outapp->pBuffer, click_object, sizeof(ClickObject_Struct)); entity_list.QueueClients(nullptr, outapp, false); safe_delete(outapp); @@ -529,7 +529,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) entity_list.RemoveEntity(this->GetID()); } else { // Tradeskill item - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClickObjectAction, sizeof(ClickObjectAction_Struct)); + auto outapp = new EQApplicationPacket(OP_ClickObjectAction, sizeof(ClickObjectAction_Struct)); ClickObjectAction_Struct* coa = (ClickObjectAction_Struct*)outapp->pBuffer; //TODO: there is prolly a better way to do this. @@ -580,7 +580,7 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object) if(user != last_user) m_inst->ClearByFlags(byFlagSet, byFlagSet); - EQApplicationPacket* outapp=new EQApplicationPacket(OP_ClientReady,0); + auto outapp = new EQApplicationPacket(OP_ClientReady, 0); sender->QueuePacket(outapp); safe_delete(outapp); for (uint8 i = SUB_INDEX_BEGIN; i < EQEmu::legacy::ITEM_CONTAINER_SIZE; i++) { @@ -610,7 +610,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob // SQL Escape object_name uint32 len = strlen(object.object_name) * 2 + 1; - char* object_name = new char[len]; + auto object_name = new char[len]; DoEscapeString(object_name, object.object_name, strlen(object.object_name)); // Save new record for object @@ -647,7 +647,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec // SQL Escape object_name uint32 len = strlen(object.object_name) * 2 + 1; - char* object_name = new char[len]; + auto object_name = new char[len]; DoEscapeString(object_name, object.object_name, strlen(object.object_name)); // Save new record for object @@ -754,8 +754,8 @@ void Object::SetX(float pos) { this->m_data.x = pos; - EQApplicationPacket* app = new EQApplicationPacket(); - EQApplicationPacket* app2 = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); + auto app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); @@ -768,8 +768,8 @@ void Object::SetY(float pos) { this->m_data.y = pos; - EQApplicationPacket* app = new EQApplicationPacket(); - EQApplicationPacket* app2 = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); + auto app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); @@ -780,7 +780,7 @@ void Object::SetY(float pos) void Object::Depop() { - EQApplicationPacket* app = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); entity_list.QueueClients(0, app); safe_delete(app); @@ -789,8 +789,8 @@ void Object::Depop() void Object::Repop() { - EQApplicationPacket* app = new EQApplicationPacket(); - EQApplicationPacket* app2 = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); + auto app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); @@ -805,8 +805,8 @@ void Object::SetZ(float pos) { this->m_data.z = pos; - EQApplicationPacket* app = new EQApplicationPacket(); - EQApplicationPacket* app2 = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); + auto app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); @@ -818,8 +818,8 @@ void Object::SetZ(float pos) void Object::SetModelName(const char* modelname) { strn0cpy(m_data.object_name, modelname, sizeof(m_data.object_name)); // 32 is the max for chars in object_name, this should be safe - EQApplicationPacket* app = new EQApplicationPacket(); - EQApplicationPacket* app2 = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); + auto app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); @@ -831,8 +831,8 @@ void Object::SetModelName(const char* modelname) void Object::SetSize(uint16 size) { m_data.size = size; - EQApplicationPacket* app = new EQApplicationPacket(); - EQApplicationPacket* app2 = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); + auto app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); @@ -844,8 +844,8 @@ void Object::SetSize(uint16 size) void Object::SetSolidType(uint16 solidtype) { m_data.solidtype = solidtype; - EQApplicationPacket* app = new EQApplicationPacket(); - EQApplicationPacket* app2 = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); + auto app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); @@ -940,8 +940,8 @@ void Object::SetLocation(float x, float y, float z) this->m_data.x = x; this->m_data.y = y; this->m_data.z = z; - EQApplicationPacket* app = new EQApplicationPacket(); - EQApplicationPacket* app2 = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); + auto app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); @@ -961,8 +961,8 @@ void Object::GetHeading(float* heading) void Object::SetHeading(float heading) { this->m_data.heading = heading; - EQApplicationPacket* app = new EQApplicationPacket(); - EQApplicationPacket* app2 = new EQApplicationPacket(); + auto app = new EQApplicationPacket(); + auto app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); @@ -982,7 +982,7 @@ const char* Object::GetEntityVariable(const char *id) if(!id) return nullptr; - std::map::iterator iter = o_EntityVariables.find(id); + auto iter = o_EntityVariables.find(id); if(iter != o_EntityVariables.end()) { return iter->second.c_str(); @@ -995,7 +995,7 @@ bool Object::EntityVariableExists(const char * id) if(!id) return false; - std::map::iterator iter = o_EntityVariables.find(id); + auto iter = o_EntityVariables.find(id); if(iter != o_EntityVariables.end()) { return true; diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 8c0271c06..a39441564 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -546,7 +546,7 @@ void PathManager::SpawnPathNodes() for(uint32 i = 0; i < Head.PathNodeCount; ++i) { - NPCType* npc_type = new NPCType; + auto npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); if(PathNodes[i].id < 10) @@ -585,10 +585,10 @@ void PathManager::SpawnPathNodes() npc_type->findable = 1; auto position = glm::vec4(PathNodes[i].v.x, PathNodes[i].v.y, PathNodes[i].v.z, 0.0f); - NPC* npc = new NPC(npc_type, nullptr, position, FlyMode1); - npc->GiveNPCTypeData(npc_type); + auto npc = new NPC(npc_type, nullptr, position, FlyMode1); + npc->GiveNPCTypeData(npc_type); - entity_list.AddNPC(npc, true, true); + entity_list.AddNPC(npc, true, true); } } @@ -1311,7 +1311,7 @@ void Client::SendPathPacket(std::vector &points) { } int len = sizeof(FindPersonResult_Struct) + (points.size()+1) * sizeof(FindPerson_Point); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_FindPersonReply, len); + auto outapp = new EQApplicationPacket(OP_FindPersonReply, len); FindPersonResult_Struct* fpr=(FindPersonResult_Struct*)outapp->pBuffer; std::vector::iterator cur, end; @@ -1509,7 +1509,7 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques Head.PathNodeCount++; if(Head.PathNodeCount > 1) { - PathNode *t_PathNodes = new PathNode[Head.PathNodeCount]; + auto t_PathNodes = new PathNode[Head.PathNodeCount]; for(uint32 x = 0; x < (Head.PathNodeCount - 1); ++x) { t_PathNodes[x].v.x = PathNodes[x].v.x; @@ -1544,7 +1544,7 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques delete[] PathNodes; PathNodes = t_PathNodes; - NPCType* npc_type = new NPCType; + auto npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); if(new_id < 10) sprintf(npc_type->name, "%s", DigitToWord(new_id)); @@ -1581,13 +1581,13 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques npc_type->findable = 1; auto position = glm::vec4(new_node.v.x, new_node.v.y, new_node.v.z, 0.0f); - NPC* npc = new NPC(npc_type, nullptr, position, FlyMode1); - npc->GiveNPCTypeData(npc_type); - entity_list.AddNPC(npc, true, true); + auto npc = new NPC(npc_type, nullptr, position, FlyMode1); + npc->GiveNPCTypeData(npc_type); + entity_list.AddNPC(npc, true, true); - safe_delete_array(ClosedListFlag); - ClosedListFlag = new int[Head.PathNodeCount]; - return new_id; + safe_delete_array(ClosedListFlag); + ClosedListFlag = new int[Head.PathNodeCount]; + return new_id; } else { @@ -1605,7 +1605,7 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques PathNodes[0].Neighbours[n].Teleport = new_node.Neighbours[n].Teleport; } - NPCType* npc_type = new NPCType; + auto npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); if(new_id < 10) sprintf(npc_type->name, "%s", DigitToWord(new_id)); @@ -1642,13 +1642,13 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques npc_type->findable = 1; auto position = glm::vec4(new_node.v.x, new_node.v.y, new_node.v.z, 0.0f); - NPC* npc = new NPC(npc_type, nullptr, position, FlyMode1); - npc->GiveNPCTypeData(npc_type); - entity_list.AddNPC(npc, true, true); + auto npc = new NPC(npc_type, nullptr, position, FlyMode1); + npc->GiveNPCTypeData(npc_type); + entity_list.AddNPC(npc, true, true); - ClosedListFlag = new int[Head.PathNodeCount]; + ClosedListFlag = new int[Head.PathNodeCount]; - return new_id; + return new_id; } } @@ -1684,7 +1684,7 @@ bool PathManager::DeleteNode(int32 id) if(Head.PathNodeCount > 1) { - PathNode *t_PathNodes = new PathNode[Head.PathNodeCount-1]; + auto t_PathNodes = new PathNode[Head.PathNodeCount - 1]; uint32 index = 0; for(uint32 x = 0; x < Head.PathNodeCount; x++) { @@ -2233,7 +2233,7 @@ void PathManager::SortNodes() sorted_vals.push_back(tmp); } - PathNode *t_PathNodes = new PathNode[Head.PathNodeCount]; + auto t_PathNodes = new PathNode[Head.PathNodeCount]; memcpy(t_PathNodes, PathNodes, sizeof(PathNode)*Head.PathNodeCount); for(uint32 i = 0; i < Head.PathNodeCount; ++i) { diff --git a/zone/perl_entity.cpp b/zone/perl_entity.cpp index c80b81c5d..eafc5c822 100644 --- a/zone/perl_entity.cpp +++ b/zone/perl_entity.cpp @@ -1904,7 +1904,7 @@ XS(XS_EntityList_GetMobList) std::list mob_list; entity_list.GetMobList(mob_list); - std::list::iterator iter = mob_list.begin(); + auto iter = mob_list.begin(); while(iter != mob_list.end()) { @@ -1941,7 +1941,7 @@ XS(XS_EntityList_GetClientList) std::list client_list; entity_list.GetClientList(client_list); - std::list::iterator iter = client_list.begin(); + auto iter = client_list.begin(); while(iter != client_list.end()) { @@ -1978,7 +1978,7 @@ XS(XS_EntityList_GetNPCList) std::list npc_list; entity_list.GetNPCList(npc_list); - std::list::iterator iter = npc_list.begin(); + auto iter = npc_list.begin(); while(iter != npc_list.end()) { @@ -2015,7 +2015,7 @@ XS(XS_EntityList_GetCorpseList) std::list corpse_list; entity_list.GetCorpseList(corpse_list); - std::list::iterator iter = corpse_list.begin(); + auto iter = corpse_list.begin(); while(iter != corpse_list.end()) { @@ -2052,7 +2052,7 @@ XS(XS_EntityList_GetObjectList) std::list object_list; entity_list.GetObjectList(object_list); - std::list::iterator iter = object_list.begin(); + auto iter = object_list.begin(); while(iter != object_list.end()) { @@ -2089,7 +2089,7 @@ XS(XS_EntityList_GetDoorsList) std::list door_list; entity_list.GetDoorsList(door_list); - std::list::iterator iter = door_list.begin(); + auto iter = door_list.begin(); while(iter != door_list.end()) { diff --git a/zone/perlpacket.cpp b/zone/perlpacket.cpp index ed0dd9cd3..9f423f089 100644 --- a/zone/perlpacket.cpp +++ b/zone/perlpacket.cpp @@ -62,7 +62,7 @@ void PerlPacket::SendTo(Client *who) { if(!who || op == OP_Unknown || (len > 0 && packet == nullptr)) return; - EQApplicationPacket *outapp = new EQApplicationPacket(op, len); + auto outapp = new EQApplicationPacket(op, len); if(len > 0) memcpy(outapp->pBuffer, packet, len); @@ -76,7 +76,7 @@ void PerlPacket::SendToAll() { if(op == OP_Unknown || (len > 0 && packet == nullptr)) return; - EQApplicationPacket *outapp = new EQApplicationPacket(op, len); + auto outapp = new EQApplicationPacket(op, len); if(len > 0) memcpy(outapp->pBuffer, packet, len); entity_list.QueueClients(nullptr, outapp, false); diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 3e8a836e2..d3c350b5f 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -44,7 +44,7 @@ PetitionList petition_list; extern WorldServer worldserver; void Petition::SendPetitionToPlayer(Client* clientto) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionCheckout,sizeof(Petition_Struct)); + auto outapp = new EQApplicationPacket(OP_PetitionCheckout, sizeof(Petition_Struct)); Petition_Struct* pet = (Petition_Struct*) outapp->pBuffer; strcpy(pet->accountid,this->GetAccountName()); strcpy(pet->lastgm,this->GetLastGM()); @@ -136,7 +136,7 @@ bool PetitionList::DeletePetitionByCharName(const char* charname) { return false; } void PetitionList::UpdateZoneListQueue() { - ServerPacket* pack = new ServerPacket(ServerOP_Petition, sizeof(ServerPetitionUpdate_Struct)); + auto pack = new ServerPacket(ServerOP_Petition, sizeof(ServerPetitionUpdate_Struct)); ServerPetitionUpdate_Struct* pupdate = (ServerPetitionUpdate_Struct*) pack->pBuffer; pupdate->petid = 0x00; pupdate->status = 0x00; @@ -229,7 +229,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) { uint32 len = strlen(wpet->GetPetitionText()); - char* petitiontext = new char[2*len+1]; + auto petitiontext = new char[2 * len + 1]; memset(petitiontext, 0, 2*len+1); DoEscapeString(petitiontext, wpet->GetPetitionText(), len); diff --git a/zone/pets.cpp b/zone/pets.cpp index 96c053e73..6085cab53 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -264,7 +264,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, } //we copy the npc_type data because we need to edit it a bit - NPCType *npc_type = new NPCType; + auto npc_type = new NPCType; memcpy(npc_type, base, sizeof(NPCType)); // If pet power is set to -1 in the DB, use stat scaling @@ -412,7 +412,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, } //this takes ownership of the npc_type data - Pet *npc = new Pet(npc_type, this, (PetType)record.petcontrol, spell_id, record.petpower); + auto npc = new Pet(npc_type, this, (PetType)record.petcontrol, spell_id, record.petpower); // Now that we have an actual object to interact with, load // the base items for the pet. These are always loaded diff --git a/zone/qglobals.cpp b/zone/qglobals.cpp index 0dced7cb0..f1719def5 100644 --- a/zone/qglobals.cpp +++ b/zone/qglobals.cpp @@ -12,7 +12,7 @@ void QGlobalCache::AddGlobal(uint32 id, QGlobal global) void QGlobalCache::RemoveGlobal(std::string name, uint32 npcID, uint32 charID, uint32 zoneID) { - std::list::iterator iter = qGlobalBucket.begin(); + auto iter = qGlobalBucket.begin(); while(iter != qGlobalBucket.end()) { if(name.compare((*iter).name) == 0) @@ -31,7 +31,7 @@ void QGlobalCache::RemoveGlobal(std::string name, uint32 npcID, uint32 charID, u void QGlobalCache::Combine(std::list &cacheA, std::list cacheB, uint32 npcID, uint32 charID, uint32 zoneID) { - std::list::iterator iter = cacheB.begin(); + auto iter = cacheB.begin(); while(iter != cacheB.end()) { QGlobal cur = (*iter); @@ -123,7 +123,7 @@ void QGlobalCache::PurgeExpiredGlobals() if(!qGlobalBucket.size()) return; - std::list::iterator iter = qGlobalBucket.begin(); + auto iter = qGlobalBucket.begin(); while(iter != qGlobalBucket.end()) { QGlobal cur = (*iter); diff --git a/zone/queryserv.cpp b/zone/queryserv.cpp index d67ca46c7..691943a7c 100644 --- a/zone/queryserv.cpp +++ b/zone/queryserv.cpp @@ -35,7 +35,7 @@ QueryServ::~QueryServ(){ void QueryServ::SendQuery(std::string Query) { - ServerPacket* pack = new ServerPacket(ServerOP_QSSendQuery, Query.length() + 5); + auto pack = new ServerPacket(ServerOP_QSSendQuery, Query.length() + 5); pack->WriteUInt32(Query.length()); /* Pack Query String Size so it can be dynamically broken out at queryserv */ pack->WriteString(Query.c_str()); /* Query */ worldserver.SendPacket(pack); diff --git a/zone/quest_parser_collection.cpp b/zone/quest_parser_collection.cpp index 33a18d379..290b71ab9 100644 --- a/zone/quest_parser_collection.cpp +++ b/zone/quest_parser_collection.cpp @@ -53,7 +53,7 @@ void QuestParserCollection::ClearInterfaces() { } void QuestParserCollection::AddVar(std::string name, std::string val) { - std::list::iterator iter = _load_precedence.begin(); + auto iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { (*iter)->AddVar(name, val); ++iter; @@ -61,7 +61,7 @@ void QuestParserCollection::AddVar(std::string name, std::string val) { } void QuestParserCollection::Init() { - std::list::iterator iter = _load_precedence.begin(); + auto iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { (*iter)->Init(); ++iter; @@ -81,7 +81,7 @@ void QuestParserCollection::ReloadQuests(bool reset_timers) { _spell_quest_status.clear(); _item_quest_status.clear(); _encounter_quest_status.clear(); - std::list::iterator iter = _load_precedence.begin(); + auto iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { (*iter)->ReloadQuests(); ++iter; @@ -93,12 +93,12 @@ bool QuestParserCollection::HasQuestSub(uint32 npcid, QuestEventID evt) { } bool QuestParserCollection::HasQuestSubLocal(uint32 npcid, QuestEventID evt) { - std::map::iterator iter = _npc_quest_status.find(npcid); - + auto iter = _npc_quest_status.find(npcid); + if(iter != _npc_quest_status.end()) { //loaded or failed to load if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); + auto qiter = _interfaces.find(iter->second); if(qiter->second->HasQuestSub(npcid, evt)) { return true; } @@ -133,7 +133,7 @@ bool QuestParserCollection::HasQuestSubGlobal(QuestEventID evt) { } } else { if(_global_npc_quest_status != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(_global_npc_quest_status); + auto qiter = _interfaces.find(_global_npc_quest_status); if(qiter->second->HasGlobalQuestSub(evt)) { return true; } @@ -156,7 +156,7 @@ bool QuestParserCollection::PlayerHasQuestSubLocal(QuestEventID evt) { return qi->PlayerHasQuestSub(evt); } } else if(_player_quest_status != QuestFailedToLoad) { - std::map::iterator iter = _interfaces.find(_player_quest_status); + auto iter = _interfaces.find(_player_quest_status); return iter->second->PlayerHasQuestSub(evt); } return false; @@ -172,18 +172,18 @@ bool QuestParserCollection::PlayerHasQuestSubGlobal(QuestEventID evt) { return qi->GlobalPlayerHasQuestSub(evt); } } else if(_global_player_quest_status != QuestFailedToLoad) { - std::map::iterator iter = _interfaces.find(_global_player_quest_status); + auto iter = _interfaces.find(_global_player_quest_status); return iter->second->GlobalPlayerHasQuestSub(evt); } return false; } bool QuestParserCollection::SpellHasQuestSub(uint32 spell_id, QuestEventID evt) { - std::map::iterator iter = _spell_quest_status.find(spell_id); + auto iter = _spell_quest_status.find(spell_id); if(iter != _spell_quest_status.end()) { //loaded or failed to load if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); + auto qiter = _interfaces.find(iter->second); return qiter->second->SpellHasQuestSub(spell_id, evt); } } else { @@ -215,11 +215,11 @@ bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { } uint32 item_id = itm->GetID(); - std::map::iterator iter = _item_quest_status.find(item_id); + auto iter = _item_quest_status.find(item_id); if(iter != _item_quest_status.end()) { //loaded or failed to load if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); + auto qiter = _interfaces.find(iter->second); return qiter->second->ItemHasQuestSub(itm, evt); } } else { @@ -256,11 +256,11 @@ int QuestParserCollection::EventNPC(QuestEventID evt, NPC *npc, Mob *init, std:: int QuestParserCollection::EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector *extra_pointers) { - std::map::iterator iter = _npc_quest_status.find(npc->GetNPCTypeID()); + auto iter = _npc_quest_status.find(npc->GetNPCTypeID()); if(iter != _npc_quest_status.end()) { //loaded or failed to load if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); + auto qiter = _interfaces.find(iter->second); return qiter->second->EventNPC(evt, npc, init, data, extra_data, extra_pointers); } } else { @@ -280,7 +280,7 @@ int QuestParserCollection::EventNPCLocal(QuestEventID evt, NPC* npc, Mob *init, int QuestParserCollection::EventNPCGlobal(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data, std::vector *extra_pointers) { if(_global_npc_quest_status != QuestUnloaded && _global_npc_quest_status != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(_global_npc_quest_status); + auto qiter = _interfaces.find(_global_npc_quest_status); return qiter->second->EventGlobalNPC(evt, npc, init, data, extra_data, extra_pointers); } else { std::string filename; @@ -326,7 +326,7 @@ int QuestParserCollection::EventPlayerLocal(QuestEventID evt, Client *client, st } } else { if(_player_quest_status != QuestFailedToLoad) { - std::map::iterator iter = _interfaces.find(_player_quest_status); + auto iter = _interfaces.find(_player_quest_status); return iter->second->EventPlayer(evt, client, data, extra_data, extra_pointers); } } @@ -345,7 +345,7 @@ int QuestParserCollection::EventPlayerGlobal(QuestEventID evt, Client *client, s } } else { if(_global_player_quest_status != QuestFailedToLoad) { - std::map::iterator iter = _interfaces.find(_global_player_quest_status); + auto iter = _interfaces.find(_global_player_quest_status); return iter->second->EventGlobalPlayer(evt, client, data, extra_data, extra_pointers); } } @@ -367,11 +367,11 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst } uint32 item_id = item->GetID(); - std::map::iterator iter = _item_quest_status.find(item_id); + auto iter = _item_quest_status.find(item_id); if(iter != _item_quest_status.end()) { //loaded or failed to load if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); + auto qiter = _interfaces.find(iter->second); int ret = DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers); int i = qiter->second->EventItem(evt, client, item, mob, data, extra_data, extra_pointers); if(i != 0) { @@ -402,11 +402,11 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst int QuestParserCollection::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data, std::vector *extra_pointers) { - std::map::iterator iter = _spell_quest_status.find(spell_id); + auto iter = _spell_quest_status.find(spell_id); if(iter != _spell_quest_status.end()) { //loaded or failed to load if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); + auto qiter = _interfaces.find(iter->second); int ret = DispatchEventSpell(evt, npc, client, spell_id, extra_data, extra_pointers); int i = qiter->second->EventSpell(evt, npc, client, spell_id, extra_data, extra_pointers); if(i != 0) { @@ -441,7 +441,7 @@ int QuestParserCollection::EventEncounter(QuestEventID evt, std::string encounte if(iter != _encounter_quest_status.end()) { //loaded or failed to load if(iter->second != QuestFailedToLoad) { - std::map::iterator qiter = _interfaces.find(iter->second); + auto qiter = _interfaces.find(iter->second); return qiter->second->EventEncounter(evt, encounter_name, data, extra_data, extra_pointers); } } else { @@ -467,10 +467,10 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string std::string tmp; FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); + auto iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -511,7 +511,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -532,7 +532,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -553,7 +553,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -574,7 +574,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -595,7 +595,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -624,10 +624,10 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename) std::string tmp; FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); + auto iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -649,7 +649,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename) iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -670,7 +670,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename) iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -695,10 +695,10 @@ QuestInterface *QuestParserCollection::GetQIByGlobalNPCQuest(std::string &filena std::string tmp; FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); + auto iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -723,10 +723,10 @@ QuestInterface *QuestParserCollection::GetQIByGlobalPlayerQuest(std::string &fil std::string tmp; FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); + auto iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -751,10 +751,10 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s std::string tmp; FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); + auto iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -776,7 +776,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -797,7 +797,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -818,7 +818,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -843,10 +843,10 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, std::string tmp; FILE *f = nullptr; - std::list::iterator iter = _load_precedence.begin(); + auto iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -868,7 +868,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -889,7 +889,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); @@ -910,7 +910,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, iter = _load_precedence.begin(); while(iter != _load_precedence.end()) { tmp = filename; - std::map::iterator ext = _extensions.find((*iter)->GetIdentifier()); + auto ext = _extensions.find((*iter)->GetIdentifier()); tmp += "."; tmp += ext->second; f = fopen(tmp.c_str(), "r"); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 4a1980489..70c7c404f 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -207,7 +207,7 @@ Mob* QuestManager::spawn2(int npc_type, int grid, int unused, const glm::vec4& p const NPCType* tmp = 0; if (tmp = database.LoadNPCTypesData(npc_type)) { - NPC* npc = new NPC(tmp, nullptr, position, FlyMode3); + auto npc = new NPC(tmp, nullptr, position, FlyMode3); npc->AddLootTable(); entity_list.AddNPC(npc,true,true); if(grid > 0) @@ -229,7 +229,7 @@ Mob* QuestManager::unique_spawn(int npc_type, int grid, int unused, const glm::v const NPCType* tmp = 0; if (tmp = database.LoadNPCTypesData(npc_type)) { - NPC* npc = new NPC(tmp, nullptr, position, FlyMode3); + auto npc = new NPC(tmp, nullptr, position, FlyMode3); npc->AddLootTable(); entity_list.AddNPC(npc,true,true); if(grid > 0) @@ -303,19 +303,20 @@ Mob* QuestManager::spawn_from_spawn2(uint32 spawn2_id) found_spawn->SetCurrentNPCID(npcid); auto position = glm::vec4(found_spawn->GetX(), found_spawn->GetY(), found_spawn->GetZ(), found_spawn->GetHeading()); - NPC* npc = new NPC(tmp, found_spawn, position, FlyMode3); + auto npc = new NPC(tmp, found_spawn, position, FlyMode3); - found_spawn->SetNPCPointer(npc); - npc->AddLootTable(); - npc->SetSp2(found_spawn->SpawnGroupID()); - entity_list.AddNPC(npc); - entity_list.LimitAddNPC(npc); + found_spawn->SetNPCPointer(npc); + npc->AddLootTable(); + npc->SetSp2(found_spawn->SpawnGroupID()); + entity_list.AddNPC(npc); + entity_list.LimitAddNPC(npc); - if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && sg->min_delay) - npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay,sg->min_delay); - if(zone->InstantGrids()) - { - found_spawn->LoadGrid(); + if (sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && + sg->min_delay) + npc->AI_SetRoambox(sg->roamdist, sg->roambox[0], sg->roambox[1], sg->roambox[2], sg->roambox[3], + sg->delay, sg->min_delay); + if (zone->InstantGrids()) { + found_spawn->LoadGrid(); } return npc; @@ -327,7 +328,7 @@ Mob* QuestManager::spawn_from_spawn2(uint32 spawn2_id) void QuestManager::enable_spawn2(uint32 spawn2_id) { database.UpdateSpawn2Status(spawn2_id, 1); - ServerPacket* pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct)); + auto pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct)); ServerSpawnStatusChange_Struct* ssc = (ServerSpawnStatusChange_Struct*) pack->pBuffer; ssc->id = spawn2_id; ssc->new_status = 1; @@ -338,7 +339,7 @@ void QuestManager::enable_spawn2(uint32 spawn2_id) void QuestManager::disable_spawn2(uint32 spawn2_id) { database.UpdateSpawn2Status(spawn2_id, 0); - ServerPacket* pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct)); + auto pack = new ServerPacket(ServerOP_SpawnStatusChange, sizeof(ServerSpawnStatusChange_Struct)); ServerSpawnStatusChange_Struct* ssc = (ServerSpawnStatusChange_Struct*) pack->pBuffer; ssc->id = spawn2_id; ssc->new_status = 0; @@ -385,7 +386,7 @@ void QuestManager::Zone(const char *zone_name) { QuestManagerCurrentQuestVars(); if (initiator && initiator->IsClient()) { - ServerPacket* pack = new ServerPacket(ServerOP_ZoneToZoneRequest, sizeof(ZoneToZone_Struct)); + auto pack = new ServerPacket(ServerOP_ZoneToZoneRequest, sizeof(ZoneToZone_Struct)); ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer; ztz->response = 0; ztz->current_zone_id = zone->GetZoneID(); @@ -880,7 +881,7 @@ void QuestManager::safemove() { void QuestManager::rain(int weather) { QuestManagerCurrentQuestVars(); zone->zone_weather = weather; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weather, 8); + auto outapp = new EQApplicationPacket(OP_Weather, 8); *((uint32*) &outapp->pBuffer[4]) = (uint32) weather; // Why not just use 0x01/2/3? entity_list.QueueClients(owner, outapp); safe_delete(outapp); @@ -889,7 +890,7 @@ void QuestManager::rain(int weather) { void QuestManager::snow(int weather) { QuestManagerCurrentQuestVars(); zone->zone_weather = weather + 1; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weather, 8); + auto outapp = new EQApplicationPacket(OP_Weather, 8); outapp->pBuffer[0] = 0x01; *((uint32*) &outapp->pBuffer[4]) = (uint32)weather; entity_list.QueueClients(initiator, outapp); @@ -1253,7 +1254,7 @@ void QuestManager::setsky(uint8 new_sky) { QuestManagerCurrentQuestVars(); if (zone) zone->newzone_data.sky = new_sky; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); + auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size); entity_list.QueueClients(initiator, outapp); safe_delete(outapp); @@ -1401,23 +1402,23 @@ int QuestManager::InsertQuestGlobal(int charid, int npcid, int zoneid, const cha return 0; /* Delete existing qglobal data and update zone processes */ - ServerPacket* pack = new ServerPacket(ServerOP_QGlobalDelete, sizeof(ServerQGlobalDelete_Struct)); - ServerQGlobalDelete_Struct *qgd = (ServerQGlobalDelete_Struct*)pack->pBuffer; - qgd->npc_id = npcid; - qgd->char_id = charid; - qgd->zone_id = zoneid; - qgd->from_zone_id = zone->GetZoneID(); - qgd->from_instance_id = zone->GetInstanceID(); - strcpy(qgd->name, varname); + auto pack = new ServerPacket(ServerOP_QGlobalDelete, sizeof(ServerQGlobalDelete_Struct)); + ServerQGlobalDelete_Struct *qgd = (ServerQGlobalDelete_Struct *)pack->pBuffer; + qgd->npc_id = npcid; + qgd->char_id = charid; + qgd->zone_id = zoneid; + qgd->from_zone_id = zone->GetZoneID(); + qgd->from_instance_id = zone->GetInstanceID(); + strcpy(qgd->name, varname); - entity_list.DeleteQGlobal(std::string((char*)qgd->name), qgd->npc_id, qgd->char_id, qgd->zone_id); - zone->DeleteQGlobal(std::string((char*)qgd->name), qgd->npc_id, qgd->char_id, qgd->zone_id); + entity_list.DeleteQGlobal(std::string((char *)qgd->name), qgd->npc_id, qgd->char_id, qgd->zone_id); + zone->DeleteQGlobal(std::string((char *)qgd->name), qgd->npc_id, qgd->char_id, qgd->zone_id); - worldserver.SendPacket(pack); - safe_delete(pack); + worldserver.SendPacket(pack); + safe_delete(pack); - /* Create new qglobal data and update zone processes */ - pack = new ServerPacket(ServerOP_QGlobalUpdate, sizeof(ServerQGlobalUpdate_Struct)); + /* Create new qglobal data and update zone processes */ + pack = new ServerPacket(ServerOP_QGlobalUpdate, sizeof(ServerQGlobalUpdate_Struct)); ServerQGlobalUpdate_Struct *qgu = (ServerQGlobalUpdate_Struct*)pack->pBuffer; qgu->npc_id = npcid; qgu->char_id = charid; @@ -1481,19 +1482,19 @@ void QuestManager::delglobal(const char *varname) { if(!zone) return; - ServerPacket* pack = new ServerPacket(ServerOP_QGlobalDelete, sizeof(ServerQGlobalDelete_Struct)); - ServerQGlobalDelete_Struct *qgu = (ServerQGlobalDelete_Struct*)pack->pBuffer; + auto pack = new ServerPacket(ServerOP_QGlobalDelete, sizeof(ServerQGlobalDelete_Struct)); + ServerQGlobalDelete_Struct *qgu = (ServerQGlobalDelete_Struct *)pack->pBuffer; - qgu->npc_id = qgNpcid; - qgu->char_id = qgCharid; - qgu->zone_id = qgZoneid; - strcpy(qgu->name, varname); + qgu->npc_id = qgNpcid; + qgu->char_id = qgCharid; + qgu->zone_id = qgZoneid; + strcpy(qgu->name, varname); - entity_list.DeleteQGlobal(std::string((char*)qgu->name), qgu->npc_id, qgu->char_id, qgu->zone_id); - zone->DeleteQGlobal(std::string((char*)qgu->name), qgu->npc_id, qgu->char_id, qgu->zone_id); + entity_list.DeleteQGlobal(std::string((char *)qgu->name), qgu->npc_id, qgu->char_id, qgu->zone_id); + zone->DeleteQGlobal(std::string((char *)qgu->name), qgu->npc_id, qgu->char_id, qgu->zone_id); - worldserver.SendPacket(pack); - safe_delete(pack); + worldserver.SendPacket(pack); + safe_delete(pack); } // Converts duration string to duration value (in seconds) @@ -2479,7 +2480,7 @@ void QuestManager::UpdateSpawnTimer(uint32 id, uint32 newTime) { //Spawn wasn't in this zone... //Tell the other zones to update their spawn time for this spawn point - ServerPacket *pack = new ServerPacket(ServerOP_UpdateSpawn, sizeof(UpdateSpawnTimer_Struct)); + auto pack = new ServerPacket(ServerOP_UpdateSpawn, sizeof(UpdateSpawnTimer_Struct)); UpdateSpawnTimer_Struct *ust = (UpdateSpawnTimer_Struct*)pack->pBuffer; ust->id = id; ust->duration = newTime; @@ -2731,7 +2732,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam int sayid = 0; int sz = strlen(Phrase); - char *escaped_string = new char[sz * 2]; + auto escaped_string = new char[sz * 2]; database.DoEscapeString(escaped_string, Phrase, sz); // Query for an existing phrase and id in the saylink table @@ -2895,7 +2896,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen if(c) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_VoiceMacroOut, sizeof(VoiceMacroOut_Struct)); + auto outapp = new EQApplicationPacket(OP_VoiceMacroOut, sizeof(VoiceMacroOut_Struct)); VoiceMacroOut_Struct* vmo = (VoiceMacroOut_Struct*)outapp->pBuffer; @@ -2929,7 +2930,7 @@ void QuestManager::SendMail(const char *to, const char *from, const char *subjec } uint32 message_len = strlen(message) + 1; - ServerPacket* pack = new ServerPacket(ServerOP_UCSMailMessage, sizeof(ServerMailMessageHeader_Struct) + message_len); + auto pack = new ServerPacket(ServerOP_UCSMailMessage, sizeof(ServerMailMessageHeader_Struct) + message_len); ServerMailMessageHeader_Struct* mail = (ServerMailMessageHeader_Struct*) pack->pBuffer; strn0cpy(mail->to, to, 64); @@ -2962,7 +2963,7 @@ const char* QuestManager::GetZoneLongName(const char *zone) { } void QuestManager::CrossZoneSignalNPCByNPCTypeID(uint32 npctype_id, uint32 data){ - ServerPacket* pack = new ServerPacket(ServerOP_CZSignalNPC, sizeof(CZNPCSignal_Struct)); + auto pack = new ServerPacket(ServerOP_CZSignalNPC, sizeof(CZNPCSignal_Struct)); CZNPCSignal_Struct* CZSN = (CZNPCSignal_Struct*)pack->pBuffer; CZSN->npctype_id = npctype_id; CZSN->data = data; @@ -2971,7 +2972,7 @@ void QuestManager::CrossZoneSignalNPCByNPCTypeID(uint32 npctype_id, uint32 data) } void QuestManager::CrossZoneSignalPlayerByCharID(int charid, uint32 data){ - ServerPacket* pack = new ServerPacket(ServerOP_CZSignalClient, sizeof(CZClientSignal_Struct)); + auto pack = new ServerPacket(ServerOP_CZSignalClient, sizeof(CZClientSignal_Struct)); CZClientSignal_Struct* CZSC = (CZClientSignal_Struct*) pack->pBuffer; CZSC->charid = charid; CZSC->data = data; @@ -2981,7 +2982,7 @@ void QuestManager::CrossZoneSignalPlayerByCharID(int charid, uint32 data){ void QuestManager::CrossZoneSignalPlayerByName(const char *CharName, uint32 data){ uint32 message_len = strlen(CharName) + 1; - ServerPacket* pack = new ServerPacket(ServerOP_CZSignalClientByName, sizeof(CZClientSignalByName_Struct) + message_len); + auto pack = new ServerPacket(ServerOP_CZSignalClientByName, sizeof(CZClientSignalByName_Struct) + message_len); CZClientSignalByName_Struct* CZSC = (CZClientSignalByName_Struct*) pack->pBuffer; strn0cpy(CZSC->Name, CharName, 64); CZSC->data = data; @@ -2992,7 +2993,8 @@ void QuestManager::CrossZoneSignalPlayerByName(const char *CharName, uint32 data void QuestManager::CrossZoneMessagePlayerByName(uint32 Type, const char *CharName, const char *Message){ uint32 message_len = strlen(CharName) + 1; uint32 message_len2 = strlen(Message) + 1; - ServerPacket* pack = new ServerPacket(ServerOP_CZMessagePlayer, sizeof(CZMessagePlayer_Struct) + message_len + message_len2); + auto pack = + new ServerPacket(ServerOP_CZMessagePlayer, sizeof(CZMessagePlayer_Struct) + message_len + message_len2); CZMessagePlayer_Struct* CZSC = (CZMessagePlayer_Struct*) pack->pBuffer; CZSC->Type = Type; strn0cpy(CZSC->CharName, CharName, 64); @@ -3004,7 +3006,8 @@ void QuestManager::CrossZoneMessagePlayerByName(uint32 Type, const char *CharNam void QuestManager::CrossZoneSetEntityVariableByNPCTypeID(uint32 npctype_id, const char *id, const char *m_var){ uint32 message_len = strlen(id) + 1; uint32 message_len2 = strlen(m_var) + 1; - ServerPacket* pack = new ServerPacket(ServerOP_CZSetEntityVariableByNPCTypeID, sizeof(CZSetEntVarByNPCTypeID_Struct) + message_len + message_len2); + auto pack = new ServerPacket(ServerOP_CZSetEntityVariableByNPCTypeID, + sizeof(CZSetEntVarByNPCTypeID_Struct) + message_len + message_len2); CZSetEntVarByNPCTypeID_Struct* CZSNBYNID = (CZSetEntVarByNPCTypeID_Struct*)pack->pBuffer; CZSNBYNID->npctype_id = npctype_id; strn0cpy(CZSNBYNID->id, id, 256); @@ -3152,8 +3155,8 @@ void QuestManager::UpdateZoneHeader(std::string type, std::string value) { zone->newzone_data.fog_density = atof(value.c_str()); else if (strcasecmp(type.c_str(), "suspendbuffs") == 0) zone->newzone_data.SuspendBuffs = atoi(value.c_str()); - - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); + + auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct)); memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size); entity_list.QueueClients(0, outapp); safe_delete(outapp); diff --git a/zone/raids.cpp b/zone/raids.cpp index 45866884f..ff9e84578 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -121,7 +121,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo c->SetRaidGrouped(true); SendRaidMOTD(c); - ServerPacket *pack = new ServerPacket(ServerOP_RaidAdd, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidAdd, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, c->GetName(), 64); @@ -146,7 +146,7 @@ void Raid::RemoveMember(const char *characterName) if(client) client->SetRaidGrouped(false); - ServerPacket *pack = new ServerPacket(ServerOP_RaidRemove, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidRemove, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->instance_id = zone->GetInstanceID(); @@ -165,7 +165,7 @@ void Raid::DisbandRaid() VerifyRaid(); SendRaidDisbandAll(); - ServerPacket *pack = new ServerPacket(ServerOP_RaidDisband, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidDisband, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, " ", 64); @@ -187,7 +187,7 @@ void Raid::MoveMember(const char *name, uint32 newGroup) VerifyRaid(); SendRaidMoveAll(name); - ServerPacket *pack = new ServerPacket(ServerOP_RaidChangeGroup, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidChangeGroup, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, name, 64); @@ -206,7 +206,7 @@ void Raid::SetGroupLeader(const char *who, bool glFlag) LearnMembers(); VerifyRaid(); - ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupLeader, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidGroupLeader, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, who, 64); @@ -250,7 +250,7 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) VerifyRaid(); SendMakeLeaderPacket(name); - ServerPacket *pack = new ServerPacket(ServerOP_RaidLeader, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidLeader, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, name, 64); @@ -262,7 +262,7 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) void Raid::SaveGroupLeaderAA(uint32 gid) { - char *queryBuffer = new char[sizeof(GroupLeadershipAA_Struct) * 2 + 1]; + auto queryBuffer = new char[sizeof(GroupLeadershipAA_Struct) * 2 + 1]; database.DoEscapeString(queryBuffer, (char*)&group_aa[gid], sizeof(GroupLeadershipAA_Struct)); std::string query = "UPDATE raid_leaders SET leadershipaa = '"; @@ -276,7 +276,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid) void Raid::SaveRaidLeaderAA() { - char *queryBuffer = new char[sizeof(RaidLeadershipAA_Struct) * 2 + 1]; + auto queryBuffer = new char[sizeof(RaidLeadershipAA_Struct) * 2 + 1]; database.DoEscapeString(queryBuffer, (char*)&raid_aa, sizeof(RaidLeadershipAA_Struct)); std::string query = "UPDATE raid_leaders SET leadershipaa = '"; @@ -414,7 +414,7 @@ void Raid::RaidSay(const char *msg, Client *c) if(!c) return; - ServerPacket *pack = new ServerPacket(ServerOP_RaidSay, sizeof(ServerRaidMessage_Struct) + strlen(msg) + 1); + auto pack = new ServerPacket(ServerOP_RaidSay, sizeof(ServerRaidMessage_Struct) + strlen(msg) + 1); ServerRaidMessage_Struct *rga = (ServerRaidMessage_Struct*)pack->pBuffer; rga->rid = GetID(); rga->gid = 0xFFFFFFFF; @@ -436,7 +436,7 @@ void Raid::RaidGroupSay(const char *msg, Client *c) if(groupToUse > 11) return; - ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupSay, sizeof(ServerRaidMessage_Struct) + strlen(msg) + 1); + auto pack = new ServerPacket(ServerOP_RaidGroupSay, sizeof(ServerRaidMessage_Struct) + strlen(msg) + 1); ServerRaidMessage_Struct *rga = (ServerRaidMessage_Struct*)pack->pBuffer; rga->rid = GetID(); rga->gid = groupToUse; @@ -852,7 +852,7 @@ void Raid::AddRaidLooter(const char* looter) break; } } - ServerPacket *pack = new ServerPacket(ServerOP_DetailsChange, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_DetailsChange, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->zoneid = zone->GetZoneID(); @@ -872,7 +872,7 @@ void Raid::RemoveRaidLooter(const char* looter) break; } - ServerPacket *pack = new ServerPacket(ServerOP_DetailsChange, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_DetailsChange, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->zoneid = zone->GetZoneID(); @@ -925,7 +925,7 @@ void Raid::SendRaidCreate(Client *to){ if(!to) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidJoin,sizeof(RaidCreate_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidJoin, sizeof(RaidCreate_Struct)); RaidCreate_Struct *rc = (RaidCreate_Struct*)outapp->pBuffer; rc->action = raidCreate; strn0cpy(rc->leader_name, leadername, 64); @@ -943,7 +943,7 @@ void Raid::SendRaidAdd(const char *who, Client *to) { if(strcmp(members[x].membername, who) == 0) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidAddMember_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidAddMember_Struct)); RaidAddMember_Struct *ram = (RaidAddMember_Struct*)outapp->pBuffer; ram->raidGen.action = raidAdd; ram->raidGen.parameter = members[x].GroupNumber; @@ -965,7 +965,7 @@ void Raid::SendRaidAddAll(const char *who) { if(strcmp(members[x].membername, who) == 0) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidAddMember_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidAddMember_Struct)); RaidAddMember_Struct *ram = (RaidAddMember_Struct*)outapp->pBuffer; ram->raidGen.action = raidAdd; ram->raidGen.parameter = members[x].GroupNumber; @@ -990,7 +990,7 @@ void Raid::SendRaidRemove(const char *who, Client *to) { if(strcmp(members[x].membername, who) == 0) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; rg->action = raidRemove2; strn0cpy(rg->leader_name, who, 64); @@ -1009,7 +1009,7 @@ void Raid::SendRaidRemoveAll(const char *who) { if(strcmp(members[x].membername, who) == 0) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; rg->action = raidRemove2; strn0cpy(rg->leader_name, who, 64); @@ -1027,7 +1027,7 @@ void Raid::SendRaidDisband(Client *to) if(!to) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; rg->action = raidDisband; strn0cpy(rg->leader_name, to->GetName(), 64); @@ -1039,7 +1039,7 @@ void Raid::SendRaidDisband(Client *to) void Raid::SendRaidDisbandAll() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; rg->action = raidDisband; strn0cpy(rg->leader_name, "RaidMember", 64); @@ -1110,7 +1110,7 @@ void Raid::QueuePacket(const EQApplicationPacket *app, bool ack_req) void Raid::SendMakeLeaderPacket(const char *who) //30 { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); RaidLeadershipUpdate_Struct *rg = (RaidLeadershipUpdate_Struct*)outapp->pBuffer; rg->action = raidMakeLeader; strn0cpy(rg->leader_name, who, 64); @@ -1125,7 +1125,7 @@ void Raid::SendMakeLeaderPacketTo(const char *who, Client *to) if(!to) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); RaidLeadershipUpdate_Struct *rg = (RaidLeadershipUpdate_Struct*)outapp->pBuffer; rg->action = raidMakeLeader; strn0cpy(rg->leader_name, who, 64); @@ -1155,7 +1155,7 @@ void Raid::SendGroupUpdate(Client *to) if(!to) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupUpdate2_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate2_Struct)); GroupUpdate2_Struct* gu = (GroupUpdate2_Struct*)outapp->pBuffer; gu->action = groupActUpdate; int index = 0; @@ -1209,7 +1209,7 @@ void Raid::GroupUpdate(uint32 gid, bool initial) } } if(initial){ - ServerPacket *pack = new ServerPacket(ServerOP_UpdateGroup, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_UpdateGroup, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct* rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->gid = gid; rga->rid = GetID(); @@ -1222,7 +1222,7 @@ void Raid::GroupUpdate(uint32 gid, bool initial) void Raid::SendRaidLock() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; rg->action = raidLock; strn0cpy(rg->leader_name, leadername, 64); @@ -1233,7 +1233,7 @@ void Raid::SendRaidLock() void Raid::SendRaidUnlock() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; rg->action = raidUnlock; strn0cpy(rg->leader_name, leadername, 64); @@ -1247,7 +1247,7 @@ void Raid::SendRaidLockTo(Client *c) if(!c) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; rg->action = raidLock; strn0cpy(rg->leader_name, c->GetName(), 64); @@ -1261,7 +1261,7 @@ void Raid::SendRaidUnlockTo(Client *c) if(!c) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; rg->action = raidUnlock; strn0cpy(rg->leader_name, c->GetName(), 64); @@ -1275,7 +1275,7 @@ void Raid::SendGroupDisband(Client *to) if(!to) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate_Struct)); GroupUpdate_Struct* gu = (GroupUpdate_Struct*) outapp->pBuffer; gu->action = groupActDisband; strn0cpy(gu->leadersname, leadername, 64); @@ -1285,7 +1285,7 @@ void Raid::SendGroupDisband(Client *to) void Raid::SendRaidGroupAdd(const char *who, uint32 gid) { - ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupAdd, sizeof(ServerRaidGroupAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidGroupAdd, sizeof(ServerRaidGroupAction_Struct)); ServerRaidGroupAction_Struct * rga = (ServerRaidGroupAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->gid = gid; @@ -1295,7 +1295,7 @@ void Raid::SendRaidGroupAdd(const char *who, uint32 gid) void Raid::SendRaidGroupRemove(const char *who, uint32 gid) { - ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupRemove, sizeof(ServerRaidGroupAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidGroupRemove, sizeof(ServerRaidGroupAction_Struct)); ServerRaidGroupAction_Struct * rga = (ServerRaidGroupAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->gid = gid; @@ -1309,7 +1309,7 @@ void Raid::SendRaidMOTD(Client *c) return; size_t size = motd.size() + 1; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidMOTD_Struct) + size); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidMOTD_Struct) + size); RaidMOTD_Struct *rmotd = (RaidMOTD_Struct *)outapp->pBuffer; rmotd->general.action = raidSetMotd; strn0cpy(rmotd->general.player_name, c->GetName(), 64); @@ -1333,7 +1333,7 @@ void Raid::SendRaidMOTDToWorld() return; size_t size = motd.size() + 1; - ServerPacket *pack = new ServerPacket(ServerOP_RaidMOTD, sizeof(ServerRaidMOTD_Struct) + size); + auto pack = new ServerPacket(ServerOP_RaidMOTD, sizeof(ServerRaidMOTD_Struct) + size); ServerRaidMOTD_Struct *smotd = (ServerRaidMOTD_Struct *)pack->pBuffer; smotd->rid = GetID(); strn0cpy(smotd->motd, motd.c_str(), size); @@ -1343,7 +1343,7 @@ void Raid::SendRaidMOTDToWorld() void Raid::SendGroupLeadershipAA(Client *c, uint32 gid) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); RaidLeadershipUpdate_Struct *rlaa = (RaidLeadershipUpdate_Struct *)outapp->pBuffer; rlaa->action = raidSetLeaderAbilities; strn0cpy(rlaa->leader_name, c->GetName(), 64); @@ -1381,7 +1381,7 @@ void Raid::LockRaid(bool lockFlag) else SendRaidUnlock(); - ServerPacket *pack = new ServerPacket(ServerOP_RaidLockFlag, sizeof(ServerRaidGeneralAction_Struct)); + auto pack = new ServerPacket(ServerOP_RaidLockFlag, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->zoneid = zone->GetZoneID(); diff --git a/zone/raycast_mesh.cpp b/zone/raycast_mesh.cpp index 078f225a1..e2e88b100 100644 --- a/zone/raycast_mesh.cpp +++ b/zone/raycast_mesh.cpp @@ -518,8 +518,7 @@ public: // Copy the triangle indices into the leaf triangles array mLeafTriangleIndex = leafTriangles.size(); // assign the array start location for these leaf triangles. leafTriangles.push_back(count); - for (TriVector::const_iterator i=triangles.begin(); i!=triangles.end(); ++i) - { + for (auto i = triangles.begin(); i != triangles.end(); ++i) { RmUint32 tri = *i; leafTriangles.push_back(tri); } @@ -541,8 +540,7 @@ public: // Create two arrays; one of all triangles which intersect the 'left' half of the bounding volume node // and another array that includes all triangles which intersect the 'right' half of the bounding volume node. - for (TriVector::const_iterator i=triangles.begin(); i!=triangles.end(); ++i) - { + for (auto i = triangles.begin(); i != triangles.end(); ++i) { RmUint32 tri = (*i); @@ -934,7 +932,7 @@ RaycastMesh * createRaycastMesh(RmUint32 vcount, // The number of vertices in t RmReal minAxisSize // once a particular axis is less than this size, stop sub-dividing. ) { - MyRaycastMesh *m = new MyRaycastMesh(vcount,vertices,tcount,indices,maxDepth,minLeafSize,minAxisSize); + auto m = new MyRaycastMesh(vcount, vertices, tcount, indices, maxDepth, minLeafSize, minAxisSize); return static_cast< RaycastMesh * >(m); } diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 7cb3b1f3c..ad5f3d89a 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -574,9 +574,9 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 bool perl_enabled = atoi(row[11]) == 1 ? true : false; - Spawn2* newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), - atof(row[5]), atoi(row[6]), atoi(row[7]), timeleft, atoi(row[8]), - atoi(row[9]), atoi(row[10]), perl_enabled, (EmuAppearance)atoi(row[12])); + auto newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), + atoi(row[6]), atoi(row[7]), timeleft, atoi(row[8]), atoi(row[9]), atoi(row[10]), + perl_enabled, (EmuAppearance)atoi(row[12])); spawn2_list.Insert(newSpawn); @@ -1128,7 +1128,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance UpdateDBCondition(zone_short, instance_id, condition_id, new_value); - ServerPacket* pack = new ServerPacket(ServerOP_SpawnCondition, sizeof(ServerSpawnCondition_Struct)); + auto pack = new ServerPacket(ServerOP_SpawnCondition, sizeof(ServerSpawnCondition_Struct)); ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*)pack->pBuffer; ssc->zoneID = database.GetZoneID(zone_short); @@ -1260,7 +1260,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri //now notify the zone - ServerPacket* pack = new ServerPacket(ServerOP_SpawnEvent, sizeof(ServerSpawnEvent_Struct)); + auto pack = new ServerPacket(ServerOP_SpawnEvent, sizeof(ServerSpawnEvent_Struct)); ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*)pack->pBuffer; sse->zoneID = database.GetZoneID(zone_short_name.c_str()); diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index a810cc9f8..94b2ed285 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -154,9 +154,9 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG } for (auto row = results.begin(); row != results.end(); ++row) { - SpawnGroup *newSpawnGroup = new SpawnGroup(atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), - atof(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), - atoi(row[8]), atoi(row[9]), atoi(row[10]), atoi(row[11])); + auto newSpawnGroup = new SpawnGroup(atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), atof(row[4]), + atof(row[5]), atof(row[6]), atof(row[7]), atoi(row[8]), + atoi(row[9]), atoi(row[10]), atoi(row[11])); spawn_group_list->AddSpawnGroup(newSpawnGroup); } @@ -174,7 +174,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG } for (auto row = results.begin(); row != results.end(); ++row) { - SpawnEntry *newSpawnEntry = new SpawnEntry(atoi(row[1]), atoi(row[2]), row[3] ? atoi(row[3]) : 0); + auto newSpawnEntry = new SpawnEntry(atoi(row[1]), atoi(row[2]), row[3] ? atoi(row[3]) : 0); SpawnGroup *sg = spawn_group_list->GetSpawnGroup(atoi(row[0])); if (!sg) { @@ -203,9 +203,9 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList *spawn_g } for (auto row = results.begin(); row != results.end(); ++row) { - SpawnGroup *newSpawnGroup = new SpawnGroup(atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), - atof(row[4]), atof(row[5]), atof(row[6]), atof(row[7]), - atoi(row[8]), atoi(row[9]), atoi(row[10]), atoi(row[11])); + auto newSpawnGroup = new SpawnGroup(atoi(row[0]), row[1], atoi(row[2]), atof(row[3]), atof(row[4]), + atof(row[5]), atof(row[6]), atof(row[7]), atoi(row[8]), + atoi(row[9]), atoi(row[10]), atoi(row[11])); spawn_group_list->AddSpawnGroup(newSpawnGroup); } @@ -221,7 +221,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList *spawn_g } for (auto row = results.begin(); row != results.end(); ++row) { - SpawnEntry *newSpawnEntry = new SpawnEntry(atoi(row[1]), atoi(row[2]), row[3] ? atoi(row[3]) : 0); + auto newSpawnEntry = new SpawnEntry(atoi(row[1]), atoi(row[2]), row[3] ? atoi(row[3]) : 0); SpawnGroup *sg = spawn_group_list->GetSpawnGroup(atoi(row[0])); if (!sg) { safe_delete(newSpawnEntry); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index c54737475..674c15d03 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1581,7 +1581,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const EQE } void Mob::SendItemAnimation(Mob *to, const EQEmu::Item_Struct *item, SkillUseTypes skillInUse, float velocity) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SomeItemPacketMaybe, sizeof(Arrow_Struct)); + auto outapp = new EQApplicationPacket(OP_SomeItemPacketMaybe, sizeof(Arrow_Struct)); Arrow_Struct *as = (Arrow_Struct *) outapp->pBuffer; as->type = 1; as->src_x = GetX(); @@ -1671,7 +1671,7 @@ void Mob::ProjectileAnimation(Mob* to, int item_id, bool IsArrow, float speed, f item_IDFile = IDFile; // See SendItemAnimation() for some notes on this struct - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SomeItemPacketMaybe, sizeof(Arrow_Struct)); + auto outapp = new EQApplicationPacket(OP_SomeItemPacketMaybe, sizeof(Arrow_Struct)); Arrow_Struct *as = (Arrow_Struct *) outapp->pBuffer; as->type = 1; as->src_x = GetX(); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 79dda2125..35d1c64bd 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -765,7 +765,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove SetPetType(petCharmed); if(caster->IsClient()){ - EQApplicationPacket *app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct)); + auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct)); Charm_Struct *ps = (Charm_Struct*)app->pBuffer; ps->owner_id = caster->GetID(); ps->pet_id = this->GetID(); @@ -892,9 +892,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove { if(CastToClient()->GetGM() || RuleB(Character, BindAnywhere)) { - EQApplicationPacket *action_packet = new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); + auto action_packet = + new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); Action_Struct* action = (Action_Struct*) action_packet->pBuffer; - EQApplicationPacket *message_packet = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); + auto message_packet = + new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct *cd = (CombatDamage_Struct *)message_packet->pBuffer; action->target = GetID(); @@ -941,9 +943,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove } else { - EQApplicationPacket *action_packet = new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); + auto action_packet = new EQApplicationPacket( + OP_Action, sizeof(Action_Struct)); Action_Struct* action = (Action_Struct*) action_packet->pBuffer; - EQApplicationPacket *message_packet = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); + auto message_packet = new EQApplicationPacket( + OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct *cd = (CombatDamage_Struct *)message_packet->pBuffer; action->target = GetID(); @@ -977,9 +981,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove } else { - EQApplicationPacket *action_packet = new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); + auto action_packet = + new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); Action_Struct* action = (Action_Struct*) action_packet->pBuffer; - EQApplicationPacket *message_packet = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); + auto message_packet = new EQApplicationPacket( + OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct *cd = (CombatDamage_Struct *)message_packet->pBuffer; action->target = GetID(); @@ -2064,7 +2070,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove double new_x = spells[spell_id].pushback * sin(double(look_heading * 3.141592 / 180.0)); double new_y = spells[spell_id].pushback * cos(double(look_heading * 3.141592 / 180.0)); - EQApplicationPacket* outapp_push = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); + auto outapp_push = + new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)outapp_push->pBuffer; spu->spawn_id = GetID(); @@ -3922,7 +3929,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) } if(tempmob && tempmob->IsClient()) { - EQApplicationPacket *app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct)); + auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct)); Charm_Struct *ps = (Charm_Struct*)app->pBuffer; ps->owner_id = tempmob->GetID(); ps->pet_id = this->GetID(); @@ -6782,7 +6789,7 @@ void Client::BreakSneakWhenCastOn(Mob* caster, bool IsResisted) //TODO: The skill buttons should reset when this occurs. Not sure how to force that yet. - Kayen hidden = false; improved_hidden = false; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); + auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer; sa_out->spawn_id = GetID(); sa_out->type = 0x03; diff --git a/zone/spells.cpp b/zone/spells.cpp index dbf89a5cc..f4eb422cb 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1986,7 +1986,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(IsAEDurationSpell(spell_id)) { // the spells are AE target, but we aim them on a beacon Mob *beacon_loc = spell_target ? spell_target : this; - Beacon *beacon = new Beacon(beacon_loc, spells[spell_id].AEDuration); + auto beacon = new Beacon(beacon_loc, spells[spell_id].AEDuration); entity_list.AddBeacon(beacon); Log.Out(Logs::Detail, Logs::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); spell_target = nullptr; @@ -2335,7 +2335,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 database.UpdateItemRecastTimestamps( CastToClient()->CharacterID(), recast_type, CastToClient()->GetPTimers().Get(pTimerItemStart + recast_type)->GetReadyTimestamp()); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ItemRecastDelay, sizeof(ItemRecastDelay_Struct)); + auto outapp = new EQApplicationPacket(OP_ItemRecastDelay, sizeof(ItemRecastDelay_Struct)); ItemRecastDelay_Struct *ird = (ItemRecastDelay_Struct *)outapp->pBuffer; ird->recast_delay = itm->GetItem()->RecastDelay; ird->recast_type = recast_type; @@ -2530,7 +2530,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { //be a lot of traffic for no reason... //this may be the wrong packet... if(IsClient()) { - EQApplicationPacket *packet = new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); + auto packet = new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); Action_Struct* action = (Action_Struct*) packet->pBuffer; action->source = caster->GetID(); @@ -2558,7 +2558,8 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { CastToClient()->SetKnockBackExemption(true); action->buff_unknown = 0; - EQApplicationPacket* outapp_push = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); + auto outapp_push = new EQApplicationPacket( + OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)outapp_push->pBuffer; double look_heading = caster->CalculateHeadingToTarget(GetX(), GetY()); @@ -2602,7 +2603,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { CastToClient()->QueuePacket(packet); } - EQApplicationPacket *message_packet = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); + auto message_packet = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct *cd = (CombatDamage_Struct *)message_packet->pBuffer; cd->target = action->target; cd->source = action->source; @@ -3833,7 +3834,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r spelltar->CastToClient()->SetKnockBackExemption(true); action->buff_unknown = 0; - EQApplicationPacket* outapp_push = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); + auto outapp_push = + new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)outapp_push->pBuffer; double look_heading = CalculateHeadingToTarget(spelltar->GetX(), spelltar->GetY()); @@ -3923,7 +3925,7 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster) } */ - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); + auto outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); Resurrect_Struct* rezz = (Resurrect_Struct*) outapp->pBuffer; // Why are we truncating these names to 30 characters ? memcpy(rezz->your_name,this->corpse_name,30); @@ -4695,7 +4697,7 @@ float Mob::GetAOERange(uint16 spell_id) { void Mob::Spin() { if(IsClient()) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); + auto outapp = new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); outapp->pBuffer[0] = 0x0B; outapp->pBuffer[1] = 0x0A; outapp->pBuffer[2] = 0x0B; @@ -4742,7 +4744,7 @@ void Mob::SendSpellBarEnable(uint16 spell_id) if(!IsClient()) return; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ManaChange, sizeof(ManaChange_Struct)); + auto outapp = new EQApplicationPacket(OP_ManaChange, sizeof(ManaChange_Struct)); ManaChange_Struct* manachange = (ManaChange_Struct*)outapp->pBuffer; manachange->new_mana = GetMana(); manachange->spell_id = spell_id; @@ -4786,7 +4788,7 @@ void Client::Stun(int duration) { Mob::Stun(duration); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Stun, sizeof(Stun_Struct)); + auto outapp = new EQApplicationPacket(OP_Stun, sizeof(Stun_Struct)); Stun_Struct* stunon = (Stun_Struct*) outapp->pBuffer; stunon->duration = duration; outapp->priority = 5; @@ -4797,7 +4799,7 @@ void Client::Stun(int duration) void Client::UnStun() { Mob::UnStun(); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Stun, sizeof(Stun_Struct)); + auto outapp = new EQApplicationPacket(OP_Stun, sizeof(Stun_Struct)); Stun_Struct* stunon = (Stun_Struct*) outapp->pBuffer; stunon->duration = 0; outapp->priority = 5; @@ -4973,7 +4975,7 @@ void Client::UnscribeSpell(int slot, bool update_client) database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); if(update_client) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_DeleteSpell, sizeof(DeleteSpell_Struct)); + auto outapp = new EQApplicationPacket(OP_DeleteSpell, sizeof(DeleteSpell_Struct)); DeleteSpell_Struct* del = (DeleteSpell_Struct*)outapp->pBuffer; del->spell_slot = slot; del->success = 1; @@ -5428,7 +5430,7 @@ void Mob::SendPetBuffsToClient() int PetBuffCount = 0; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetBuffWindow,sizeof(PetBuff_Struct)); + auto outapp = new EQApplicationPacket(OP_PetBuffWindow, sizeof(PetBuff_Struct)); PetBuff_Struct* pbs=(PetBuff_Struct*)outapp->pBuffer; memset(outapp->pBuffer,0,outapp->size); pbs->petid=GetID(); diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 8946673a4..fb5c867c9 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -850,7 +850,7 @@ int TaskManager::FirstTaskInSet(int TaskSetID) { if(TaskSets[TaskSetID].empty()) return 0; - std::vector::iterator Iterator = TaskSets[TaskSetID].begin(); + auto Iterator = TaskSets[TaskSetID].begin(); while(Iterator != TaskSets[TaskSetID].end()) { if((*Iterator) > 0) @@ -934,7 +934,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i if(TaskSets[TaskSetID][0] == 0) { Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); - std::vector::iterator Iterator = TaskSets[TaskSetID].begin(); + auto Iterator = TaskSets[TaskSetID].begin(); while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) { if(AppropriateLevel((*Iterator), PlayerLevel) && !state->IsTaskActive((*Iterator)) && @@ -1039,7 +1039,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task if(ValidTasks == 0) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_OpenNewTasksWindow, PacketLength); + auto outapp = new EQApplicationPacket(OP_OpenNewTasksWindow, PacketLength); AvailableTaskHeader = (AvailableTaskHeader_Struct*)outapp->pBuffer; @@ -1164,7 +1164,7 @@ void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *T if(ValidTasks == 0) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_OpenNewTasksWindow, PacketLength); + auto outapp = new EQApplicationPacket(OP_OpenNewTasksWindow, PacketLength); outapp->WriteUInt32(ValidTasks); // TaskCount outapp->WriteUInt32(2); // Unknown2 @@ -1333,7 +1333,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) { if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { Log.Out(Logs::General, Logs::Tasks, "[UPDATE] KeepOneRecord enabled"); - std::vector::iterator Iterator = CompletedTasks.begin(); + auto Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { int TaskID = (*Iterator).TaskID; @@ -1406,7 +1406,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // the same task again, erase the previous completed entry for this task. if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { Log.Out(Logs::General, Logs::Tasks, "[UPDATE] KeepOneRecord enabled"); - std::vector::iterator Iterator = CompletedTasks.begin(); + auto Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { int TaskID = (*Iterator).TaskID; @@ -2325,9 +2325,7 @@ void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) { } } - - - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskHistoryReply, PacketLength); + auto outapp = new EQApplicationPacket(OP_TaskHistoryReply, PacketLength); ths = (TaskHistoryReplyHeader_Struct*)outapp->pBuffer; @@ -2370,7 +2368,7 @@ void Client::SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, TaskActivityComplete_Struct* tac; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskActivityComplete, sizeof(TaskActivityComplete_Struct)); + auto outapp = new EQApplicationPacket(OP_TaskActivityComplete, sizeof(TaskActivityComplete_Struct)); tac = (TaskActivityComplete_Struct*)outapp->pBuffer; @@ -2400,7 +2398,7 @@ void Client::SendTaskFailed(int TaskID, int TaskIndex) { TaskActivityComplete_Struct* tac; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskActivityComplete, sizeof(TaskActivityComplete_Struct)); + auto outapp = new EQApplicationPacket(OP_TaskActivityComplete, sizeof(TaskActivityComplete_Struct)); tac = (TaskActivityComplete_Struct*)outapp->pBuffer; @@ -2450,7 +2448,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State) PacketLength = PacketLength + 8 + strlen(Tasks[TaskID]->Title) + 1; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_CompletedTasks, PacketLength); + auto outapp = new EQApplicationPacket(OP_CompletedTasks, PacketLength); char *buf = (char*)outapp->pBuffer; //*(uint32 *)buf = State->CompletedTasks.size(); @@ -2487,7 +2485,7 @@ void TaskManager::SendTaskActivityShort(Client *c, int TaskID, int ActivityID, i if (c->ClientVersionBit() & EQEmu::versions::bit_RoFAndLater) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskActivity, 25); + auto outapp = new EQApplicationPacket(OP_TaskActivity, 25); outapp->WriteUInt32(ClientTaskIndex); outapp->WriteUInt32(2); outapp->WriteUInt32(TaskID); @@ -2500,7 +2498,7 @@ void TaskManager::SendTaskActivityShort(Client *c, int TaskID, int ActivityID, i return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskActivity, sizeof(TaskActivityShort_Struct)); + auto outapp = new EQApplicationPacket(OP_TaskActivity, sizeof(TaskActivityShort_Struct)); tass = (TaskActivityShort_Struct*)outapp->pBuffer; @@ -2538,7 +2536,7 @@ void TaskManager::SendTaskActivityLong(Client *c, int TaskID, int ActivityID, in strlen(Tasks[TaskID]->Activity[ActivityID].Text2) + 1 + strlen(Tasks[TaskID]->Activity[ActivityID].Text3) + 1; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskActivity, PacketLength); + auto outapp = new EQApplicationPacket(OP_TaskActivity, PacketLength); tah = (TaskActivityHeader_Struct*)outapp->pBuffer; @@ -2619,7 +2617,7 @@ void TaskManager::SendTaskActivityNew(Client *c, int TaskID, int ActivityID, int ((strlen(itoa(Tasks[TaskID]->Activity[ActivityID].ZoneID)) + 1) * 2) + 3 + String2Len; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskActivity, PacketLength); + auto outapp = new EQApplicationPacket(OP_TaskActivity, PacketLength); outapp->WriteUInt32(ClientTaskIndex); // TaskSequenceNumber outapp->WriteUInt32(2); // unknown2 @@ -2805,7 +2803,7 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN TaskDescriptionData2_Struct* tdd2; TaskDescriptionTrailer_Struct* tdt; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TaskDescription, PacketLength); + auto outapp = new EQApplicationPacket(OP_TaskDescription, PacketLength); tdh = (TaskDescriptionHeader_Struct*)outapp->pBuffer; @@ -2924,7 +2922,7 @@ void ClientTaskState::CancelAllTasks(Client *c) { } void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromDB) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_CancelTask, sizeof(CancelTask_Struct)); + auto outapp = new EQApplicationPacket(OP_CancelTask, sizeof(CancelTask_Struct)); CancelTask_Struct* cts = (CancelTask_Struct*)outapp->pBuffer; cts->SequenceNumber = SequenceNumber; diff --git a/zone/titles.cpp b/zone/titles.cpp index 8e6115aee..1e0cc7cb7 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -91,7 +91,7 @@ EQApplicationPacket *TitleManager::MakeTitlesPacket(Client *c) } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendTitleList, Length); + auto outapp = new EQApplicationPacket(OP_SendTitleList, Length); char *Buffer = (char *)outapp->pBuffer; @@ -243,7 +243,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) if(!client || !title) return; - char *escTitle = new char[strlen(title) * 2 + 1]; + auto escTitle = new char[strlen(title) * 2 + 1]; client->SetAATitle(title); @@ -265,7 +265,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) return; } - ServerPacket* pack = new ServerPacket(ServerOP_ReloadTitles, 0); + auto pack = new ServerPacket(ServerOP_ReloadTitles, 0); worldserver.SendPacket(pack); safe_delete(pack); } @@ -277,8 +277,8 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) client->SetTitleSuffix(suffix); - char *escSuffix = new char[strlen(suffix) * 2 + 1]; - database.DoEscapeString(escSuffix, suffix, strlen(suffix)); + auto escSuffix = new char[strlen(suffix) * 2 + 1]; + database.DoEscapeString(escSuffix, suffix, strlen(suffix)); std::string query = StringFormat("SELECT `id` FROM titles " "WHERE `suffix` = '%s' AND char_id = %i", @@ -297,7 +297,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) return; } - ServerPacket* pack = new ServerPacket(ServerOP_ReloadTitles, 0); + auto pack = new ServerPacket(ServerOP_ReloadTitles, 0); worldserver.SendPacket(pack); safe_delete(pack); } @@ -306,7 +306,7 @@ void Client::SetAATitle(const char *Title) { strn0cpy(m_pp.title, Title, sizeof(m_pp.title)); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SetTitleReply, sizeof(SetTitleReply_Struct)); + auto outapp = new EQApplicationPacket(OP_SetTitleReply, sizeof(SetTitleReply_Struct)); SetTitleReply_Struct *strs = (SetTitleReply_Struct *)outapp->pBuffer; @@ -323,7 +323,7 @@ void Client::SetTitleSuffix(const char *Suffix) { strn0cpy(m_pp.suffix, Suffix, sizeof(m_pp.suffix)); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SetTitleReply, sizeof(SetTitleReply_Struct)); + auto outapp = new EQApplicationPacket(OP_SetTitleReply, sizeof(SetTitleReply_Struct)); SetTitleReply_Struct *strs = (SetTitleReply_Struct *)outapp->pBuffer; diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index a5e931e62..2a3a3cdfe 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -212,7 +212,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if (worldo) { container->Clear(); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClearObject, sizeof(ClearObject_Struct)); + auto outapp = new EQApplicationPacket(OP_ClearObject, sizeof(ClearObject_Struct)); ClearObject_Struct *cos = (ClearObject_Struct *)outapp->pBuffer; cos->Clear = 1; user->QueuePacket(outapp); @@ -305,7 +305,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob else if (inst) { user->Message_StringID(4, TRANSFORM_FAILED, inst->GetItem()->Name); } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -323,7 +323,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob else if (inst) { user->Message_StringID(4, DETRANSFORM_FAILED, inst->GetItem()->Name); } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -332,7 +332,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) { user->Message_StringID(MT_Emote,TRADESKILL_NOCOMBINE); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -347,7 +347,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if ((spec.must_learn&0xF) == 1 && !spec.has_learnt) { // Made up message for the client. Just giving a DNC is the other option. user->Message(4, "You need to learn how to combine these first."); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -356,7 +356,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if(spec.skill_needed > 0 && user->GetSkill(spec.tradeskill) < spec.skill_needed ) { // Notify client. user->Message(4, "You are not skilled enough."); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -387,7 +387,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob } // Send acknowledgement packets to client - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); user->QueuePacket(outapp); safe_delete(outapp); @@ -441,7 +441,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac) { //get our packet ready, gotta send one no matter what... - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RecipeAutoCombine, sizeof(RecipeAutoCombine_Struct)); + auto outapp = new EQApplicationPacket(OP_RecipeAutoCombine, sizeof(RecipeAutoCombine_Struct)); RecipeAutoCombine_Struct *outp = (RecipeAutoCombine_Struct *)outapp->pBuffer; outp->object_type = rac->object_type; outp->some_id = rac->some_id; @@ -536,8 +536,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac user->Message_StringID(MT_Skills, TRADESKILL_MISSING_COMPONENTS); - for(std::list::iterator it = MissingItems.begin(); it != MissingItems.end(); ++it) - { + for (auto it = MissingItems.begin(); it != MissingItems.end(); ++it) { const EQEmu::Item_Struct* item = database.GetItem(*it); if(item) @@ -723,7 +722,7 @@ void Client::TradeskillSearchResults(const std::string &query, unsigned long obj && row[4] == nullptr) continue; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RecipeReply, sizeof(RecipeReply_Struct)); + auto outapp = new EQApplicationPacket(OP_RecipeReply, sizeof(RecipeReply_Struct)); RecipeReply_Struct *reply = (RecipeReply_Struct *) outapp->pBuffer; reply->object_type = objtype; @@ -762,7 +761,7 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { //biggest this packet can ever be: // 64 * 10 + 8 * 10 + 4 + 4 * 10 = 764 - char *buf = new char[775]; //dynamic so we can just give it to EQApplicationPacket + auto buf = new char[775]; // dynamic so we can just give it to EQApplicationPacket uint8 r,k; uint32 *header = (uint32 *) buf; @@ -835,7 +834,7 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { uint32 total = sizeof(uint32) + dist + datalen; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RecipeDetails); + auto outapp = new EQApplicationPacket(OP_RecipeDetails); outapp->size = total; outapp->pBuffer = (uchar*) buf; QueuePacket(outapp); diff --git a/zone/trading.cpp b/zone/trading.cpp index e746e2122..9d23bd721 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -501,7 +501,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (other->PutItemInInventory(free_slot, *inst, true)) { Log.Out(Logs::Detail, Logs::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { - QSTradeItems_Struct* detail = new QSTradeItems_Struct; + auto detail = new QSTradeItems_Struct; detail->from_id = this->character_id; detail->from_slot = trade_slot; @@ -612,7 +612,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st Log.Out(Logs::Detail, Logs::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, (old_charges - inst->GetCharges())); if (qs_log) { - QSTradeItems_Struct* detail = new QSTradeItems_Struct; + auto detail = new QSTradeItems_Struct; detail->from_id = this->character_id; detail->from_slot = trade_slot; @@ -680,7 +680,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } if (qs_log) { - QSTradeItems_Struct* detail = new QSTradeItems_Struct; + auto detail = new QSTradeItems_Struct; detail->from_id = this->character_id; detail->from_slot = trade_slot; @@ -720,7 +720,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (other->PutItemInInventory(free_slot, *inst, true)) { Log.Out(Logs::Detail, Logs::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { - QSTradeItems_Struct* detail = new QSTradeItems_Struct; + auto detail = new QSTradeItems_Struct; detail->from_id = this->character_id; detail->from_slot = trade_slot; @@ -824,7 +824,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* trade_inst = m_inv[trade_slot]; if(trade_inst) { - QSHandinItems_Struct* detail = new QSHandinItems_Struct; + auto detail = new QSHandinItems_Struct; strcpy(detail->action_type, "HANDIN"); @@ -990,7 +990,7 @@ bool Client::CheckTradeLoreConflict(Client* other) } void Client::Trader_ShowItems(){ - EQApplicationPacket* outapp= new EQApplicationPacket(OP_Trader, sizeof(Trader_Struct)); + auto outapp = new EQApplicationPacket(OP_Trader, sizeof(Trader_Struct)); Trader_Struct* outints = (Trader_Struct*)outapp->pBuffer; Trader_Struct* TraderItems = database.LoadTraderItem(this->CharacterID()); @@ -1011,7 +1011,7 @@ void Client::SendTraderPacket(Client* Trader, uint32 Unknown72) if(!Trader) return; - EQApplicationPacket* outapp= new EQApplicationPacket(OP_BecomeTrader, sizeof(BecomeTrader_Struct)); + auto outapp = new EQApplicationPacket(OP_BecomeTrader, sizeof(BecomeTrader_Struct)); BecomeTrader_Struct* bts = (BecomeTrader_Struct*)outapp->pBuffer; @@ -1031,7 +1031,7 @@ void Client::SendTraderPacket(Client* Trader, uint32 Unknown72) void Client::Trader_CustomerBrowsing(Client *Customer) { - EQApplicationPacket* outapp= new EQApplicationPacket(OP_Trader, sizeof(Trader_ShowItems_Struct)); + auto outapp = new EQApplicationPacket(OP_Trader, sizeof(Trader_ShowItems_Struct)); Trader_ShowItems_Struct* sis = (Trader_ShowItems_Struct*)outapp->pBuffer; @@ -1047,7 +1047,7 @@ void Client::Trader_StartTrader() { Trader=true; - EQApplicationPacket* outapp= new EQApplicationPacket(OP_Trader, sizeof(Trader_ShowItems_Struct)); + auto outapp = new EQApplicationPacket(OP_Trader, sizeof(Trader_ShowItems_Struct)); Trader_ShowItems_Struct* sis = (Trader_ShowItems_Struct*)outapp->pBuffer; @@ -1087,7 +1087,7 @@ void Client::Trader_EndTrader() { GetItems_Struct* gis=GetTraderItems(); if(Customer && gis) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TraderDelItem,sizeof(TraderDelItem_Struct)); + auto outapp = new EQApplicationPacket(OP_TraderDelItem, sizeof(TraderDelItem_Struct)); TraderDelItem_Struct* tdis = (TraderDelItem_Struct*)outapp->pBuffer; tdis->Unknown000 = 0; @@ -1121,7 +1121,7 @@ void Client::Trader_EndTrader() { // Notify other clients we are no longer in trader mode. // - EQApplicationPacket* outapp= new EQApplicationPacket(OP_BecomeTrader, sizeof(BecomeTrader_Struct)); + auto outapp = new EQApplicationPacket(OP_BecomeTrader, sizeof(BecomeTrader_Struct)); BecomeTrader_Struct* bts = (BecomeTrader_Struct*)outapp->pBuffer; @@ -1280,7 +1280,7 @@ GetItems_Struct* Client::GetTraderItems(){ const ItemInst* item = nullptr; uint16 SlotID = 0; - GetItems_Struct* gis= new GetItems_Struct; + auto gis = new GetItems_Struct; memset(gis,0,sizeof(GetItems_Struct)); @@ -1346,7 +1346,7 @@ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Cu } else { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TraderDelItem,sizeof(TraderDelItem_Struct)); + auto outapp = new EQApplicationPacket(OP_TraderDelItem, sizeof(TraderDelItem_Struct)); TraderDelItem_Struct* tdis = (TraderDelItem_Struct*)outapp->pBuffer; tdis->Unknown000 = 0; @@ -1399,7 +1399,7 @@ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Cu void Client::TraderUpdate(uint16 SlotID,uint32 TraderID){ // This method is no longer used. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TraderItemUpdate,sizeof(TraderItemUpdate_Struct)); + auto outapp = new EQApplicationPacket(OP_TraderItemUpdate, sizeof(TraderItemUpdate_Struct)); TraderItemUpdate_Struct* tus=(TraderItemUpdate_Struct*)outapp->pBuffer; tus->Charges = 0xFFFF; tus->FromSlot = SlotID; @@ -1524,7 +1524,7 @@ void Client::TradeRequestFailed(const EQApplicationPacket* app) { TraderBuy_Struct* tbs = (TraderBuy_Struct*)app->pBuffer; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TraderBuy, sizeof(TraderBuy_Struct)); + auto outapp = new EQApplicationPacket(OP_TraderBuy, sizeof(TraderBuy_Struct)); TraderBuy_Struct* outtbs = (TraderBuy_Struct*)outapp->pBuffer; @@ -1558,7 +1558,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Trader, sizeof(TraderBuy_Struct)); + auto outapp = new EQApplicationPacket(OP_Trader, sizeof(TraderBuy_Struct)); TraderBuy_Struct* outtbs = (TraderBuy_Struct*)outapp->pBuffer; @@ -1927,98 +1927,95 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint RuleI(Bazaar, MaxSearchResults)); if(results.RowCount() == 0) { - EQApplicationPacket* outapp2 = new EQApplicationPacket(OP_BazaarSearch, sizeof(BazaarReturnDone_Struct)); - BazaarReturnDone_Struct* brds = (BazaarReturnDone_Struct*)outapp2->pBuffer; - brds->TraderID = ID; - brds->Type = BazaarSearchDone; - brds->Unknown008 = 0xFFFFFFFF; - brds->Unknown012 = 0xFFFFFFFF; - brds->Unknown016 = 0xFFFFFFFF; - this->QueuePacket(outapp2); - safe_delete(outapp2); - return; + auto outapp2 = new EQApplicationPacket(OP_BazaarSearch, sizeof(BazaarReturnDone_Struct)); + BazaarReturnDone_Struct *brds = (BazaarReturnDone_Struct *)outapp2->pBuffer; + brds->TraderID = ID; + brds->Type = BazaarSearchDone; + brds->Unknown008 = 0xFFFFFFFF; + brds->Unknown012 = 0xFFFFFFFF; + brds->Unknown016 = 0xFFFFFFFF; + this->QueuePacket(outapp2); + safe_delete(outapp2); + return; } Size = results.RowCount() * sizeof(BazaarSearchResults_Struct); - uchar *buffer = new uchar[Size]; - uchar *bufptr = buffer; - memset(buffer, 0, Size); + auto buffer = new uchar[Size]; + uchar *bufptr = buffer; + memset(buffer, 0, Size); - int Action = BazaarSearchResults; - uint32 Cost = 0; - int32 SerialNumber = 0; - char temp_buffer[64] = {0}; - int Count = 0; - uint32 StatValue=0; + int Action = BazaarSearchResults; + uint32 Cost = 0; + int32 SerialNumber = 0; + char temp_buffer[64] = {0}; + int Count = 0; + uint32 StatValue = 0; - for (auto row = results.begin(); row != results.end(); ++row) { - VARSTRUCT_ENCODE_TYPE(uint32, bufptr, Action); - Count = atoi(row[0]); - VARSTRUCT_ENCODE_TYPE(uint32, bufptr, Count); - SerialNumber = atoi(row[3]); - VARSTRUCT_ENCODE_TYPE(int32, bufptr, SerialNumber); - Client* Trader2=entity_list.GetClientByCharID(atoi(row[1])); - if(Trader2){ - ID = Trader2->GetID(); - VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID); - } - else{ - Log.Out(Logs::Detail, Logs::Trading, "Unable to find trader: %i\n",atoi(row[1])); - VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0); - } - Cost = atoi(row[5]); - VARSTRUCT_ENCODE_TYPE(uint32, bufptr, Cost); - StatValue = atoi(row[8]); - VARSTRUCT_ENCODE_TYPE(uint32, bufptr, StatValue); - bool Stackable = atoi(row[10]); - if(Stackable) { - int Charges = atoi(row[9]); - sprintf(temp_buffer, "%s(%i)", row[7], Charges); - } - else - sprintf(temp_buffer,"%s(%i)",row[7], Count); + for (auto row = results.begin(); row != results.end(); ++row) { + VARSTRUCT_ENCODE_TYPE(uint32, bufptr, Action); + Count = atoi(row[0]); + VARSTRUCT_ENCODE_TYPE(uint32, bufptr, Count); + SerialNumber = atoi(row[3]); + VARSTRUCT_ENCODE_TYPE(int32, bufptr, SerialNumber); + Client *Trader2 = entity_list.GetClientByCharID(atoi(row[1])); + if (Trader2) { + ID = Trader2->GetID(); + VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID); + } else { + Log.Out(Logs::Detail, Logs::Trading, "Unable to find trader: %i\n", atoi(row[1])); + VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0); + } + Cost = atoi(row[5]); + VARSTRUCT_ENCODE_TYPE(uint32, bufptr, Cost); + StatValue = atoi(row[8]); + VARSTRUCT_ENCODE_TYPE(uint32, bufptr, StatValue); + bool Stackable = atoi(row[10]); + if (Stackable) { + int Charges = atoi(row[9]); + sprintf(temp_buffer, "%s(%i)", row[7], Charges); + } else + sprintf(temp_buffer, "%s(%i)", row[7], Count); - memcpy(bufptr,&temp_buffer, strlen(temp_buffer)); + memcpy(bufptr, &temp_buffer, strlen(temp_buffer)); - bufptr += 64; + bufptr += 64; - // Extra fields for SoD+ - // - if(Trader2) - sprintf(temp_buffer, "%s", Trader2->GetName()); - else - sprintf(temp_buffer, "Unknown"); + // Extra fields for SoD+ + // + if (Trader2) + sprintf(temp_buffer, "%s", Trader2->GetName()); + else + sprintf(temp_buffer, "Unknown"); - memcpy(bufptr,&temp_buffer, strlen(temp_buffer)); + memcpy(bufptr, &temp_buffer, strlen(temp_buffer)); - bufptr += 64; + bufptr += 64; - VARSTRUCT_ENCODE_TYPE(uint32, bufptr, atoi(row[1])); // ItemID + VARSTRUCT_ENCODE_TYPE(uint32, bufptr, atoi(row[1])); // ItemID } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_BazaarSearch, Size); + auto outapp = new EQApplicationPacket(OP_BazaarSearch, Size); - memcpy(outapp->pBuffer, buffer, Size); + memcpy(outapp->pBuffer, buffer, Size); - this->QueuePacket(outapp); + this->QueuePacket(outapp); + safe_delete(outapp); + safe_delete_array(buffer); - safe_delete(outapp); - safe_delete_array(buffer); + auto outapp2 = new EQApplicationPacket(OP_BazaarSearch, sizeof(BazaarReturnDone_Struct)); + BazaarReturnDone_Struct *brds = (BazaarReturnDone_Struct *)outapp2->pBuffer; - EQApplicationPacket* outapp2 = new EQApplicationPacket(OP_BazaarSearch, sizeof(BazaarReturnDone_Struct)); - BazaarReturnDone_Struct* brds = (BazaarReturnDone_Struct*)outapp2->pBuffer; + brds->TraderID = ID; + brds->Type = BazaarSearchDone; - brds->TraderID = ID; - brds->Type = BazaarSearchDone; + brds->Unknown008 = 0xFFFFFFFF; + brds->Unknown012 = 0xFFFFFFFF; + brds->Unknown016 = 0xFFFFFFFF; - brds->Unknown008 = 0xFFFFFFFF; - brds->Unknown012 = 0xFFFFFFFF; - brds->Unknown016 = 0xFFFFFFFF; + this->QueuePacket(outapp2); - this->QueuePacket(outapp2); - - safe_delete(outapp2); + safe_delete(outapp2); } static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Struct* gis, uint32 ItemID) { @@ -2080,7 +2077,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St if(NewPrice == 0) { // If the new price is 0, remove the item(s) from the window. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TraderDelItem,sizeof(TraderDelItem_Struct)); + auto outapp = new EQApplicationPacket(OP_TraderDelItem, sizeof(TraderDelItem_Struct)); TraderDelItem_Struct* tdis = (TraderDelItem_Struct*)outapp->pBuffer; tdis->Unknown000 = 0; @@ -2354,7 +2351,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { // Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); - char* escSearchString = new char[strlen(searchString) * 2 + 1]; + auto escSearchString = new char[strlen(searchString) * 2 + 1]; database.DoEscapeString(escSearchString, searchString, strlen(searchString)); std::string query = StringFormat("SELECT * FROM buyer WHERE itemname LIKE '%%%s%%' ORDER BY charid LIMIT %i", @@ -2395,7 +2392,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { // to allow item compensation, e.g. a buyer could offer to buy a Blade Of Carnage for 10000pp plus // other items in exchange. Item compensation is not currently supported in EQEmu. // - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Barter, 940); + auto outapp = new EQApplicationPacket(OP_Barter, 940); char *buf = (char *)outapp->pBuffer; @@ -2465,7 +2462,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) { if(strlen(WelcomeMessagePointer) > 0) Message(10, "%s greets you, '%s'.", Buyer->GetName(), WelcomeMessagePointer); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Barter, sizeof(BuyerBrowsing_Struct)); + auto outapp = new EQApplicationPacket(OP_Barter, sizeof(BuyerBrowsing_Struct)); BuyerBrowsing_Struct* bb = (BuyerBrowsing_Struct*)outapp->pBuffer; @@ -2491,7 +2488,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) { uint32 Quantity = atoi(row[4]); uint32 Price = atoi(row[5]); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Barter, 936); + auto outapp = new EQApplicationPacket(OP_Barter, 936); char *Buf = (char *)outapp->pBuffer; @@ -2623,7 +2620,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { // Remove the item from inventory, clientside // - EQApplicationPacket* outapp2 = new EQApplicationPacket(OP_MoveItem,sizeof(MoveItem_Struct)); + auto outapp2 = new EQApplicationPacket(OP_MoveItem, sizeof(MoveItem_Struct)); MoveItem_Struct* mis = (MoveItem_Struct*)outapp2->pBuffer; mis->from_slot = SellerSlot; @@ -2677,7 +2674,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { safe_delete(ItemToTransfer); // and tell the client to do the same. - EQApplicationPacket* outapp2 = new EQApplicationPacket(OP_MoveItem,sizeof(MoveItem_Struct)); + auto outapp2 = new EQApplicationPacket(OP_MoveItem, sizeof(MoveItem_Struct)); MoveItem_Struct* mis = (MoveItem_Struct*)outapp2->pBuffer; mis->from_slot = SellerSlot; @@ -2709,7 +2706,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { safe_delete(ItemToTransfer); - EQApplicationPacket* outapp2 = new EQApplicationPacket(OP_DeleteItem,sizeof(MoveItem_Struct)); + auto outapp2 = new EQApplicationPacket(OP_DeleteItem, sizeof(MoveItem_Struct)); MoveItem_Struct* mis = (MoveItem_Struct*)outapp2->pBuffer; mis->from_slot = SellerSlot; @@ -2743,7 +2740,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { // uint32 PacketLength = 1016; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Barter, PacketLength); + auto outapp = new EQApplicationPacket(OP_Barter, PacketLength); Buf = (char *)outapp->pBuffer; @@ -2798,7 +2795,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { // Next we update the Seller's Barter Window to reflect the reduced quantity the Buyer is now looking to buy. // - EQApplicationPacket* outapp3 = new EQApplicationPacket(OP_Barter, 936); + auto outapp3 = new EQApplicationPacket(OP_Barter, 936); Buf = (char *)outapp3->pBuffer; @@ -2832,7 +2829,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { // The next packet updates the /buyer window with the reduced quantity, and toggles the buy line off if the // quantity they wanted to buy has been met. // - EQApplicationPacket* outapp4 = new EQApplicationPacket(OP_Barter, 936); + auto outapp4 = new EQApplicationPacket(OP_Barter, 936); Buf = (char*)outapp4->pBuffer; @@ -2867,7 +2864,7 @@ void Client::SendBuyerPacket(Client* Buyer) { // This is the Buyer Appearance packet. This method is called for each Buyer when a Client connects to the zone. // - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Barter, 13 + strlen(GetName())); + auto outapp = new EQApplicationPacket(OP_Barter, 13 + strlen(GetName())); char* Buf = (char*)outapp->pBuffer; @@ -2882,7 +2879,7 @@ void Client::SendBuyerPacket(Client* Buyer) { void Client::ToggleBuyerMode(bool TurnOn) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Barter, 13 + strlen(GetName())); + auto outapp = new EQApplicationPacket(OP_Barter, 13 + strlen(GetName())); char* Buf = (char*)outapp->pBuffer; @@ -2963,7 +2960,7 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { else database.RemoveBuyLine(CharacterID(), BuySlot); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Barter, 936); + auto outapp = new EQApplicationPacket(OP_Barter, 936); Buf = (char*)outapp->pBuffer; @@ -2990,7 +2987,7 @@ void Client::BuyerItemSearch(const EQApplicationPacket *app) { BuyerItemSearch_Struct* bis = (BuyerItemSearch_Struct*)app->pBuffer; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Barter, sizeof(BuyerItemSearchResults_Struct)); + auto outapp = new EQApplicationPacket(OP_Barter, sizeof(BuyerItemSearchResults_Struct)); BuyerItemSearchResults_Struct* bisr = (BuyerItemSearchResults_Struct*)outapp->pBuffer; diff --git a/zone/trap.cpp b/zone/trap.cpp index 1cce48e19..5a644bb03 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -146,7 +146,7 @@ void Trap::Trigger(Mob* trigger) { auto randomOffset = glm::vec4(zone->random.Int(-5, 5),zone->random.Int(-5, 5),zone->random.Int(-5, 5), zone->random.Int(0, 249)); auto spawnPosition = randomOffset + glm::vec4(m_Position, 0.0f); - NPC* new_npc = new NPC(tmp, nullptr, spawnPosition, FlyMode3); + auto new_npc = new NPC(tmp, nullptr, spawnPosition, FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -169,7 +169,7 @@ void Trap::Trigger(Mob* trigger) { auto randomOffset = glm::vec4(zone->random.Int(-2, 2), zone->random.Int(-2, 2), zone->random.Int(-2, 2), zone->random.Int(0, 249)); auto spawnPosition = randomOffset + glm::vec4(m_Position, 0.0f); - NPC* new_npc = new NPC(tmp, nullptr, spawnPosition, FlyMode3); + auto new_npc = new NPC(tmp, nullptr, spawnPosition, FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -187,7 +187,7 @@ void Trap::Trigger(Mob* trigger) } if(trigger->IsClient()) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); + auto outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct* a = (CombatDamage_Struct*)outapp->pBuffer; int dmg = zone->random.Int(effectvalue, effectvalue2); trigger->SetHP(trigger->GetHP() - dmg); @@ -268,7 +268,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { } for (auto row = results.begin(); row != results.end(); ++row) { - Trap* trap = new Trap(); + auto trap = new Trap(); trap->trap_id = atoi(row[0]); trap->m_Position = glm::vec3(atof(row[1]), atof(row[2]), atof(row[3])); trap->effect = atoi(row[4]); @@ -295,7 +295,7 @@ void Trap::CreateHiddenTrigger() return; const NPCType *base_type = database.LoadNPCTypesData(500); - NPCType *make_npc = new NPCType; + auto make_npc = new NPCType; memcpy(make_npc, base_type, sizeof(NPCType)); make_npc->max_hp = 100000; make_npc->cur_hp = 100000; diff --git a/zone/water_map.cpp b/zone/water_map.cpp index c77e77f00..f3b4c58d8 100644 --- a/zone/water_map.cpp +++ b/zone/water_map.cpp @@ -33,7 +33,7 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) { } if(version == 1) { - WaterMapV1 *wm = new WaterMapV1(); + auto wm = new WaterMapV1(); if(!wm->Load(f)) { delete wm; wm = nullptr; @@ -42,7 +42,7 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) { fclose(f); return wm; } else if(version == 2) { - WaterMapV2 *wm = new WaterMapV2(); + auto wm = new WaterMapV2(); if(!wm->Load(f)) { delete wm; wm = nullptr; diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 51a7af4fb..f6c55a5eb 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -253,7 +253,7 @@ void NPC::CalculateNewWaypoint() { std::list closest; GetClosestWaypoint(closest, 10, glm::vec3(GetPosition())); - std::list::iterator iter = closest.begin(); + auto iter = closest.begin(); if(closest.size() != 0) { iter = closest.begin(); @@ -310,7 +310,7 @@ void NPC::CalculateNewWaypoint() std::list closest; GetClosestWaypoint(closest, 5, glm::vec3(GetPosition())); - std::list::iterator iter = closest.begin(); + auto iter = closest.begin(); while(iter != closest.end()) { if(CheckLosFN((*iter).x, (*iter).y, (*iter).z, GetSize())) @@ -380,7 +380,7 @@ void NPC::GetClosestWaypoint(std::list &wp_list, int count, const glm::v return a.dist < b.dist; }); - std::list::iterator iter = distances.begin(); + auto iter = distances.begin(); for(int i = 0; i < count; ++i) { wp_list.push_back(Waypoints[(*iter).index]); diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index c9d3f4d5c..969c4b947 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -90,7 +90,7 @@ WorldServer::~WorldServer() { }*/ void WorldServer::SetZoneData(uint32 iZoneID, uint32 iInstanceID) { - ServerPacket* pack = new ServerPacket(ServerOP_SetZone, sizeof(SetZone_Struct)); + auto pack = new ServerPacket(ServerOP_SetZone, sizeof(SetZone_Struct)); SetZone_Struct* szs = (SetZone_Struct*) pack->pBuffer; szs->zoneid = iZoneID; szs->instanceid = iInstanceID; @@ -225,7 +225,7 @@ void WorldServer::Process() { ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_VoiceMacroOut,sizeof(VoiceMacroOut_Struct)); + auto outapp = new EQApplicationPacket(OP_VoiceMacroOut, sizeof(VoiceMacroOut_Struct)); VoiceMacroOut_Struct* vmo = (VoiceMacroOut_Struct*)outapp->pBuffer; strcpy(vmo->From, svm->From); @@ -400,10 +400,10 @@ void WorldServer::Process() { if(pack->size==64)//no results client->Message_StringID(0,WHOALL_NO_RESULTS); else{ - EQApplicationPacket* outapp = new EQApplicationPacket(OP_WhoAllResponse, pack->size); - memcpy(outapp->pBuffer, pack->pBuffer, pack->size); - client->QueuePacket(outapp); - safe_delete(outapp); + auto outapp = new EQApplicationPacket(OP_WhoAllResponse, pack->size); + memcpy(outapp->pBuffer, pack->pBuffer, pack->size); + client->QueuePacket(outapp); + safe_delete(outapp); } } else { @@ -613,7 +613,7 @@ void WorldServer::Process() { Client* client = entity_list.GetClientByName(gmg->gotoname); if (client != 0) { SendEmoteMessage(gmg->myname, 0, 13, "Summoning you to: %s @ %s, %1.1f, %1.1f, %1.1f", client->GetName(), zone->GetShortName(), client->GetX(), client->GetY(), client->GetZ()); - ServerPacket* outpack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct)); + auto outpack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct)); ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) outpack->pBuffer; strcpy(szp->adminname, gmg->myname); strcpy(szp->name, gmg->myname); @@ -634,7 +634,7 @@ void WorldServer::Process() { ServerMultiLineMsg_Struct* mlm = (ServerMultiLineMsg_Struct*) pack->pBuffer; Client* client = entity_list.GetClientByName(mlm->to); if (client) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_MultiLineMsg, strlen(mlm->message)); + auto outapp = new EQApplicationPacket(OP_MultiLineMsg, strlen(mlm->message)); strcpy((char*) outapp->pBuffer, mlm->message); client->QueuePacket(outapp); safe_delete(outapp); @@ -681,7 +681,8 @@ void WorldServer::Process() { { if(client->IsRezzPending()) { - ServerPacket * Response = new ServerPacket(ServerOP_RezzPlayerReject, strlen(srs->rez.rezzer_name) + 1); + auto Response = new ServerPacket(ServerOP_RezzPlayerReject, + strlen(srs->rez.rezzer_name) + 1); char *Buffer = (char *)Response->pBuffer; sprintf(Buffer, "%s", srs->rez.rezzer_name); @@ -694,12 +695,12 @@ void WorldServer::Process() { client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name); Log.Out(Logs::Detail, Logs::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", zone->GetShortName(), client->GetName(), srs->rez.spellid); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, - sizeof(Resurrect_Struct)); - memcpy(outapp->pBuffer, &srs->rez, sizeof(Resurrect_Struct)); - client->QueuePacket(outapp); - safe_delete(outapp); - break; + auto outapp = new EQApplicationPacket(OP_RezzRequest, + sizeof(Resurrect_Struct)); + memcpy(outapp->pBuffer, &srs->rez, sizeof(Resurrect_Struct)); + client->QueuePacket(outapp); + safe_delete(outapp); + break; } } if (srs->rezzopcode == OP_RezzComplete){ @@ -741,7 +742,7 @@ void WorldServer::Process() { eqTimeOfDay* newtime = (eqTimeOfDay*)pack->pBuffer; zone->zone_time.SetCurrentEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); + auto outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); TimeOfDay_Struct* time_of_day = (TimeOfDay_Struct*)outapp->pBuffer; zone->zone_time.GetCurrentEQTimeOfDay(time(0), time_of_day); entity_list.QueueClients(0, outapp, false); @@ -825,7 +826,7 @@ void WorldServer::Process() { if(Invitee && Invitee->IsClient() && Invitee->CastToClient()->MercOnlyOrNoGroup() && !Invitee->IsRaidGrouped()) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupInvite, sizeof(GroupInvite_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupInvite, sizeof(GroupInvite_Struct)); memcpy(outapp->pBuffer, gis, sizeof(GroupInvite_Struct)); Invitee->CastToClient()->QueuePacket(outapp); safe_delete(outapp); @@ -866,7 +867,8 @@ void WorldServer::Process() { if (Inviter->CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::SoD) { - EQApplicationPacket* outapp=new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* outgj=(GroupJoin_Struct*)outapp->pBuffer; strcpy(outgj->membername, Inviter->GetName()); strcpy(outgj->yourname, Inviter->GetName()); @@ -889,7 +891,7 @@ void WorldServer::Process() { break; } - EQApplicationPacket* outapp=new EQApplicationPacket(OP_GroupFollow, sizeof(GroupGeneric_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupFollow, sizeof(GroupGeneric_Struct)); GroupGeneric_Struct *gg = (GroupGeneric_Struct *)outapp->pBuffer; strn0cpy(gg->name1, sgfs->gf.name1, sizeof(gg->name1)); strn0cpy(gg->name2, sgfs->gf.name2, sizeof(gg->name2)); @@ -902,7 +904,7 @@ void WorldServer::Process() { if(Inviter->CastToClient()->IsLFP()) Inviter->CastToClient()->UpdateLFP(); - ServerPacket* pack2 = new ServerPacket(ServerOP_GroupJoin, sizeof(ServerGroupJoin_Struct)); + auto pack2 = new ServerPacket(ServerOP_GroupJoin, sizeof(ServerGroupJoin_Struct)); ServerGroupJoin_Struct* gj = (ServerGroupJoin_Struct*)pack2->pBuffer; gj->gid = group->GetID(); gj->zoneid = zone->GetZoneID(); @@ -914,7 +916,8 @@ void WorldServer::Process() { // Send acknowledgement back to the Invitee to let them know we have added them to the group. - ServerPacket* pack3 = new ServerPacket(ServerOP_GroupFollowAck, sizeof(ServerGroupFollowAck_Struct)); + auto pack3 = + new ServerPacket(ServerOP_GroupFollowAck, sizeof(ServerGroupFollowAck_Struct)); ServerGroupFollowAck_Struct* sgfas = (ServerGroupFollowAck_Struct*)pack3->pBuffer; strn0cpy(sgfas->Name, sgfs->gf.name2, sizeof(sgfas->Name)); worldserver.SendPacket(pack3); @@ -1011,7 +1014,7 @@ void WorldServer::Process() { if(Inviter && Inviter->IsClient()) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupCancelInvite, sizeof(GroupCancel_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupCancelInvite, sizeof(GroupCancel_Struct)); memcpy(outapp->pBuffer, sgcs, sizeof(GroupCancel_Struct)); Inviter->CastToClient()->QueuePacket(outapp); safe_delete(outapp); @@ -1234,7 +1237,8 @@ void WorldServer::Process() { Client *c = entity_list.GetClientByName(rga->playername); if(c) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupUpdate_Struct)); + auto outapp = + new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate_Struct)); GroupUpdate_Struct* gu = (GroupUpdate_Struct*) outapp->pBuffer; gu->action = groupActDisband; strn0cpy(gu->leadersname, c->GetName(), 64); @@ -1252,7 +1256,7 @@ void WorldServer::Process() { if(r){ r->LearnMembers(); r->VerifyRaid(); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer; strn0cpy(gj->membername, rga->membername, 64); gj->action = groupActJoin; @@ -1283,7 +1287,7 @@ void WorldServer::Process() { if(r){ r->LearnMembers(); r->VerifyRaid(); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer; strn0cpy(gj->membername, rga->membername, 64); gj->action = groupActLeave; @@ -1387,7 +1391,8 @@ void WorldServer::Process() { else client->consent_list.remove(s->ownername); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ConsentResponse, sizeof(ConsentResponse_Struct)); + auto outapp = + new EQApplicationPacket(OP_ConsentResponse, sizeof(ConsentResponse_Struct)); ConsentResponse_Struct* crs = (ConsentResponse_Struct*)outapp->pBuffer; strcpy(crs->grantname, s->grantname); strcpy(crs->ownername, s->ownername); @@ -1404,7 +1409,8 @@ void WorldServer::Process() { // CONSENT_INVALID_NAME = 397 // TARGET_NOT_FOUND = 101 - ServerPacket *scs_pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); + auto scs_pack = + new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)scs_pack->pBuffer; strcpy(scs->grantname, s->grantname); strcpy(scs->ownername, s->ownername); @@ -1623,7 +1629,7 @@ void WorldServer::Process() { if(c) { c->ClearAdventureData(); - char * adv_data = new char[pack->size]; + auto adv_data = new char[pack->size]; memcpy(adv_data, pack->pBuffer, pack->size); c->SetAdventureData(adv_data); c->ClearPendingAdventureData(); @@ -1731,7 +1737,8 @@ void WorldServer::Process() { Client *c = entity_list.GetClientByName((const char*)pack->pBuffer); if(c) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureLeaderboardReply, sizeof(AdventureLeaderboard_Struct)); + auto outapp = new EQApplicationPacket(OP_AdventureLeaderboardReply, + sizeof(AdventureLeaderboard_Struct)); memcpy(outapp->pBuffer, pack->pBuffer+64, sizeof(AdventureLeaderboard_Struct)); c->FastQueuePacket(&outapp); } @@ -1897,7 +1904,7 @@ bool WorldServer::SendChannelMessage(Client* from, const char* to, uint8 chan_nu va_end(argptr); buffer[511] = '\0'; - ServerPacket* pack = new ServerPacket(ServerOP_ChannelMessage, sizeof(ServerChannelMessage_Struct) + strlen(buffer) + 1); + auto pack = new ServerPacket(ServerOP_ChannelMessage, sizeof(ServerChannelMessage_Struct) + strlen(buffer) + 1); ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer; if (from == 0) { @@ -1951,7 +1958,7 @@ bool WorldServer::SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to return false; } - ServerPacket* pack = new ServerPacket(ServerOP_EmoteMessage, sizeof(ServerEmoteMessage_Struct)+strlen(buffer)+1); + auto pack = new ServerPacket(ServerOP_EmoteMessage, sizeof(ServerEmoteMessage_Struct) + strlen(buffer) + 1); ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer; sem->type = type; if (to != 0) @@ -1971,7 +1978,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 if(!worldserver.Connected() || !From) return false; - ServerPacket* pack = new ServerPacket(ServerOP_VoiceMacro, sizeof(ServerVoiceMacro_Struct)); + auto pack = new ServerPacket(ServerOP_VoiceMacro, sizeof(ServerVoiceMacro_Struct)); ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer; @@ -2010,7 +2017,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode) { Log.Out(Logs::Detail, Logs::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); - ServerPacket* pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct)); + auto pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct)); RezzPlayer_Struct* sem = (RezzPlayer_Struct*) pack->pBuffer; sem->rezzopcode = opcode; sem->rez = *(Resurrect_Struct*) rpack->pBuffer; @@ -2027,7 +2034,7 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 } void WorldServer::SendReloadTasks(int Command, int TaskID) { - ServerPacket* pack = new ServerPacket(ServerOP_ReloadTasks, sizeof(ReloadTasks_Struct)); + auto pack = new ServerPacket(ServerOP_ReloadTasks, sizeof(ReloadTasks_Struct)); ReloadTasks_Struct* rts = (ReloadTasks_Struct*) pack->pBuffer; rts->Command = Command; @@ -2101,7 +2108,7 @@ uint32 WorldServer::NextGroupID() { } if(cur_groupid > (last_groupid - /*50*/995)) { //running low, request more - ServerPacket* pack = new ServerPacket(ServerOP_GroupIDReq); + auto pack = new ServerPacket(ServerOP_GroupIDReq); SendPacket(pack); safe_delete(pack); } @@ -2112,7 +2119,7 @@ uint32 WorldServer::NextGroupID() { void WorldServer::UpdateLFP(uint32 LeaderID, uint8 Action, uint8 MatchFilter, uint32 FromLevel, uint32 ToLevel, uint32 Classes, const char *Comments, GroupLFPMemberEntry *LFPMembers) { - ServerPacket* pack = new ServerPacket(ServerOP_LFPUpdate, sizeof(ServerLFPUpdate_Struct)); + auto pack = new ServerPacket(ServerOP_LFPUpdate, sizeof(ServerLFPUpdate_Struct)); ServerLFPUpdate_Struct* sus = (ServerLFPUpdate_Struct*) pack->pBuffer; sus->LeaderID = LeaderID; @@ -2159,7 +2166,7 @@ void WorldServer::HandleLFGMatches(ServerPacket *pack) { smrs++; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LFGGetMatchesResponse, PacketLength); + auto outapp = new EQApplicationPacket(OP_LFGGetMatchesResponse, PacketLength); smrs = (ServerLFGMatchesResponse_Struct*)Buffer; @@ -2206,7 +2213,7 @@ void WorldServer::HandleLFPMatches(ServerPacket *pack) { } smrs++; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_LFPGetMatchesResponse, PacketLength); + auto outapp = new EQApplicationPacket(OP_LFPGetMatchesResponse, PacketLength); smrs = (ServerLFPMatchesResponse_Struct*)Buffer; @@ -2249,7 +2256,7 @@ void WorldServer::RequestTellQueue(const char *who) if (!who) return; - ServerPacket* pack = new ServerPacket(ServerOP_RequestTellQueue, sizeof(ServerRequestTellQueue_Struct)); + auto pack = new ServerPacket(ServerOP_RequestTellQueue, sizeof(ServerRequestTellQueue_Struct)); ServerRequestTellQueue_Struct* rtq = (ServerRequestTellQueue_Struct*) pack->pBuffer; strn0cpy(rtq->name, who, sizeof(rtq->name)); diff --git a/zone/zone.cpp b/zone/zone.cpp index 6c58bea65..df48d0cfa 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -137,7 +137,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { worldserver.SetZoneData(iZoneID, iInstanceID); if(iInstanceID != 0) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(uint16)); + auto pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(uint16)); *((uint16*)pack->pBuffer) = iInstanceID; worldserver.SendPacket(pack); delete pack; @@ -215,12 +215,12 @@ bool Zone::LoadZoneObjects() { d.incline = atoi(row[13]); // unknown20 = optional model incline value d.client_version_mask = 0xFFFFFFFF; //We should load the mask from the zone. - Doors* door = new Doors(&d); - entity_list.AddDoor(door); - } + auto door = new Doors(&d); + entity_list.AddDoor(door); + } - Object_Struct data = {0}; - uint32 id = 0; + Object_Struct data = {0}; + uint32 id = 0; uint32 icon = 0; uint32 type = 0; uint32 itemid = 0; @@ -270,12 +270,12 @@ bool Zone::LoadZoneObjects() { database.LoadWorldContainer(id, inst); } - Object* object = new Object(id, type, icon, data, inst); - entity_list.AddObject(object, false); - if(type == OT_DROPPEDITEM && itemid != 0) - entity_list.RemoveObject(object->GetID()); + auto object = new Object(id, type, icon, data, inst); + entity_list.AddObject(object, false); + if (type == OT_DROPPEDITEM && itemid != 0) + entity_list.RemoveObject(object->GetID()); - safe_delete(inst); + safe_delete(inst); } return true; @@ -301,7 +301,12 @@ bool Zone::LoadGroundSpawns() { if(inst){ name = groundspawn.spawn[gsindex].name; for(ix=0;ix::iterator iter = cur->second.begin(); + auto iter = cur->second.begin(); bool found = false; while (iter != cur->second.end()) { if ((*iter).item == ml.id) { @@ -722,7 +727,7 @@ void Zone::LoadZoneDoors(const char* zone, int16 version) return; } - Door *dlist = new Door[count]; + auto dlist = new Door[count]; if(!database.LoadDoors(count, dlist, zone, version)) { Log.Out(Logs::General, Logs::Error, "... Failed to load doors."); @@ -733,7 +738,7 @@ void Zone::LoadZoneDoors(const char* zone, int16 version) int r; Door *d = dlist; for(r = 0; r < count; r++, d++) { - Doors* newdoor = new Doors(d); + auto newdoor = new Doors(d); entity_list.AddDoor(newdoor); Log.Out(Logs::Detail, Logs::Doors, "Door Add to Entity List, index: %u db id: %u, door_id %u", r, dlist[r].db_id, dlist[r].door_id); } @@ -1076,7 +1081,7 @@ bool Zone::SaveZoneCFG() { } void Zone::AddAuth(ServerZoneIncomingClient_Struct* szic) { - ZoneClientAuth_Struct* zca = new ZoneClientAuth_Struct; + auto zca = new ZoneClientAuth_Struct; memset(zca, 0, sizeof(ZoneClientAuth_Struct)); zca->ip = szic->ip; zca->wid = szic->wid; @@ -1495,7 +1500,7 @@ void Zone::Repop(uint32 delay) { void Zone::GetTimeSync() { if (worldserver.Connected() && !zone_has_current_time) { - ServerPacket* pack = new ServerPacket(ServerOP_GetWorldTime, 0); + auto pack = new ServerPacket(ServerOP_GetWorldTime, 0); worldserver.SendPacket(pack); safe_delete(pack); } @@ -1504,7 +1509,7 @@ void Zone::GetTimeSync() void Zone::SetDate(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute) { if (worldserver.Connected()) { - ServerPacket* pack = new ServerPacket(ServerOP_SetWorldTime, sizeof(eqTimeOfDay)); + auto pack = new ServerPacket(ServerOP_SetWorldTime, sizeof(eqTimeOfDay)); eqTimeOfDay* eqtod = (eqTimeOfDay*)pack->pBuffer; eqtod->start_eqtime.minute=minute; eqtod->start_eqtime.hour=hour; @@ -1521,7 +1526,7 @@ void Zone::SetDate(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute void Zone::SetTime(uint8 hour, uint8 minute, bool update_world /*= true*/) { if (worldserver.Connected()) { - ServerPacket* pack = new ServerPacket(ServerOP_SetWorldTime, sizeof(eqTimeOfDay)); + auto pack = new ServerPacket(ServerOP_SetWorldTime, sizeof(eqTimeOfDay)); eqTimeOfDay* eq_time_of_day = (eqTimeOfDay*)pack->pBuffer; zone_time.GetCurrentEQTimeOfDay(time(0), &eq_time_of_day->start_eqtime); @@ -1544,7 +1549,7 @@ void Zone::SetTime(uint8 hour, uint8 minute, bool update_world /*= true*/) Log.Out(Logs::General, Logs::Zone_Server, "Setting zone localized time..."); zone->zone_time.SetCurrentEQTimeOfDay(eq_time_of_day->start_eqtime, eq_time_of_day->start_realtime); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); + auto outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); TimeOfDay_Struct* time_of_day = (TimeOfDay_Struct*)outapp->pBuffer; zone->zone_time.GetCurrentEQTimeOfDay(time(0), time_of_day); entity_list.QueueClients(0, outapp, false); @@ -1652,39 +1657,39 @@ ZonePoint* Zone::GetClosestZonePointWithoutZone(float x, float y, float z, Clien bool ZoneDatabase::LoadStaticZonePoints(LinkedList* zone_point_list, const char* zonename, uint32 version) { - zone_point_list->Clear(); zone->numzonepoints = 0; std::string query = StringFormat("SELECT x, y, z, target_x, target_y, " - "target_z, target_zone_id, heading, target_heading, " - "number, target_instance, client_version_mask " - "FROM zone_points WHERE zone='%s' AND (version=%i OR version=-1) " - "ORDER BY number", zonename, version); + "target_z, target_zone_id, heading, target_heading, " + "number, target_instance, client_version_mask " + "FROM zone_points WHERE zone='%s' AND (version=%i OR version=-1) " + "ORDER BY number", + zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { return false; } - for (auto row = results.begin(); row != results.end(); ++row) { - ZonePoint* zp = new ZonePoint; + for (auto row = results.begin(); row != results.end(); ++row) { + auto zp = new ZonePoint; - zp->x = atof(row[0]); - zp->y = atof(row[1]); - zp->z = atof(row[2]); - zp->target_x = atof(row[3]); - zp->target_y = atof(row[4]); - zp->target_z = atof(row[5]); - zp->target_zone_id = atoi(row[6]); - zp->heading = atof(row[7]); - zp->target_heading = atof(row[8]); - zp->number = atoi(row[9]); - zp->target_zone_instance = atoi(row[10]); - zp->client_version_mask = (uint32)strtoul(row[11], nullptr, 0); + zp->x = atof(row[0]); + zp->y = atof(row[1]); + zp->z = atof(row[2]); + zp->target_x = atof(row[3]); + zp->target_y = atof(row[4]); + zp->target_z = atof(row[5]); + zp->target_zone_id = atoi(row[6]); + zp->heading = atof(row[7]); + zp->target_heading = atof(row[8]); + zp->number = atoi(row[9]); + zp->target_zone_instance = atoi(row[10]); + zp->client_version_mask = (uint32)strtoul(row[11], nullptr, 0); - zone_point_list->Insert(zp); + zone_point_list->Insert(zp); - zone->numzonepoints++; - } + zone->numzonepoints++; + } return true; } @@ -1838,7 +1843,7 @@ bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes) { void Zone::weatherSend() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weather, 8); + auto outapp = new EQApplicationPacket(OP_Weather, 8); if(zone_weather>0) outapp->pBuffer[0] = zone_weather-1; if(zone_weather>0) @@ -2001,13 +2006,13 @@ void Zone::LoadLDoNTraps() } for (auto row = results.begin();row != results.end(); ++row) { - LDoNTrapTemplate *lt = new LDoNTrapTemplate; - lt->id = atoi(row[0]); - lt->type = (LDoNChestTypes)atoi(row[1]); - lt->spell_id = atoi(row[2]); - lt->skill = atoi(row[3]); - lt->locked = atoi(row[4]); - ldon_trap_list[lt->id] = lt; + auto lt = new LDoNTrapTemplate; + lt->id = atoi(row[0]); + lt->type = (LDoNChestTypes)atoi(row[1]); + lt->spell_id = atoi(row[2]); + lt->skill = atoi(row[3]); + lt->locked = atoi(row[4]); + ldon_trap_list[lt->id] = lt; } } @@ -2166,7 +2171,7 @@ void Zone::DoAdventureCountIncrease() if(sr->count < sr->total) { sr->count++; - ServerPacket *pack = new ServerPacket(ServerOP_AdventureCountUpdate, sizeof(uint16)); + auto pack = new ServerPacket(ServerOP_AdventureCountUpdate, sizeof(uint16)); *((uint16*)pack->pBuffer) = instanceid; worldserver.SendPacket(pack); delete pack; @@ -2179,7 +2184,7 @@ void Zone::DoAdventureAssassinationCountIncrease() if(sr->assa_count < RuleI(Adventure, NumberKillsForBossSpawn)) { sr->assa_count++; - ServerPacket *pack = new ServerPacket(ServerOP_AdventureAssaCountUpdate, sizeof(uint16)); + auto pack = new ServerPacket(ServerOP_AdventureAssaCountUpdate, sizeof(uint16)); *((uint16*)pack->pBuffer) = instanceid; worldserver.SendPacket(pack); delete pack; @@ -2229,12 +2234,12 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) for (auto row = results.begin(); row != results.end(); ++row) { - NPC_Emote_Struct* nes = new NPC_Emote_Struct; - nes->emoteid = atoi(row[0]); - nes->event_ = atoi(row[1]); - nes->type = atoi(row[2]); - strn0cpy(nes->text, row[3], sizeof(nes->text)); - NPCEmoteList->Insert(nes); + auto nes = new NPC_Emote_Struct; + nes->emoteid = atoi(row[0]); + nes->event_ = atoi(row[1]); + nes->type = atoi(row[2]); + strn0cpy(nes->text, row[3], sizeof(nes->text)); + NPCEmoteList->Insert(nes); } } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index e2ea36fca..7adafb63f 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -315,8 +315,8 @@ bool ZoneDatabase::logevents(const char* accountname,uint32 accountid,uint8 stat uint32 len = strlen(description); uint32 len2 = strlen(target); - char* descriptiontext = new char[2*len+1]; - char* targetarr = new char[2*len2+1]; + auto descriptiontext = new char[2 * len + 1]; + auto targetarr = new char[2 * len2 + 1]; memset(descriptiontext, 0, 2*len+1); memset(targetarr, 0, 2*len2+1); DoEscapeString(descriptiontext, description, len); @@ -382,7 +382,7 @@ void ZoneDatabase::UpdateBug(BugStruct* bug) { void ZoneDatabase::UpdateBug(PetitionBug_Struct* bug){ uint32 len = strlen(bug->text); - char* bugtext = new char[2*len+1]; + auto bugtext = new char[2 * len + 1]; memset(bugtext, 0, 2*len+1); DoEscapeString(bugtext, bug->text, len); @@ -562,7 +562,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id) Trader_Struct* ZoneDatabase::LoadTraderItem(uint32 char_id) { - Trader_Struct* loadti = new Trader_Struct; + auto loadti = new Trader_Struct; memset(loadti,0,sizeof(Trader_Struct)); std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i ORDER BY slot_id LIMIT 80", char_id); @@ -587,7 +587,7 @@ Trader_Struct* ZoneDatabase::LoadTraderItem(uint32 char_id) TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id) { - TraderCharges_Struct* loadti = new TraderCharges_Struct; + auto loadti = new TraderCharges_Struct; memset(loadti,0,sizeof(TraderCharges_Struct)); std::string query = StringFormat("SELECT * FROM trader WHERE char_id=%i ORDER BY slot_id LIMIT 80", char_id); @@ -2791,7 +2791,7 @@ void ZoneDatabase::RefreshGroupFromDB(Client *client){ if(!group) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupUpdate2_Struct)); + auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate2_Struct)); GroupUpdate2_Struct* gu = (GroupUpdate2_Struct*)outapp->pBuffer; gu->action = groupActUpdate; @@ -3366,7 +3366,7 @@ bool ZoneDatabase::GetFactionData(FactionMods* fm, uint32 class_mod, uint32 race char str[32]; sprintf(str, "r%u", race_mod); - std::map::iterator iter = faction_array[faction_id]->mods.find(str); + auto iter = faction_array[faction_id]->mods.find(str); if(iter != faction_array[faction_id]->mods.end()) { fm->race_mod = iter->second; } else { @@ -3380,7 +3380,7 @@ bool ZoneDatabase::GetFactionData(FactionMods* fm, uint32 class_mod, uint32 race char str[32]; sprintf(str, "d%u", deity_mod); - std::map::iterator iter = faction_array[faction_id]->mods.find(str); + auto iter = faction_array[faction_id]->mods.find(str); if(iter != faction_array[faction_id]->mods.end()) { fm->deity_mod = iter->second; } else { diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 8a387216e..16130f8e2 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -365,7 +365,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc if (zone_id == zone->GetZoneID() && instance_id == zone->GetInstanceID()) { // No need to ask worldserver if we're zoning to ourselves (most // likely to a bind point), also fixes a bug since the default response was failure - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZoneChange,sizeof(ZoneChange_Struct)); + auto outapp = new EQApplicationPacket(OP_ZoneChange, sizeof(ZoneChange_Struct)); ZoneChange_Struct* zc2 = (ZoneChange_Struct*) outapp->pBuffer; strcpy(zc2->char_name, GetName()); zc2->zoneID = zone_id; @@ -378,19 +378,19 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc } else { // vesuvias - zoneing to another zone so we need to the let the world server //handle things with the client for a while - ServerPacket* pack = new ServerPacket(ServerOP_ZoneToZoneRequest, sizeof(ZoneToZone_Struct)); - ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer; - ztz->response = 0; - ztz->current_zone_id = zone->GetZoneID(); - ztz->current_instance_id = zone->GetInstanceID(); - ztz->requested_zone_id = zone_id; - ztz->requested_instance_id = instance_id; - ztz->admin = admin; - ztz->ignorerestrictions = ignore_r; - strcpy(ztz->name, GetName()); - ztz->guild_id = GuildID(); - worldserver.SendPacket(pack); - safe_delete(pack); + auto pack = new ServerPacket(ServerOP_ZoneToZoneRequest, sizeof(ZoneToZone_Struct)); + ZoneToZone_Struct *ztz = (ZoneToZone_Struct *)pack->pBuffer; + ztz->response = 0; + ztz->current_zone_id = zone->GetZoneID(); + ztz->current_instance_id = zone->GetInstanceID(); + ztz->requested_zone_id = zone_id; + ztz->requested_instance_id = instance_id; + ztz->admin = admin; + ztz->ignorerestrictions = ignore_r; + strcpy(ztz->name, GetName()); + ztz->guild_id = GuildID(); + worldserver.SendPacket(pack); + safe_delete(pack); } //reset to unsolicited. @@ -582,7 +582,8 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z zone_mode = zm; if (zm == ZoneToBindPoint) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + iZoneNameLength); + auto outapp = new EQApplicationPacket(OP_ZonePlayerToBind, + sizeof(ZonePlayerToBind_Struct) + iZoneNameLength); ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer; // If we are SoF and later and are respawning from hover, we want the real zone ID, else zero to use the old hack. @@ -607,7 +608,8 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z safe_delete(outapp); } else if(zm == ZoneSolicited || zm == ZoneToSafeCoords) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RequestClientZoneChange, sizeof(RequestClientZoneChange_Struct)); + auto outapp = + new EQApplicationPacket(OP_RequestClientZoneChange, sizeof(RequestClientZoneChange_Struct)); RequestClientZoneChange_Struct* gmg = (RequestClientZoneChange_Struct*) outapp->pBuffer; gmg->zone_id = zoneID; @@ -623,7 +625,8 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z safe_delete(outapp); } else if(zm == EvacToSafeCoords) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RequestClientZoneChange, sizeof(RequestClientZoneChange_Struct)); + auto outapp = + new EQApplicationPacket(OP_RequestClientZoneChange, sizeof(RequestClientZoneChange_Struct)); RequestClientZoneChange_Struct* gmg = (RequestClientZoneChange_Struct*) outapp->pBuffer; // if we are in the same zone we want to evac to, client will not send OP_ZoneChange back to do an actual @@ -665,7 +668,8 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SendPosition(); } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RequestClientZoneChange, sizeof(RequestClientZoneChange_Struct)); + auto outapp = + new EQApplicationPacket(OP_RequestClientZoneChange, sizeof(RequestClientZoneChange_Struct)); RequestClientZoneChange_Struct* gmg = (RequestClientZoneChange_Struct*) outapp->pBuffer; gmg->zone_id = zoneID;