From ddb7d90396d909a7c7fd5028e064150e947a9f2e Mon Sep 17 00:00:00 2001 From: Sader Fawall Date: Mon, 20 May 2019 16:36:16 +0200 Subject: [PATCH] Fix getareaunits coordinates (#4155) Co-Authored-By: AnnieRuru --- src/map/script.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/map/script.cpp b/src/map/script.cpp index 06c103200b..31260b7426 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -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));