Added a check for multiple connected sessions to avoid moving disconnected object more than once. Resolves issue 145.

This commit is contained in:
Griatch 2011-03-19 22:17:00 +00:00
parent 8288534cf6
commit 2f78bacd97
6 changed files with 26 additions and 19 deletions

View file

@ -113,9 +113,10 @@ class Character(BaseCharacter):
We stove away the character when logging off, otherwise they will remain where
they are, 'headless', so to say.
"""
self.location.msg_contents("%s has left the game." % self.name)
self.db.prelogout_location = self.location
self.location = None
if self.location: # have to check, in case of multiple connections
self.location.msg_contents("%s has left the game." % self.name)
self.db.prelogout_location = self.location
self.location = None
def at_post_login(self):
"""

View file

@ -330,8 +330,7 @@ class CmdQuit(MuxCommand):
def func(self):
"hook function"
sessions = self.caller.sessions
for session in sessions:
for session in self.caller.sessions:
session.msg("Quitting. Hope to see you soon again.")
session.session_disconnect()

View file

@ -55,7 +55,7 @@ class Object(TypeClass):
if create_cmdset:
dbobj.cmdset = CmdSetHandler(dbobj)
if utils.inherits_from(self, settings.BASE_CHARACTER_TYPECLASS):
if utils.inherits_from(self, settings.BASE_CHARACTER_TYPECLASS) or utils.inherits_from(self, Character):
dbobj.cmdset.outside_access = False
if create_scripts:
dbobj.scripts = ScriptHandler(dbobj)

View file

@ -15,9 +15,13 @@ from django.conf import settings
# To ensure the sanity of the model, there are a
# few property names we won't allow the admin to
# set just like that.
# set just like that. Note that these are *not* related
# to *in-game* safety (if you can edit typeclasses you have
# full access anyway), so no protection against changing
# e.g. 'locks' or 'permissions' should go here.
PROTECTED = ['id', 'dbobj', 'db', 'objects', 'typeclass',
'attr', 'save', 'delete']
# If this is true, all non-protected property assignments
# are directly stored to a database attribute
try:

View file

@ -16,17 +16,20 @@ def log_trace(errmsg=None):
adds an extra line with added info.
"""
tracestring = format_exc()
if tracestring:
for line in tracestring.splitlines():
log.msg('[::] %s' % line)
if errmsg:
try:
errmsg = utils.to_str(errmsg)
except Exception, e:
errmsg = str(e)
for line in errmsg.splitlines():
log.msg('[EE] %s' % line)
try:
if tracestring:
for line in tracestring.splitlines():
log.msg('[::] %s' % line)
if errmsg:
try:
errmsg = utils.to_str(errmsg)
except Exception, e:
errmsg = str(e)
for line in errmsg.splitlines():
log.msg('[EE] %s' % line)
except Exception:
log.msg('[EE] %s' % errmsg )
def log_errmsg(errmsg):
"""
Prints/logs an error message to the server log.

View file

@ -204,7 +204,7 @@ $(document).keypress( function(event) {
}
else {
if (wresult == 38 || wresult == 40) {
// this fixes a bug in firefox, those are on ASCII format
// this fixes a bug in firefox, those are on ASCII format
return false;
}