From: Rick L Bird Date: Thu, 5 May 2011 23:40:47 +0000 (-0400) Subject: PennMUSH 1.8.3p11 X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=35a376136693d8fb0aa54c9d6850fa9c5c785ab4;p=cobramush.git PennMUSH 1.8.3p11 Author: talvo@talvo.com Date: Sat Nov 21 22:22:03 2009 +0000 Issue 139, make room() work on rooms. Note: this was not mentioned in changes file or anywhere else.. This commit also changes how do_lemit works. Fixes #140 --- diff --git a/src/speech.c b/src/speech.c index 77145d5..69be7c6 100644 --- a/src/speech.c +++ b/src/speech.c @@ -1373,7 +1373,6 @@ do_lemit(dbref player, const char *tbuf1, int flags) { /* give a message to the "absolute" location of an object */ dbref room; - int rec = 0; int na_flags = NA_INTER_HEAR; int silent = (flags & PEMIT_SILENT) ? 1 : 0; @@ -1381,22 +1380,14 @@ do_lemit(dbref player, const char *tbuf1, int flags) if (!Mobile(player)) return; - /* prevent infinite loop if player is inside himself */ - if (((room = Location(player)) == player) || !GoodObject(room)) { - notify(player, T("Invalid container object.")); - do_rawlog(LT_ERR, T("** BAD CONTAINER ** #%d is inside #%d."), player, - room); - return; - } - while (!IsRoom(room) && (rec < 15)) { - room = Location(room); - rec++; - } - if (rec > 15) { + room = absolute_room(player); + if (!GoodObject(room) || !IsRoom(room)) { notify(player, T("Too many containers.")); return; - } else if (!CanSpeak(player, room)) { - notify(player, T("You may not speak there!")); + } else if(!CanSpeak(player, room)) { + fail_lock(player, room, Speech_Lock, T("You may not speak there!"), + NOTHING); + return; } else { if (!silent && (Location(player) != room)) notify_format(player, T("You lemit: \"%s\""), tbuf1); @@ -1406,6 +1397,8 @@ do_lemit(dbref player, const char *tbuf1, int flags) } } + + /** notify_anything() function for zone emits. * \param current unused. * \param data array of notify data. diff --git a/src/utils.c b/src/utils.c index c6b169f..b6e94ff 100644 --- a/src/utils.c +++ b/src/utils.c @@ -703,12 +703,12 @@ absolute_room(dbref it) dbref room; if (!GoodObject(it)) return NOTHING; - room = Location(it); + if (IsRoom(it)) + return it; + room = IsExit(it) ? Home(it) : Location(it); if (!GoodObject(room)) return NOTHING; while (!IsRoom(room)) { - if (!GoodObject(Location(room))) - return room; room = Location(room); rec++; if (rec > 20)