diff options
author | mekolat <mekolat@users.noreply.github.com> | 2015-10-14 15:58:59 -0400 |
---|---|---|
committer | mekolat <mekolat@users.noreply.github.com> | 2016-04-15 11:46:55 -0400 |
commit | 3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1 (patch) | |
tree | 158d45edd852a733bfc125a4dd324de98b934334 /src/map/script-fun.cpp | |
parent | 0fd54ac797cea996ba3430168b4a962df13c12fa (diff) | |
download | tmwa-3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1.tar.gz tmwa-3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1.tar.bz2 tmwa-3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1.tar.xz tmwa-3731a8e9a30f1fd9b30f99f94e2fe62bbdb285a1.zip |
add more params, allow get/set to use char id
Diffstat (limited to 'src/map/script-fun.cpp')
-rw-r--r-- | src/map/script-fun.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 3592095..f7108d0 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -995,7 +995,19 @@ void builtin_set(ScriptState *st) } else { - id = wrap<BlockId>(conv_num(st, sdata)); + int num = conv_num(st, sdata); + if (num >= 2000000) + id = wrap<BlockId>(num); + else if (num >= 150000) + { + dumb_ptr<map_session_data> p_sd = nullptr; + if ((p_sd = map_nick2sd(map_charid2nick(wrap<CharId>(num)))) != nullptr) + id = p_sd->bl_id; + else + return; + } + else + return; bl = map_id2bl(id); } } @@ -3399,7 +3411,19 @@ void builtin_get(ScriptState *st) } else { - id = wrap<BlockId>(conv_num(st, sdata)); + int num = conv_num(st, sdata); + if (num >= 2000000) + id = wrap<BlockId>(num); + else if (num >= 150000) + { + dumb_ptr<map_session_data> p_sd = nullptr; + if ((p_sd = map_nick2sd(map_charid2nick(wrap<CharId>(num)))) != nullptr) + id = p_sd->bl_id; + else + return; + } + else + return; bl = map_id2bl(id); } |