On Sun, Apr 09, 2006 at 10:41:34PM -0700, William Balcerski wrote:
> Here is a fix for properly undocking both ejected and ghostbusted
> players who may have been docked to a SB, which is one of the main
> sources of the dreaded starbase etemp bug.

Thanks Bill.  Kinda taken.  Actually I looked further into it, and found
there were a number of unhandled conditions that you didn't spot where
the etemp bug would appear again, such as:

- system induced process death, e.g. due to out of memory conditions,
- server admin killing processes with SIGKILL,
- ntserv program fault exit.

So I've reworked the design a little bit, removing the counter and
adding a crosscheck between the docking ports and the ships.

My change also moves the terminology from docking "ports" to docking
"bays" at the same time, so that I could more easily catch places where
I had not yet fixed things.

In struct player, deleted p_docked and p_ports[4].

Added p_bays[4], p_dock_with, and p_dock_bay.  This removed the
overloading that was done originally for performance reasons.

p_bays[4] works in a similar manner to p_ports[4] used to, except that
it is only used for starbases.  Each element in the array is either
VACANT (-1) or the p_no of the docked ship.

For the docked ship, the p_dock_with is set to the p_no of the base, and
the p_dock_bay is set to the p_bays array index value.

I've added a consistency checker that runs at the time a ship is docking
at a base.  Toggling docking also resets the bays.

In the daemon, where etemp is incremented, I've changed the logic to
count the active bays and determine the etemp addition from that count,
rather than rely on the count p_docked as before.

Patch to follow.

James Cameron    mailto:quozl at us.netrek.org     http://quozl.netrek.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20060410/0b482e13/attachment.pgp