This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ACP after type change


On Sun, 2004-05-16 at 17:19, mskala@ansuz.sooke.bc.ca wrote:
> This isn't a huge problem, but I think it's not really the most desirable
> behaviour:  on "change type", the newly-changed unit is given 0 ACP, and
> then the ACP to do the change is subtracted *after* the change; so if (as
> might often be the case) the unit is changing its own type, it ends up
> with -(the cost of the change) as its ACP after the change regardless of
> how many ACP it might have had before.  I'd rather see the ACP for the
> change subtracted first, and then the resulting value applied
> proportionally (as happens with HP, but maybe without the bonus "cannot be
> negative" feature that applies to HP).

Matthew,

  Please try the following patch and let me know if it addresses the
issue.

  Thanks,
    Eric

Index: actions.c
===================================================================
RCS file: /cvs/xconq/xconq/kernel/actions.c,v
retrieving revision 1.58
diff -r1.58 actions.c
3192a3193
>     int acpdebt = 0;
3194a3196
>     acpdebt = uu_acp_to_change_type(u2, u3);
3197c3199,3200
<     use_up_acp(unit, uu_acp_to_change_type(u2, u3));
---
>     if (!acp_indep(unit) && unit->act)
>       use_up_acp(unit, min(acpdebt, unit->act->acp - u_acp_min(u)));
Index: unit.c
===================================================================
RCS file: /cvs/xconq/xconq/kernel/unit.c,v
retrieving revision 1.79
diff -r1.79 unit.c
364a365,366
>     int oldacp = 0;
>     int oldacpuser = TRUE;
368a371,378
>     /* Record the old ACP. */
>     if (unit->act) {
> 	oldacp = unit->act->acp;
>     }
>     /* Flag if the unit did not use or did not have ACP. */
>     else {
> 	oldacpuser = FALSE;
>     }
378c388
< 			unit_desig(unit), u_type_name(newtype), unit->x, unit->y);
---
> 		unit_desig(unit), u_type_name(newtype), unit->x, unit->y);
389a400,423
>     /* Alter the unit's action vector as needed. */
>     /* Set the ACP to the same ratio of max as the unit had before. */
>     /* If old unit was ACP-indep or actionless, then we give the new unit 
>        a free booster in the world of ACP, if it is set up to use ACP. */
>     if (!oldacpuser) {
>         init_unit_actorstate(unit, FALSE);
> 	if (unit->act)
> 	  unit->act->initacp = unit->act->acp = u_acp(newtype);
>     }
>     else {
> 	if (u_acp(newtype) <= 0)
> 	  init_unit_actorstate(unit, FALSE);
> 	else {
> 	    if (oldacp > 0)
> 	      unit->act->initacp = unit->act->acp = 
> 				   (oldacp * u_acp_max(newtype)) / 
> 				   u_acp_max(oldtype);
> 	    else
> 	      unit->act->initacp = unit->act->acp = u_acp(newtype);
> 	}
>     }
>     /* Knock out the old nextaction. Might not be compatible. */
>     if (unit->act)
>       unit->act->nextaction.type = ACTION_NONE;
424a459
> #if (0)
426a462
> #endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]