summaryrefslogtreecommitdiff
path: root/src/map/script-fun.cpp
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-07-05 12:59:52 -0400
committermekolat <mekolat@users.noreply.github.com>2015-07-05 12:59:52 -0400
commit7a561ba98e5908d4887a15148487ee1800312e1f (patch)
tree1e7e27dc8f07f25ef53aaaad2378e3f086fb4247 /src/map/script-fun.cpp
parentaaa7c09e2d0846734213dd6577b7c99dfe8c79c0 (diff)
downloadtmwa-7a561ba98e5908d4887a15148487ee1800312e1f.tar.gz
tmwa-7a561ba98e5908d4887a15148487ee1800312e1f.tar.bz2
tmwa-7a561ba98e5908d4887a15148487ee1800312e1f.tar.xz
tmwa-7a561ba98e5908d4887a15148487ee1800312e1f.zip
fix getmapusers
Diffstat (limited to 'src/map/script-fun.cpp')
-rw-r--r--src/map/script-fun.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 2822550..5e55e53 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -1752,29 +1752,36 @@ void builtin_getusers(ScriptState *st)
* マップ指定ユーザー数所得
*------------------------------------------
*/
+ static
+ void builtin_getareausers_sub(dumb_ptr<block_list> bl, int *users)
+ {
+ if (bool(bl->is_player()->status.option & Opt0::HIDE))
+ return;
+ (*users)++;
+ }
+
static
void builtin_getmapusers(ScriptState *st)
{
+ int users = 0;
MapName str = stringish<MapName>(ZString(conv_str(st, &AARG(0))));
P<map_local> m = TRY_UNWRAP(map_mapname2mapid(str),
{
push_int<ScriptDataInt>(st->stack, -1);
return;
});
- push_int<ScriptDataInt>(st->stack, m->users);
+ map_foreachinarea(std::bind(builtin_getareausers_sub, ph::_1, &users),
+ m,
+ 0, 0,
+ m->xs, m->ys,
+ BL::PC);
+ push_int<ScriptDataInt>(st->stack, users);
}
/*==========================================
* エリア指定ユーザー数所得
*------------------------------------------
*/
-static
-void builtin_getareausers_sub(dumb_ptr<block_list> bl, int *users)
-{
- if (bool(bl->is_player()->status.option & Opt0::HIDE))
- return;
- (*users)++;
-}
static
void builtin_getareausers_living_sub(dumb_ptr<block_list> bl, int *users)