diff options
author | gumi <git@gumi.ca> | 2018-03-28 16:51:38 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2018-03-28 16:51:38 -0400 |
commit | 235c563427a6f2c0324145f3593640ef06472f1e (patch) | |
tree | 16476c6a0b44b68d92709e7321a0e42f3e96e33a | |
parent | 23a3adb0a735c2f71b25f3cfb4eddeee8214e278 (diff) | |
download | serverdata-235c563427a6f2c0324145f3593640ef06472f1e.tar.gz serverdata-235c563427a6f2c0324145f3593640ef06472f1e.tar.bz2 serverdata-235c563427a6f2c0324145f3593640ef06472f1e.tar.xz serverdata-235c563427a6f2c0324145f3593640ef06472f1e.zip |
use getmapinfo instead of getmapusers to check if a map exists
-rw-r--r-- | npc/commands/warp.txt | 6 | ||||
-rw-r--r-- | npc/functions/warp.txt | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/npc/commands/warp.txt b/npc/commands/warp.txt index 508827fa..f042f58a 100644 --- a/npc/commands/warp.txt +++ b/npc/commands/warp.txt @@ -44,11 +44,9 @@ OnCall: .@x = .@req_y ? .@req_x : .@x; .@y = .@req_y ? .@req_y : .@y; - // FIXME: here getmapusers() is used only to check if the map exists - // replace this when/if we get a dedicated function for that - if (getmapusers(.@map$) < 0) + if (!map_exists(.@map$)) { - if (getmapusers(.@atcmd_parameters$[0]) >= 0) + if (map_exists(.@atcmd_parameters$[0])) { .@map$ = .@atcmd_parameters$[0]; } diff --git a/npc/functions/warp.txt b/npc/functions/warp.txt index dd09d713..df7b76b0 100644 --- a/npc/functions/warp.txt +++ b/npc/functions/warp.txt @@ -3,6 +3,16 @@ // gumi + +// map_exists +// self-explanatory + +function script map_exists { + return getmapinfo(MAPINFO_ID, getarg(0)) >= 0; +} + + + // slide_or_warp // Slides the player instead of warping, when possible. // usage: |