Ok, here is what I think that is happening based on a quick look over the code.

The unit is killed and the animation triggers.  This then triggers any
events that depend upon the unit death, in this case Mordak's.  Note
that events don't necessarily remove the unit that has been killed,
since the event might be meant to stop the death from happening in
some way (although I don't know off the top of my head an example
where this is done).  Since this particular event has an endlevel
result=victory, the game throws an end_level_exception which used to
proceed to the next level, without finishing the removal of the dead
unit.  Without a linger mode, it was irrelavent.  With linger, the
dead unit isn't removed (although the death animation has taken
place).  Note that when you linger in a broken scenario, if you hover
your mouse over the hex that the unit died in, you will see it's
ghost.

With a linger mode (which is very cool!) I see a couple of
possibilties on how to deal with the problem.
1)  Have all events that trigger off of killed units actually remove
the unit from the game before being triggered, but put them into a
"graveyard" for temporary safekeeping.  An event could then actively
resurrect a unit in the graveyard if that was desired.  Units in the
graveyard could be purged at appropriate times, or kept around for
flavor.
2)  Remove all dead units before their death event triggers.  This
would be simpler, but would stop the use of death events as a means of
preventing death.

Personally, I like 1.  Hmm... I will have to see how difficult a
graveyard would be to implement.  But, don't wait for me, as it has
been a long time since I have been free enough to work on Wesnoth.

To fix this, you will probably need to play with actions.cpp In
particular around lines 1023 and 1246.

Hope this helps
Darth Fool

On Nov 23, 2007 11:38 AM, Eric S. Raymond <[EMAIL PROTECTED]> wrote:
> I've been looking for some traction on bug #10354 (Loading linger mode
> savegame has problems) for two days.  The symptom is that if you do
> a save from linger mode after killing the enemy leader, and then
> reload that save, the leader reappears with 0 hit points.
>
> I've gotten nowhere.  The code is just too opaque.  I'm stumped.
>
> Here's what I know:
>
> 1. It does happen in AToTB and Liberty, but *doesn't* happen in AOI.
>
> 2. It didn't manifest until I changed the savefile-load code to not fire
> the victory event a second time when a linger-mode save is loaded.
>
> I therefore guess that it has something to do with the timing of when
> killed units are removed from some internal list, but I don't know any
> more than that guess.
>
> I'm also fairly sure this is actually a pre-existing data-management
> flaw that linger mode has merely revealed rather than creating.
>
> If anybody out there actually understands the logic around unit deaths
> I could use some insight.
> --
>                 <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>
>
> Non-cooperation with evil is as much a duty as cooperation with good.
>         -- Mohandas Gandhi
>
> _______________________________________________
> Wesnoth-dev mailing list
> [email protected]
> https://mail.gna.org/listinfo/wesnoth-dev
>



-- 
-------------------------------------------------------------------
        "In theory, theory and practice are the same,
                 but in practice they're different."
-------------------------------------------------------------------
John W. C. McNabb
-------------------------------------------------------------------

_______________________________________________
Wesnoth-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-dev

Reply via email to