Fix getareaunits coordinates (#4155)

Co-Authored-By: AnnieRuru <annieruru@users.noreply.github.com>
This commit is contained in:
Sader Fawall
2019-05-20 16:36:16 +02:00
committed by Atemo
parent 317146c0d0
commit ddb7d90396

View File

@@ -11350,10 +11350,10 @@ BUILDIN_FUNC(getunits)
ShowWarning("buildin_%s: Unknown map '%s'.\n", command, str);
return SCRIPT_CMD_FAILURE;
}
x0 = script_getnum(st, 4);
y0 = script_getnum(st, 5);
x1 = script_getnum(st, 6);
y1 = script_getnum(st, 7);
x0 = min(script_getnum(st, 4), script_getnum(st, 6));
y0 = min(script_getnum(st, 5), script_getnum(st, 7));
x1 = max(script_getnum(st, 4), script_getnum(st, 6));
y1 = max(script_getnum(st, 5), script_getnum(st, 7));
if (script_hasdata(st, 8))
data = script_getdata(st, 8);
@@ -11385,7 +11385,7 @@ BUILDIN_FUNC(getunits)
for (bl = (struct block_list*)mapit_first(iter); mapit_exists(iter); bl = (struct block_list*)mapit_next(iter))
{
if (!m || (m == bl->m && !x0 && !y0 && !x1 && !y1) || (bl->m == m && (bl->x >= x0 && bl->y <= y0) && (bl->x <= x1 && bl->y >= y1)))
if (!m || (m == bl->m && !x0 && !y0 && !x1 && !y1) || (bl->m == m && (bl->x >= x0 && bl->y >= y0) && (bl->x <= x1 && bl->y <= y1)))
{
if (data)
set_reg(st, sd, reference_uid(id, idx + size), name, (is_string_variable(name) ? (void*)status_get_name(bl) : (void*)__64BPRTSIZE(bl->id)), reference_getref(data));