ID:273514
 
I know that mob.Logout() is called when at client.Del(). Is it called during the proc, or after the proc has completed? I can't recall.

I'm having an issue in a game of mine where, from what it seems, the player's mob is not saving/loading properly, and when it is tried to load a corrupted mob, it just loads a blank player mob. When that mob is loaded and tries to logout, the world crashes. I'm trying to see if it is an issue of bad deletion timing when it's trying to be saved.

It's an issue that started to occur in a newer version of the game that isn't in an older version. Unfortunately, I no longer have an older version's source (i do have the host files and the rsc though) so I have no way of comparing without an RSC decompiler or something.
This may be incorrect, but after some testing, I have determined that client/Del() does not actually call mob/Logout() manually (which I thought it did).
client
Del()
world.log << "Start Del(): [mob]"
..()
world.log << "End Del(): [mob]"

mob
Logout()
world.log << "Start Logout(): [key] [client]"
..()
world.log << "End Logout(): [key] [client]"


This code prints the following:
Start Del(): Keeth
End Del(): Keeth
Start Logout(): Keeth
End Logout(): Keeth


This indicates the client is deleted before Logout() starts, by default.

I also manually crashed Logout() to grab the "stack trace" I think it's called:
runtime error: Killing Logout() manually.
proc name: Logout (/mob/Logout)
usr: Keeth (/mob)
src: Keeth (/mob)
call stack:
Keeth (/mob): Logout()


This shows that client/Del() does not directly call Logout().

If it did, the trace would look something like this:
runtime error: Killing Logout() manually.
proc name: Logout (/mob/Logout)
usr: Keeth (/mob)
src: Keeth (/mob)
call stack:
Keeth (/mob): Logout()
Keeth (/client): Del() // I called mob/Logout() manually for this test.


This is probably a case of the reference to the client disappearing, causing mob/Logout() to be called.

Sorry about that... but anyway...

It'd be nice to see what you're doing in Logout(), or if you have any error logs, so we can determine what the issue is exactly.
In response to Keeth
So, the client deletion occurs before the mob logs out? Alright, that might actually help right there. Let me do a little testing first, then if it doesn't resolve anything I'll post both my client/Del() and my mob/player/Logout() and see what's going on.
Corrupted savefiles are a result of poor saving practices 9 times out of 10. Post what your saving code looks like.
In response to Garthor
It's all good now. It had to do with something I was doing in mob/Logout() that should've been done in client/Del(). I needed to clarify what was called when to be sure. Thanks for the help guys.