[CF-Devel] (automatic) apply rings
crossfire-devel-admin at archives.real-time.com
crossfire-devel-admin at archives.real-time.com
Mon Mar 31 23:36:00 CST 2003
On Sun, 30 Mar 2003, Mark Wedel wrote:
>
>
Would it be sufficient to just have a command that unapplies all your rings?
>
That is much easier to do - don't need to store any extra information in the
>
ring object itself, and as said, something like that could probably be done in
>
the client.
>
A command to unapply all rings is not sufficient.
It would not save the problem of applying two rings of ice.
"apply ring of ice; apply ring of ice"
would still first equip one ring, then unequip this ring, while
"apply -a ring of ice; apply -a ring of ice"
would try to apply the same ring twice, whichever that is.
But, i think i have found a quick solution that will solve
most problems; without further blowing up object structure.
I have changed the behavior of the "apply -a" and the
"apply -u" commands.
Now "apply -u" will only match to applied objects, while
"apply -a" will only match unapplied ones.
(see attached patchfile)
Thus,
"apply -u ring; apply -u ring;
apply -a ring of ice; apply -a ring of ice"
will now unequip any two rings you have equipped,
then equip both rings of ice.
Even fireborns will be able to juggle their
4 rings and 2 amulets with bound commands.
However, i agree : this kind of stuff should be done
in the client.
Bernd Edler
-------------- next part --------------
*** orig/server/c_object.c Tue Apr 1 06:39:25 2003
--- server/c_object.c Tue Apr 1 06:42:29 2003
***************
*** 72,77 ****
--- 72,97 ----
}
return best;
}
+ /* Simlilar to find_best_object_match , but accepts an
+ * additional parameter for apply -u , and apply -a to
+ * only unapply applied , or apply unapplied objects
+ */
+ object *find_best_apply_object_match(object *pl, char *params, enum apply_flag aflag)
+ {
+ object *tmp, *best=NULL;
+ int match_val=0,tmpmatch;
+
+ for (tmp=pl->inv; tmp; tmp=tmp->below) {
+ if (tmp->invisible) continue;
+ if ((tmpmatch=item_matched_string(pl, tmp, params))>=match_val) {
+ if ((aflag==AP_APPLY) && (QUERY_FLAG(tmp,FLAG_APPLIED))) continue;
+ if ((aflag==AP_UNAPPLY) && (!QUERY_FLAG(tmp,FLAG_APPLIED))) continue;
+ match_val=tmpmatch;
+ best=tmp;
+ }
+ }
+ return best;
+ }
/*
* Notes about item creation:
***************
*** 426,432 ****
}
while (*params==' ') params++;
! inv=find_best_object_match(op, params);
if (inv) {
player_apply(op,inv,aflag,0);
} else
--- 446,452 ----
}
while (*params==' ') params++;
! inv=find_best_apply_object_match(op, params, aflag);
if (inv) {
player_apply(op,inv,aflag,0);
} else
More information about the crossfire
mailing list