mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
clang-tidy modernize-use-auto
This commit is contained in:
+57
-54
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user