Welcome, Guest. Please login or register.
Kingdoms of Ahln
Pages: [1]
  Print  
Author Topic: Error when logging a character in to a non-existant room.  (Read 642 times)
Saffire
Citizen
***
Posts: 136


View Profile
« on: November 15, 2008, 01:55:19 pm »

If a player logs out, and the room their character is stored in is deleted, they are unable to log back in to the game. The following error is displayed when they try to log in:

Quote
An error occurred when loading this character.
Logged
Saffire
Citizen
***
Posts: 136


View Profile
« Reply #1 on: November 15, 2008, 01:59:47 pm »

A temporary solution to this problem is to use the aput command to put the player inside an existing room.
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #2 on: November 15, 2008, 02:12:52 pm »

This was pretty easy to fix (I thought I had done it already). If an object's container does not exist or cannot be loaded, the object is moved to the default room. Does that seem reasonable?
Logged
Saffire
Citizen
***
Posts: 136


View Profile
« Reply #3 on: November 15, 2008, 02:16:18 pm »

Yep. Thats's exactly what I was thinking. I would have posted the solution with the thread, but I tinkered with it for a while and couldn't quite get it right, so I figured I'd just post it up so it was documented and then fiddle with it some more until you got around to it and fixed it. Tongue
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #4 on: November 15, 2008, 02:20:52 pm »

In case you want to fix your copy right away instead of waiting for me to put out a new release, here is the change. Just a few lines around line 299 in storage.rb:

Code:
--- components/storage.rb       (revision 111)
+++ components/storage.rb       (working copy)
@@ -297,7 +297,11 @@
                game_objects << object

                unless object.container.nil? or game_objects.loaded? object.container
-                       load_object(object.container, game_objects)
+                       begin
+                               load_object(object.container, game_objects)
+                       rescue MUDError::NoSuchGOID, MUDError::ObjectLoadError
+                               object.container = Config.start_room
+                       end
                end
                return object
        end
Logged
Saffire
Citizen
***
Posts: 136


View Profile
« Reply #5 on: November 15, 2008, 02:31:57 pm »

It works perfectly. Thanks Cheesy
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2006-2009, Simple Machines
Terra97 design by Bloc