Yes, there's the problem. And yes, we should be able to fix it.
At least I can extrapolate on how it fails.
Assume char X enters the room
X is not a thief, so he triggers the first if
The trigger waits a sec
... sends something to X
... and X's room
X quits (or rents out, or dies). X is now not in a room. But X is still online, so the trigger isn't stopped.
The trigger sends something to the room
... and attempts to move X
This fails, because X no longer is in the game (but at the menu, doing whatever).
So, how to fix this?
Either,
1) in the action functions (%force%, %teleport%, etc), checking if the player is in game before performing an action on them, or
2) when waking after waitstates, check that the player is actually a valid target
It turns out we have 1) in place in most such functions, but miss it in do_mteleport
github.com/tbamud/tbamud/blob/master/src/dg_mobcmd.c#L624
:
Code:
} else {
if (*arg1 == UID_CHAR) {
if (!(vict = get_char(arg1))) {
mob_log(ch, "mteleport: victim (%s) does not exist",arg1);
return;
}
} else if (!(vict = get_char_vis(ch, arg1, NULL, FIND_CHAR_WORLD))) {
mob_log(ch, "mteleport: victim (%s) does not exist",arg1);
return;
}
- if (valid_dg_target(ch, DG_ALLOW_GODS)) {
+ if (valid_dg_target(vict, DG_ALLOW_GODS)) {
char_from_room(vict);
char_to_room(vict, target);
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
}
}
}