Issue information

Issue ID
#434
Status
Confirmed
Severity
Fair
Started
Hercules Elf Bot
Nov 18, 2007 7:31
Last Post
Ind
Jul 29, 2013 18:37
Confirmation
N/A

Hercules Elf Bot - Nov 18, 2007 7:31

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=434

CODE
//Locate max range on which we can locate npc cells
for(x0 = x-xs; x0 > 0 && map_getcell(m, x0, y, CELL_CHKNPC); x0--);
for(x1 = x+xs; x1 < map[m].xs-1 && map_getcell(m, x1, y, CELL_CHKNPC); x1++);
for(y0 = y-ys; y0 > 0 && map_getcell(m, x, y0, CELL_CHKNPC); y0--);
for(y1 = y+ys; y1 < map[m].ys-1 && map_getcell(m, x, y1, CELL_CHKNPC); y1++);


When a npc moves, it removes its trigger area. This requires all nearby npcs whose area overlapped the removed one to re-deploy their cells.
Problem is, the way used now for searching does not discover all these npcs, and so once the npc moves, it cuts off some npcs' area.
The search keeps extending in a direction until it finds a cell that's not a NPC cell.

Current scan pattern:
░░░░▓░░░░
░░░░▓░░░░
░░▒▒▓▒▒░░
▓▓▓▒▒▒▓▓▓
░░▒▒▓▒▒░░
░░░░▓░░░░
░░░░▓░░░░

Proposed scan pattern:
CODE
222222222
211111112
210000012
210000012
210000012
211111112
222222222
(concentric rectangles expanding in iterations, stops when entire 'level' has no NPC cells)

This post has been edited by theultramage: Nov 17 2007, 11:35 PM