Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#7616) decrease_unit_hp_smooth is broken
Home

[Freeciv-Dev] (PR#7616) decrease_unit_hp_smooth is broken

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7616) decrease_unit_hp_smooth is broken
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 5 Mar 2004 23:19:02 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7616 >

Long ago, Chris reported that a unit's HP may drop in combat then be 
restored to full.  I can't find that ticket now...

decrease_unit_hp_smooth is broken.  There's nothing really wrong with 
the implementation, but it's called at the wrong time!  By the time it's 
called punit0 and punit1 have already had their HP values updated.  Thus 
punit0->hp == hp0 and punit1->hp == hp1.

The only bug in the implementation of the function is that it assumes 
the above is not the case!  Although no HP decreasing should be done, 
the function will always decrease at least one unit's HP - hence the 
original bug report.

I don't really know why this is happening or what to do about it. 
Presumably a unit_info packet is being sent that's updating the HP 
before the combat_info packet arrives.  Maybe delta has something to do 
with it.  In any case the problem probably isn't limited to the client.

jason




[Prev in Thread] Current Thread [Next in Thread]