mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-08 05:52:26 +00:00
Hatelist crash fix
This commit is contained in:
parent
c16fe3c810
commit
8aa13b51f4
@ -4,6 +4,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
|||||||
Secrets: Changed the functionality of EQDEBUG cmake flag. It now suppresses logs, but shows crashes in any scenario when set to 1. It will also now show crashes even if the log system is disabled.
|
Secrets: Changed the functionality of EQDEBUG cmake flag. It now suppresses logs, but shows crashes in any scenario when set to 1. It will also now show crashes even if the log system is disabled.
|
||||||
KLS: Change to how quest signals work, signals with no delay will now be added to the signal queue. This addresses an odd timing issue where NPCs are in a state of life/death flux when a signal from event_death goes off.
|
KLS: Change to how quest signals work, signals with no delay will now be added to the signal queue. This addresses an odd timing issue where NPCs are in a state of life/death flux when a signal from event_death goes off.
|
||||||
KLS: Added cmake flags to define how logging behavior works for each different log type.
|
KLS: Added cmake flags to define how logging behavior works for each different log type.
|
||||||
|
Secrets: Crash fix for Hatelist crash observed
|
||||||
|
|
||||||
== 04/18/2014 ==
|
== 04/18/2014 ==
|
||||||
Akkadius: Added #command error message suppression for those who don't want to see 'Command is not recognized' constantly
|
Akkadius: Added #command error message suppression for those who don't want to see 'Command is not recognized' constantly
|
||||||
|
|||||||
@ -445,6 +445,17 @@ Mob *HateList::GetMostHate(){
|
|||||||
Mob *HateList::GetRandom()
|
Mob *HateList::GetRandom()
|
||||||
{
|
{
|
||||||
int count = list.size();
|
int count = list.size();
|
||||||
|
if(count == 0) //If we don't have any entries it'll crash getting a random 0, -1 position.
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if(count == 1) //No need to do all that extra work if we only have one hate entry
|
||||||
|
{
|
||||||
|
if(*list.begin()) // Just in case tHateEntry is invalidated somehow...
|
||||||
|
return (*list.begin())->ent;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
auto iterator = list.begin();
|
auto iterator = list.begin();
|
||||||
int random = MakeRandomInt(0, count - 1);
|
int random = MakeRandomInt(0, count - 1);
|
||||||
for (int i = 0; i < random; i++)
|
for (int i = 0; i < random; i++)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user