Mike,

This "ref" value seems like it's going to be the way to go. That way I can keep track of exactly how many times it's been loaded, and how many times to SKIP unloading/extracting the character. I'm testing it now on a dev port. I'll let you know how it turns out. Thanks!

- Valnir

----- Original Message ----- From: "Mike Barton" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, December 15, 2004 7:51 PM
Subject: Re: Characters loosing EQ.


Well.. one easy way to fix it would be to put a "ref" value attached to the char. In get_char_offline, find the char if it's already online, otherwise load it. Increment ref by 1 and return that char. When get_char_offline is called again for that char, ref is again incremented and the player returned.
Then in unload_char, decrement ref.  If it's 0, unload the char.
Online players would have to already have a ref of 1 so that their ref never reaches 0.

Or, if it's always the top level char in finger giving you trouble, you can just put some flag on him in finger that will tell unload_char not to unload him just yet. Like ACT_DONT_REALLY_UNLOAD_THIS_GUY_YET.

Or, do an IS_VALID check in unload_char so you don't save anyone that's already been extracted.

--Palrich.

----- Original Message ----- From: "Valnir" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, December 15, 2004 2:50 PM
Subject: Characters loosing EQ.


Here is a good question for you guys.

We have a problem where when a character is loaded via "get_char_offline" and then another function ALSO gets the same char online/offline and does "unload_char", it dumps all the eq, then re-saves and unloads the char at the end of the prior function.

Example.

void do_finger ( CHAR_DATA *ch, char *argument )
{
   CHAR_DATA *victim;

   victim = get_char_offline( argument );
   check_followers( victim );

   // OUTPUT HERE

   unload_char( victim );
   return;
}

void check_followers( CHAR_DATA *ch )
{
   if ( !get_char_offline( follower ) )
       blah blah blah.

   unload_char( follower );
   return;
}

In "get_char_offline" the system uses "load_char_obj" and in "load_char_obj" it checks for a valid liege...... by "get_char_offline" and then "unload_char".

So we are unloading the char, before we're really done with it.. did I lose you?

I am sure SOMEONE has run across this issue.

--
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom


Reply via email to