Issue information

Issue ID
#87
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Sep 21, 2007 18:15
Last Post
Hercules Elf Bot
Sep 21, 2007 18:15
Confirmation
N/A

Hercules Elf Bot - Sep 21, 2007 18:15

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

(Originally reported in this topic)

CODE
            x=rand()%(x1-x0+1)+x0;
            y=rand()%(y1-y0+1)+y0;
This is the core of mob_once_spawn_area(), which is used to do spawning in several places.
If you input coordinates in reverse (that is, x0 > x1 or y0 > y1), it will likely spawn the mob OUTSIDE the defined zone. This equation should be replaced with something more correct.

Well, actually it won't even get that far, because
CODE
max=(y1-y0+1)*(x1-x0+1)*3; // <- negative value
if(j>=max){
    if(lx>=0){    // Since reference went wrong, the place which boiled before is used.
        x=lx;
        y=ly;
    }else
        return 0;    // Since reference of the place which boils first went wrong, it stops.
}
This... weirdo code gets executed and returns 0. No spawning gets done at all.