I haven't done much testing with this yet, but I have seen a few crashes from this. It seems the issue is that the client is trying to be assigned to a grid, but I haven't been able to find why this happens yet.
Core Dump:
Code:
Core was generated by `./zone dynamic_41 zone'.
Program terminated with signal 11, Segmentation fault.
[New process 28037]
[New process 28041]
[New process 28040]
[New process 28039]
[New process 28038]
#0 0x08259c54 in NPC::AssignWaypoints (this=0xb7d5200, grid=308) at /usr/include/c++/4.3/ext/new_allocator.h:108
108 { ::new((void *)__p) _Tp(__val); }
(gdb) print this->name
$1 = "Wildfire", '\0' <repeats 55 times>
(gdb) print zone->short_name
$2 = 0xae3c998 "provinggrounds"
(gdb) bt
#0 0x08259c54 in NPC::AssignWaypoints (this=0xb7d5200, grid=308) at /usr/include/c++/4.3/ext/new_allocator.h:108
#1 0x08136137 in Spawn2::LoadGrid (this=0xaf32dd8) at spawn2.cpp:231
#2 0x080e052c in Zone::Process (this=0xb764c48) at zone.cpp:1177
#3 0x08134a97 in main (argc=Cannot access memory at address 0x0
) at net.cpp:511
(gdb) frame 2
#2 0x080e052c in Zone::Process (this=0xb764c48) at zone.cpp:1177
1177 iterator.GetData()->LoadGrid();
(gdb) list
1172 initgrids_timer.Disable();
1173 LinkedListIterator<Spawn2*> iterator(spawn2_list);
1174
1175 iterator.Reset();
1176 while (iterator.MoreElements()) {
1177 iterator.GetData()->LoadGrid();
1178 iterator.Advance();
1179 }
1180 }
1181
(gdb) frame 1
#1 0x08136137 in Spawn2::LoadGrid (this=0xaf32dd8) at spawn2.cpp:231
231 npcthis->AssignWaypoints(grid_);
(gdb) list
226 return;
227 if(!entity_list.IsMobInZone(npcthis))
228 return;
229 //dont set an NPC's grid until its loaded for them.
230 npcthis->SetGrid(grid_);
231 npcthis->AssignWaypoints(grid_);
232 _log(SPAWNS__MAIN, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName());
233 }
234
235
(gdb) frame 0
#0 0x08259c54 in NPC::AssignWaypoints (this=0xb7d5200, grid=308) at /usr/include/c++/4.3/ext/new_allocator.h:108
108 { ::new((void *)__p) _Tp(__val); }
(gdb) list
103
104 // _GLIBCXX_RESOLVE_LIB_DEFECTS
105 // 402. wrong new expression in [some_] allocator::construct
106 void
107 construct(pointer __p, const _Tp& __val)
108 { ::new((void *)__p) _Tp(__val); }
109
110 #ifdef __GXX_EXPERIMENTAL_CXX0X__
111 template<typename... _Args>
112 void
(gdb)
spawn2.cpp
Code:
void Spawn2::LoadGrid() {
if(!npcthis)
return;
if(grid_ < 1)
return;
if(!entity_list.IsMobInZone(npcthis))
return;
//dont set an NPC's grid until its loaded for them.
npcthis->SetGrid(grid_);
npcthis->AssignWaypoints(grid_);
_log(SPAWNS__MAIN, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName());
}
I assume we could just add an IsClient() check in there before trying to assign waypoints and such, but I am not sure what the best solution is yet.