Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CF: Patch: 'alias (fix)




>  Yeah - I can see a problem with the alias command as is, as anything internal
> which checks the name field can get confused.
> 
>   I believe that some altars do use the name field to determine what is
> sacrificed.

I'll check that. Nobody actually got this idea yet...
Looking at source seems to indicate that there is indeed a problem,
and trying it in game shows that it is indeed a problem. Fix below.
Sorry for the inconvience.

Guess I'm lucky that nobody around here has tried this... after all,
we still don't have the heart of Joey and the figurine of xan -:)

>  Also, I believe the improved weapon code likewise uses the name
> field.

I have changed the improved weapon code --- it automatically removes
the alias. Also, you currently can't alias an improved weapon. This
also fixed the "disappearing weapons" bug --- if you tried to improve
"10 foobars", you would up with one improved foobar --- the other 9
were gone -:)

>  For an alias command, it probable makes more sense to add an 'alias' field to
> the new object, and add the aliased name to that.  Then in the few places that
> player actually interacts with the object, use that name (ie, display code,
> pickup/drop/apply).

I had this idea, too --- but I didn't like it because of the additional
work.
> 
>  That is certainly less likely to reveal  obscure bugs that depend on name.  It
> will probably also involve fewer changes in the code.

What else depends on the name? Checkinv looks at some special field,
I changed the weapon improver (this was detected pretty quickly ---
somebody aliased his improved Skullcleaver, and couldn't wield it
anymore -:) (This was before we found the axe of B1FF...)

Christian

------------------------------ Cut ------------------------------

*** crossfire-0.93.7/common/button.c	Tue Jan  6 10:29:18 1998
--- crossfire/common/button.c	Mon Jan 12 12:02:38 1998
***************
*** 231,241 ****
  
    for (op=altar->above; op; op=op->above)
      if (!QUERY_FLAG(op,FLAG_ALIVE) && !QUERY_FLAG(op,FLAG_IS_LINKED) &&
  	op->type != PLAYER) {
        if ((ARCH_SACRIFICE(altar) == op->arch->name  ||
!           ARCH_SACRIFICE(altar) == op->name ||
  	  ARCH_SACRIFICE(altar) == op->slaying) 
  	  && NROF_SACRIFICE(altar) <= (op->nrof?op->nrof:1))
  		return op;
        if (!strcmp(ARCH_SACRIFICE(altar), "money") &&
  	  op->type==MONEY && op->nrof*op->value>=NROF_SACRIFICE(altar))
--- 231,242 ----
  
    for (op=altar->above; op; op=op->above)
      if (!QUERY_FLAG(op,FLAG_ALIVE) && !QUERY_FLAG(op,FLAG_IS_LINKED) &&
  	op->type != PLAYER) {
        if ((ARCH_SACRIFICE(altar) == op->arch->name  ||
!           (op->real_name==NULL && ARCH_SACRIFICE(altar) == op->name) ||
!           (op->real_name!=NULL && ARCH_SACRIFICE(altar) == op->real_name) ||
  	  ARCH_SACRIFICE(altar) == op->slaying) 
  	  && NROF_SACRIFICE(altar) <= (op->nrof?op->nrof:1))
  		return op;
        if (!strcmp(ARCH_SACRIFICE(altar), "money") &&
  	  op->type==MONEY && op->nrof*op->value>=NROF_SACRIFICE(altar))
[to unsubscribe etc., send mail to crossfire-request@ifi.uio.no]


References: