clang-tidy modernize-use-auto

This commit is contained in:
Michael Cook (mackal)
2016-05-25 16:10:28 -04:00
parent cdbeb24a05
commit 60da544d3a
87 changed files with 1465 additions and 1340 deletions
+3 -2
View File
@@ -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);
+2 -2
View File
@@ -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 */
+16 -15
View File
@@ -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
+1 -1
View File
@@ -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);
}
+3 -3
View File
@@ -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);
}
+10 -10
View File
@@ -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<EQRawApplicationPacket *>::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<EQRawApplicationPacket *>::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<EQRawApplicationPacket *>::iterator itr=InboundQueue.begin();
auto itr = InboundQueue.begin();
p=*itr;
}
MInboundQueue.unlock();
+1 -1
View File
@@ -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::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator temp = stream_itr;
auto temp = stream_itr;
++stream_itr;
temp->second = nullptr;
Streams.erase(temp);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+15 -15
View File
@@ -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::vector<CharGuildInfo
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
CharGuildInfo *ci = new CharGuildInfo;
for (auto row = results.begin(); row != results.end(); ++row) {
auto ci = new CharGuildInfo;
ProcessGuildMember(row, *ci);
members.push_back(ci);
}
@@ -937,7 +937,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
//escape our strings.
uint32 nl = strlen(char_name);
char *esc = new char[nl*2+1];
auto esc = new char[nl * 2 + 1];
m_db->DoEscapeString(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;
+2 -2
View File
@@ -2119,7 +2119,7 @@ const EQEmu::Item_Struct* ItemInst::GetUnscaledItem() const
std::string ItemInst::GetCustomDataString() const {
std::string ret_val;
std::map<std::string, std::string>::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<std::string, std::string>::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);
}
+2 -2
View File
@@ -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; i<size; i++)
@@ -100,7 +100,7 @@ std::string DumpPacketHexToString(const uchar* buf, uint32 size, uint32 cols, ui
// 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; i < size; i++)
+3 -1
View File
@@ -94,7 +94,9 @@ void FileDumpPacketHex(const char* filename, const uchar* buf, uint32 size, uint
std::ofstream logfile(filename, std::ios::app);
// Output as HEX
char output[4];
int j = 0; char* ascii = new char[cols+1]; memset(ascii, 0, cols+1);
int j = 0;
auto ascii = new char[cols + 1];
memset(ascii, 0, cols + 1);
uint32 i;
for(i=skip; i<size; i++)
{
+25 -19
View File
@@ -202,8 +202,9 @@ namespace RoF
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;
@@ -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);
+25 -19
View File
@@ -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);
+21 -14
View File
@@ -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);
+11 -7
View File
@@ -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)
+5 -3
View File
@@ -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)
+26 -18
View File
@@ -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);
+2 -2
View File
@@ -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<char *>(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<ProcRef, Spec *>::iterator res = m_running.find(proc);
auto res = m_running.find(proc);
if(res == m_running.end())
return(false);
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -1368,7 +1368,7 @@ bool SharedDatabase::GetCommandSettings(std::map<std::string, std::pair<uint8, s
continue;
std::vector<std::string> aliases = SplitString(row[2], '|');
for (std::vector<std::string>::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);
+2 -2
View File
@@ -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();
+4 -4
View File
@@ -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);
+1 -1
View File
@@ -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);