10 Commits

Author SHA1 Message Date
Alex King
fea6cbf633
[Cleanup] Remove RemoveSpawnGroup() from spawngroup.h (#3090)
# Notes
- This is unused.
2023-03-17 06:17:44 -04:00
Michael Cook (mackal)
c6d5864aa9 Port SpawnGroup stuff to unique_ptr to fix leak
This was leaking on #repop, unsure of other cases, smart pointers should
cover us though.

Direct leak of 3600 byte(s) in 18 object(s) allocated from:
    #0 0x7f2b3dbe0d30 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x5645dc7c9dff in ZoneDatabase::LoadSpawnGroups(char const*, unsigned short, SpawnGroupList*) ../zone/spawngroup.cpp:241
    #2 0x5645dc9db3f5 in Zone::Depop(bool) ../zone/zone.cpp:1746
    #3 0x5645dca1ba6b in Zone::Repop(unsigned int) ../zone/zone.cpp:1777
    #4 0x5645db4624b7 in command_repop(Client*, Seperator const*) ../zone/command.cpp:5683

Indirect leak of 6552 byte(s) in 273 object(s) allocated from:
    #0 0x7f26f2ff8d30 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x558d00490bc6 in __gnu_cxx::new_allocator<std::_List_node<SpawnEntry*> >::allocate(unsigned long, void const*) /usr/include/c++/8/ext/new_allocator.h:111
    #2 0x558d00490bc6 in std::allocator_traits<std::allocator<std::_List_node<SpawnEntry*> > >::allocate(std::allocator<std::_List_node<SpawnEntry*> >&, unsigned long) /usr/include/c++/8/bits/alloc_traits.h:436
    #3 0x558d00490bc6 in std::__cxx11::_List_base<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_get_node() /usr/include/c++/8/bits/stl_list.h:450
    #4 0x558d00490bc6 in std::_List_node<SpawnEntry*>* std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_create_node<SpawnEntry* const&>(SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:642
    #5 0x558d00490bc6 in void std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_insert<SpawnEntry* const&>(std::_List_iterator<SpawnEntry*>, SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:1903
    #6 0x558d00490bc6 in std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::push_back(SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:1220
    #7 0x558d00490bc6 in SpawnGroup::AddSpawnEntry(SpawnEntry*) ../zone/spawngroup.cpp:122
    #8 0x558d00490bc6 in ZoneDatabase::LoadSpawnGroups(char const*, unsigned short, SpawnGroupList*) ../zone/spawngroup.cpp:291
    #9 0x558d006a1465 in Zone::Depop(bool) ../zone/zone.cpp:1746
    #10 0x558d006e1adb in Zone::Repop(unsigned int) ../zone/zone.cpp:1777
2021-03-02 12:39:04 -05:00
regneq
c2b3e85272 Added new pathgrid type 7 (GridCenterPoint). This grid causes a NPC to alternate between the first waypoint in their grid (Number 1 in the editor) and a random waypoint. (1 - 7 - 1 - 4 - 1 - 11 - 1 - 5 - 1, etc)
Changed the wandertype IDs to an enum so we know what we're looking at.
Added new pathgrid type 8 (GridRandomCenterPoint).  (SQL required) This new type causes a NPC to alternate between a random waypoint in grid_entries and a random waypoint marked with the new centerpoint column set to true. If no waypoints are marked as a centerpoint, this wandertype will not work. There is no numbering requirement or limit for centerpoints. You can have as many as you need.
New spawngroup field: wp_spawns (SQL required). Added a new spawngroup field, which is a boolean that if true changes the behavior of spawngroups this way: If the spawnpoint in the spawngroup has a grid, the NPC will spawn at a random waypoint location taken from its grid instead of the spawnpoint location.
New randompath behavior: The randompath grid type will now use the closest waypoint as its current waypoint on spawning.  This allows multiple spawn locations to use the same grid without having the undesirable behavior of walking to the first waypoint through walls and ignoring waypoint nodes. NPC::GetClosestWaypoint() was renamed to NPC::GetClosestWaypoints() as it was filling a list of multiple waypoints. a new method NPC::GetClosestWaypoint() returns a single waypoint in the form of an integer.
2020-01-24 15:11:08 -08:00
Noudess
2e98de3923 Changes to allow individual spawn2 locations to vary in npc selection (cond) 2019-09-02 10:34:09 -04:00
Akkadius
05e7c473df Simplified the use of roamboxes and improved the AI for roambox pathing 2019-08-16 03:25:34 -05:00
Akkadius
24f9e8d181 spawngroup.cpp & .h header include cleanup 2014-12-15 18:44:36 -06:00
cavedude00
1d6bd3cc5e Better flee runspeed calculation.
Added two new NPC special_abilities, ALWAYS_FLEE and FLEE_PERCENT.
Fixed an issue where a NPC could get stuck on a single coord in a rectangular roambox.
Added mindelay to spawngroup to allow for greater control of the roambox delay. SQL is required.
2014-02-26 18:06:16 -08:00
Michael Cook
0fdfe025cb Remove 'using namespaces std' fixes #61 2013-05-22 16:17:19 -04:00
j883376
4bdd8b2502 Change space indentation to tabs 2013-05-09 11:37:51 -04:00
KimLS
da7347f76f svn -> git Migration 2013-02-16 16:14:39 -08:00