Issue Information
-
#000419
-
2 - Fair
-
Fixed
Issue Confirmations
-
Yes (0)No (0)
Originally posted by theultramage
http://www.eathena.w...ker&showbug=419
(originally reported in this topic)
I found a case of an incorrectly placed npc: its coordinates were outside of the map's dimensions.
Problem is that the code doesn't handle this situation very well...
So first it creates the npc, adds it to various databases, adds it to the map's npc list, deploys its trigger area,
and afterwards tries to attach the npc to a specific map square (returning '1'). No warnings whatsoever.
I suggest at least adding an 'if' here to report "invalid map or map coordinates".
The point of concern is that when doing @reloadscript, npc_remove_map() does "if(nd->bl.prev == NULL) return 1;", and doesn't remove the npc from the list. We then get npcs that don't get removed, and a followup warning message in the mapserver console.
This post has been edited by theultramage: Nov 20 2007, 11:15 AM
http://www.eathena.w...ker&showbug=419
(originally reported in this topic)
I found a case of an incorrectly placed npc: its coordinates were outside of the map's dimensions.
Problem is that the code doesn't handle this situation very well...
CODE
nd->n = map_addnpc(m, nd);
status_change_init(&nd->bl);
unit_dataset(&nd->bl);
nd->ud.dir = dir;
npc_setcells(nd);
map_addblock(&nd->bl); <- this fails
status_change_init(&nd->bl);
unit_dataset(&nd->bl);
nd->ud.dir = dir;
npc_setcells(nd);
map_addblock(&nd->bl); <- this fails
So first it creates the npc, adds it to various databases, adds it to the map's npc list, deploys its trigger area,
and afterwards tries to attach the npc to a specific map square (returning '1'). No warnings whatsoever.
I suggest at least adding an 'if' here to report "invalid map or map coordinates".
The point of concern is that when doing @reloadscript, npc_remove_map() does "if(nd->bl.prev == NULL) return 1;", and doesn't remove the npc from the list. We then get npcs that don't get removed, and a followup warning message in the mapserver console.
This post has been edited by theultramage: Nov 20 2007, 11:15 AM