summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2018-03-18 18:56:49 -0400
committergumi <git@gumi.ca>2018-03-18 18:56:49 -0400
commit190672e6da2f3fd3bb740ba886693b0e3c3727ba (patch)
tree2b2de66a8f1c11b8d63e926b82eea993742e5d78
parent19f008023051bb533e84692bf570227b8e03e8ca (diff)
downloadtmwa-190672e6da2f3fd3bb740ba886693b0e3c3727ba.tar.gz
tmwa-190672e6da2f3fd3bb740ba886693b0e3c3727ba.tar.bz2
tmwa-190672e6da2f3fd3bb740ba886693b0e3c3727ba.tar.xz
tmwa-190672e6da2f3fd3bb740ba886693b0e3c3727ba.zip
skip @hidden players (such as bots) when iterating with @hugo
-rw-r--r--src/map/atcommand.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 81b0e2b..a21848b 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -4897,11 +4897,29 @@ ATCE atcommand_jump_iterate(Session *s, dumb_ptr<map_session_data> sd,
if (!pl_sd)
pl_sd = get_start();
- if (pl_sd == sd)
+ for (int i = 0, e = map_getusers(); i <= e; ++i)
{
+ if (pl_sd != sd && !bool(pl_sd->status.option & Opt0::HIDE))
+ break;
+
+ // the target player is either hidden or is ourselves, so find another one
pl_sd = get_next(pl_sd);
if (!pl_sd)
pl_sd = get_start();
+
+ if (i == e)
+ {
+ // we reached the end of the list, and couldn't find anyone else
+ if (e == map_getusers())
+ {
+ pl_sd = sd; // silently warp to ourselves if no new user came online
+ break;
+ }
+
+ // or, if number of online players changed, try again
+ i = 0;
+ e = map_getusers();
+ }
}
if (pl_sd->bl_m->flag.get(MapFlag::NOWARPTO)