mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 16:41:29 +00:00
Hatelist will now use a std::list so i can avoid a list copy when exporting it to quests. Cause frankly two copies was absurd
This commit is contained in:
parent
1f265af1e7
commit
bec6acc01e
@ -20,8 +20,8 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <list>
|
||||||
#include "masterentity.h"
|
#include "masterentity.h"
|
||||||
#include "../common/linked_list.h"
|
|
||||||
#include "../common/rulesys.h"
|
#include "../common/rulesys.h"
|
||||||
#include "../common/MiscFunctions.h"
|
#include "../common/MiscFunctions.h"
|
||||||
#include "hate_list.h"
|
#include "hate_list.h"
|
||||||
@ -44,26 +44,27 @@ HateList::~HateList()
|
|||||||
// checks if target still is in frenzy mode
|
// checks if target still is in frenzy mode
|
||||||
void HateList::CheckFrenzyHate()
|
void HateList::CheckFrenzyHate()
|
||||||
{
|
{
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while(iterator != list.end())
|
||||||
while(iterator.MoreElements())
|
|
||||||
{
|
{
|
||||||
if (iterator.GetData()->ent->GetHPRatio() >= 20)
|
if ((*iterator)->ent->GetHPRatio() >= 20)
|
||||||
iterator.GetData()->bFrenzy = false;
|
(*iterator)->bFrenzy = false;
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HateList::Wipe()
|
void HateList::Wipe()
|
||||||
{
|
{
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
|
||||||
|
|
||||||
while(iterator.MoreElements())
|
while(iterator != list.end())
|
||||||
{
|
{
|
||||||
Mob* m = iterator.GetData()->ent;
|
Mob* m = (*iterator)->ent;
|
||||||
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0);
|
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0);
|
||||||
iterator.RemoveCurrent();
|
//iterator
|
||||||
|
|
||||||
|
delete (*iterator);
|
||||||
|
iterator = list.erase(iterator);
|
||||||
|
|
||||||
if(m->IsClient())
|
if(m->IsClient())
|
||||||
m->CastToClient()->DecrementAggroCount();
|
m->CastToClient()->DecrementAggroCount();
|
||||||
@ -72,7 +73,7 @@ void HateList::Wipe()
|
|||||||
|
|
||||||
bool HateList::IsOnHateList(Mob *mob)
|
bool HateList::IsOnHateList(Mob *mob)
|
||||||
{
|
{
|
||||||
if (Find(mob))
|
if(Find(mob))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -80,13 +81,12 @@ bool HateList::IsOnHateList(Mob *mob)
|
|||||||
tHateEntry *HateList::Find(Mob *ent)
|
tHateEntry *HateList::Find(Mob *ent)
|
||||||
{
|
{
|
||||||
_ZP(HateList_Find);
|
_ZP(HateList_Find);
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while(iterator != list.end())
|
||||||
while(iterator.MoreElements())
|
|
||||||
{
|
{
|
||||||
if(iterator.GetData()->ent == ent)
|
if((*iterator)->ent == ent)
|
||||||
return iterator.GetData();
|
return (*iterator);
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -111,40 +111,39 @@ Mob* HateList::GetDamageTop(Mob* hater)
|
|||||||
Raid* r = nullptr;
|
Raid* r = nullptr;
|
||||||
uint32 dmg_amt = 0;
|
uint32 dmg_amt = 0;
|
||||||
|
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while(iterator != list.end())
|
||||||
while(iterator.MoreElements())
|
|
||||||
{
|
{
|
||||||
grp = nullptr;
|
grp = nullptr;
|
||||||
r = nullptr;
|
r = nullptr;
|
||||||
|
|
||||||
if(iterator.GetData()->ent && iterator.GetData()->ent->IsClient()){
|
if((*iterator)->ent && (*iterator)->ent->IsClient()){
|
||||||
r = entity_list.GetRaidByClient(iterator.GetData()->ent->CastToClient());
|
r = entity_list.GetRaidByClient((*iterator)->ent->CastToClient());
|
||||||
}
|
}
|
||||||
|
|
||||||
grp = entity_list.GetGroupByMob(iterator.GetData()->ent);
|
grp = entity_list.GetGroupByMob((*iterator)->ent);
|
||||||
|
|
||||||
if(iterator.GetData()->ent && r){
|
if((*iterator)->ent && r){
|
||||||
if(r->GetTotalRaidDamage(hater) >= dmg_amt)
|
if(r->GetTotalRaidDamage(hater) >= dmg_amt)
|
||||||
{
|
{
|
||||||
current = iterator.GetData()->ent;
|
current = (*iterator)->ent;
|
||||||
dmg_amt = r->GetTotalRaidDamage(hater);
|
dmg_amt = r->GetTotalRaidDamage(hater);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (iterator.GetData()->ent != nullptr && grp != nullptr)
|
else if ((*iterator)->ent != nullptr && grp != nullptr)
|
||||||
{
|
{
|
||||||
if (grp->GetTotalGroupDamage(hater) >= dmg_amt)
|
if (grp->GetTotalGroupDamage(hater) >= dmg_amt)
|
||||||
{
|
{
|
||||||
current = iterator.GetData()->ent;
|
current = (*iterator)->ent;
|
||||||
dmg_amt = grp->GetTotalGroupDamage(hater);
|
dmg_amt = grp->GetTotalGroupDamage(hater);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (iterator.GetData()->ent != nullptr && (uint32)iterator.GetData()->damage >= dmg_amt)
|
else if ((*iterator)->ent != nullptr && (uint32)(*iterator)->damage >= dmg_amt)
|
||||||
{
|
{
|
||||||
current = iterator.GetData()->ent;
|
current = (*iterator)->ent;
|
||||||
dmg_amt = iterator.GetData()->damage;
|
dmg_amt = (*iterator)->damage;
|
||||||
}
|
}
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
@ -155,15 +154,14 @@ Mob* HateList::GetClosest(Mob *hater) {
|
|||||||
float closedist = 99999.9f;
|
float closedist = 99999.9f;
|
||||||
float thisdist;
|
float thisdist;
|
||||||
|
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while(iterator != list.end()) {
|
||||||
while(iterator.MoreElements()) {
|
thisdist = (*iterator)->ent->DistNoRootNoZ(*hater);
|
||||||
thisdist = iterator.GetData()->ent->DistNoRootNoZ(*hater);
|
if((*iterator)->ent != nullptr && thisdist <= closedist) {
|
||||||
if(iterator.GetData()->ent != nullptr && thisdist <= closedist) {
|
|
||||||
closedist = thisdist;
|
closedist = thisdist;
|
||||||
close = iterator.GetData()->ent;
|
close = (*iterator)->ent;
|
||||||
}
|
}
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (close == 0 && hater->IsNPC())
|
if (close == 0 && hater->IsNPC())
|
||||||
@ -198,7 +196,7 @@ void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAd
|
|||||||
p->damage = (in_dam>=0)?in_dam:0;
|
p->damage = (in_dam>=0)?in_dam:0;
|
||||||
p->hate = in_hate;
|
p->hate = in_hate;
|
||||||
p->bFrenzy = bFrenzy;
|
p->bFrenzy = bFrenzy;
|
||||||
list.Append(p);
|
list.push_back(p);
|
||||||
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0);
|
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0);
|
||||||
|
|
||||||
if(ent->IsClient())
|
if(ent->IsClient())
|
||||||
@ -209,15 +207,15 @@ void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAd
|
|||||||
bool HateList::RemoveEnt(Mob *ent)
|
bool HateList::RemoveEnt(Mob *ent)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
|
||||||
|
|
||||||
while(iterator.MoreElements())
|
while(iterator != list.end())
|
||||||
{
|
{
|
||||||
if(iterator.GetData()->ent == ent)
|
if((*iterator)->ent == ent)
|
||||||
{
|
{
|
||||||
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0);
|
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0);
|
||||||
iterator.RemoveCurrent();
|
delete (*iterator);
|
||||||
|
iterator = list.erase(iterator);
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
if(ent->IsClient())
|
if(ent->IsClient())
|
||||||
@ -225,7 +223,7 @@ bool HateList::RemoveEnt(Mob *ent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
@ -234,20 +232,19 @@ void HateList::DoFactionHits(int32 nfl_id) {
|
|||||||
_ZP(HateList_DoFactionHits);
|
_ZP(HateList_DoFactionHits);
|
||||||
if (nfl_id <= 0)
|
if (nfl_id <= 0)
|
||||||
return;
|
return;
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while(iterator != list.end())
|
||||||
while(iterator.MoreElements())
|
|
||||||
{
|
{
|
||||||
Client *p;
|
Client *p;
|
||||||
|
|
||||||
if (iterator.GetData()->ent && iterator.GetData()->ent->IsClient())
|
if ((*iterator)->ent && (*iterator)->ent->IsClient())
|
||||||
p = iterator.GetData()->ent->CastToClient();
|
p = (*iterator)->ent->CastToClient();
|
||||||
else
|
else
|
||||||
p = nullptr;
|
p = nullptr;
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
p->SetFactionLevel(p->CharacterID(), nfl_id, p->GetBaseClass(), p->GetBaseRace(), p->GetDeity());
|
p->SetFactionLevel(p->CharacterID(), nfl_id, p->GetBaseClass(), p->GetBaseRace(), p->GetDeity());
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,27 +259,26 @@ Mob *HateList::GetTop(Mob *center)
|
|||||||
int32 hateClientTypeInRange = -1;
|
int32 hateClientTypeInRange = -1;
|
||||||
int skipped_count = 0;
|
int skipped_count = 0;
|
||||||
|
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while(iterator != list.end())
|
||||||
while(iterator.MoreElements())
|
|
||||||
{
|
{
|
||||||
tHateEntry *cur = iterator.GetData();
|
tHateEntry *cur = (*iterator);
|
||||||
int16 aggroMod = 0;
|
int16 aggroMod = 0;
|
||||||
|
|
||||||
if(!cur){
|
if(!cur){
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cur->ent){
|
if(!cur->ent){
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
|
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
|
||||||
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
|
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
|
||||||
skipped_count++;
|
skipped_count++;
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +289,7 @@ Mob *HateList::GetTop(Mob *center)
|
|||||||
top = cur->ent;
|
top = cur->ent;
|
||||||
hate = 0;
|
hate = 0;
|
||||||
}
|
}
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,7 +344,7 @@ Mob *HateList::GetTop(Mob *center)
|
|||||||
top = cur->ent;
|
top = cur->ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(topClientTypeInRange != nullptr && top != nullptr) {
|
if(topClientTypeInRange != nullptr && top != nullptr) {
|
||||||
@ -382,16 +378,15 @@ Mob *HateList::GetTop(Mob *center)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
|
||||||
int skipped_count = 0;
|
int skipped_count = 0;
|
||||||
while(iterator.MoreElements())
|
while(iterator != list.end())
|
||||||
{
|
{
|
||||||
tHateEntry *cur = iterator.GetData();
|
tHateEntry *cur = (*iterator);
|
||||||
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
|
if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
|
||||||
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
|
if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) {
|
||||||
skipped_count++;
|
skipped_count++;
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -401,7 +396,7 @@ Mob *HateList::GetTop(Mob *center)
|
|||||||
top = cur->ent;
|
top = cur->ent;
|
||||||
hate = cur->hate;
|
hate = cur->hate;
|
||||||
}
|
}
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
if(top == nullptr && skipped_count > 0) {
|
if(top == nullptr && skipped_count > 0) {
|
||||||
return center->GetTarget();
|
return center->GetTarget();
|
||||||
@ -416,17 +411,16 @@ Mob *HateList::GetMostHate(){
|
|||||||
Mob* top = nullptr;
|
Mob* top = nullptr;
|
||||||
int32 hate = -1;
|
int32 hate = -1;
|
||||||
|
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while(iterator != list.end())
|
||||||
while(iterator.MoreElements())
|
|
||||||
{
|
{
|
||||||
tHateEntry *cur = iterator.GetData();
|
tHateEntry *cur = (*iterator);
|
||||||
if(cur->ent != nullptr && (cur->hate > hate))
|
if(cur->ent != nullptr && (cur->hate > hate))
|
||||||
{
|
{
|
||||||
top = cur->ent;
|
top = cur->ent;
|
||||||
hate = cur->hate;
|
hate = cur->hate;
|
||||||
}
|
}
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
@ -434,22 +428,13 @@ Mob *HateList::GetMostHate(){
|
|||||||
|
|
||||||
Mob *HateList::GetRandom()
|
Mob *HateList::GetRandom()
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = list.size();
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
int random = MakeRandomInt(0, count - 1);
|
||||||
while(iterator.MoreElements())
|
|
||||||
{
|
|
||||||
iterator.Advance();
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
if(!count)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
int random = MakeRandomInt(0, count-1);
|
|
||||||
iterator.Reset();
|
|
||||||
for (int i = 0; i < random; i++)
|
for (int i = 0; i < random; i++)
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
return iterator.GetData()->ent;
|
|
||||||
|
return (*iterator)->ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 HateList::GetEntHate(Mob *ent, bool damage)
|
int32 HateList::GetEntHate(Mob *ent, bool damage)
|
||||||
@ -470,22 +455,21 @@ int32 HateList::GetEntHate(Mob *ent, bool damage)
|
|||||||
bool HateList::IsEmpty() {
|
bool HateList::IsEmpty() {
|
||||||
_ZP(HateList_IsEmpty);
|
_ZP(HateList_IsEmpty);
|
||||||
|
|
||||||
return(list.Count() == 0);
|
return(list.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints hate list to a client
|
// Prints hate list to a client
|
||||||
void HateList::PrintToClient(Client *c)
|
void HateList::PrintToClient(Client *c)
|
||||||
{
|
{
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while (iterator != list.end())
|
||||||
while (iterator.MoreElements())
|
|
||||||
{
|
{
|
||||||
tHateEntry *e = iterator.GetData();
|
tHateEntry *e = (*iterator);
|
||||||
c->Message(0, "- name: %s, damage: %d, hate: %d",
|
c->Message(0, "- name: %s, damage: %d, hate: %d",
|
||||||
(e->ent && e->ent->GetName()) ? e->ent->GetName() : "(null)",
|
(e->ent && e->ent->GetName()) ? e->ent->GetName() : "(null)",
|
||||||
e->damage, e->hate);
|
e->damage, e->hate);
|
||||||
|
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,12 +480,11 @@ int HateList::AreaRampage(Mob *caster, Mob *target)
|
|||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
std::list<uint32> id_list;
|
std::list<uint32> id_list;
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while (iterator != list.end())
|
||||||
while (iterator.MoreElements())
|
|
||||||
{
|
{
|
||||||
tHateEntry *h = iterator.GetData();
|
tHateEntry *h = (*iterator);
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
if(h && h->ent && h->ent != caster)
|
if(h && h->ent && h->ent != caster)
|
||||||
{
|
{
|
||||||
if(caster->CombatRange(h->ent))
|
if(caster->CombatRange(h->ent))
|
||||||
@ -539,11 +522,10 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range)
|
|||||||
//So keep a list of entity ids and look up after
|
//So keep a list of entity ids and look up after
|
||||||
std::list<uint32> id_list;
|
std::list<uint32> id_list;
|
||||||
range = range * range;
|
range = range * range;
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
auto iterator = list.begin();
|
||||||
iterator.Reset();
|
while (iterator != list.end())
|
||||||
while (iterator.MoreElements())
|
|
||||||
{
|
{
|
||||||
tHateEntry *h = iterator.GetData();
|
tHateEntry *h = (*iterator);
|
||||||
if(range > 0)
|
if(range > 0)
|
||||||
{
|
{
|
||||||
if(caster->DistNoRoot(*h->ent) <= range)
|
if(caster->DistNoRoot(*h->ent) <= range)
|
||||||
@ -555,7 +537,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range)
|
|||||||
{
|
{
|
||||||
id_list.push_back(h->ent->GetID());
|
id_list.push_back(h->ent->GetID());
|
||||||
}
|
}
|
||||||
iterator.Advance();
|
++iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<uint32>::iterator iter = id_list.begin();
|
std::list<uint32>::iterator iter = id_list.begin();
|
||||||
@ -570,16 +552,3 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HateList::GetHateList(std::list<tHateEntry*> &h_list)
|
|
||||||
{
|
|
||||||
h_list.clear();
|
|
||||||
LinkedListIterator<tHateEntry*> iterator(list);
|
|
||||||
iterator.Reset();
|
|
||||||
while(iterator.MoreElements())
|
|
||||||
{
|
|
||||||
tHateEntry *ent = iterator.GetData();
|
|
||||||
h_list.push_back(ent);
|
|
||||||
iterator.Advance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -68,15 +68,15 @@ public:
|
|||||||
void PrintToClient(Client *c);
|
void PrintToClient(Client *c);
|
||||||
|
|
||||||
//For accessing the hate list via perl; don't use for anything else
|
//For accessing the hate list via perl; don't use for anything else
|
||||||
void GetHateList(std::list<tHateEntry*> &h_list);
|
std::list<tHateEntry*>& GetHateList() { return list; }
|
||||||
|
|
||||||
//setting owner
|
//setting owner
|
||||||
void SetOwner(Mob *newOwner) { owner = newOwner; }
|
void SetOwner(Mob *newOwner) { owner = newOwner; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
tHateEntry *Find(Mob *ent);
|
tHateEntry* Find(Mob *ent);
|
||||||
private:
|
private:
|
||||||
LinkedList<tHateEntry*> list;
|
std::list<tHateEntry*> list;
|
||||||
Mob *owner;
|
Mob *owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -757,8 +757,7 @@ Lua_HateList Lua_Mob::GetHateList() {
|
|||||||
Lua_Safe_Call_HateList();
|
Lua_Safe_Call_HateList();
|
||||||
Lua_HateList ret;
|
Lua_HateList ret;
|
||||||
|
|
||||||
std::list<tHateEntry*> h_list;
|
auto h_list = self->GetHateList();
|
||||||
self->GetHateList(h_list);
|
|
||||||
auto iter = h_list.begin();
|
auto iter = h_list.begin();
|
||||||
while(iter != h_list.end()) {
|
while(iter != h_list.end()) {
|
||||||
tHateEntry *ent = (*iter);
|
tHateEntry *ent = (*iter);
|
||||||
|
|||||||
@ -409,7 +409,7 @@ public:
|
|||||||
void RemoveFromFeignMemory(Client* attacker);
|
void RemoveFromFeignMemory(Client* attacker);
|
||||||
void ClearFeignMemory();
|
void ClearFeignMemory();
|
||||||
void PrintHateListToClient(Client *who) { hate_list.PrintToClient(who); }
|
void PrintHateListToClient(Client *who) { hate_list.PrintToClient(who); }
|
||||||
void GetHateList(std::list<tHateEntry*> &h_list) { return hate_list.GetHateList(h_list); }
|
std::list<tHateEntry*>& GetHateList() { return hate_list.GetHateList(); }
|
||||||
bool CheckLos(Mob* other);
|
bool CheckLos(Mob* other);
|
||||||
bool CheckLosFN(Mob* other);
|
bool CheckLosFN(Mob* other);
|
||||||
bool CheckLosFN(float posX, float posY, float posZ, float mobSize);
|
bool CheckLosFN(float posX, float posY, float posZ, float mobSize);
|
||||||
|
|||||||
@ -6510,9 +6510,8 @@ XS(XS_Mob_GetHateList)
|
|||||||
if(THIS == nullptr)
|
if(THIS == nullptr)
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||||
|
|
||||||
std::list<tHateEntry*> hate_list;
|
auto hate_list = THIS->GetHateList();
|
||||||
THIS->GetHateList(hate_list);
|
auto iter = hate_list.begin();
|
||||||
std::list<tHateEntry*>::iterator iter = hate_list.begin();
|
|
||||||
|
|
||||||
while(iter != hate_list.end())
|
while(iter != hate_list.end())
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user