forked from github/server
fewer findparam calls are better
This commit is contained in:
parent
bcd6991703
commit
c6559414c6
1 changed files with 4 additions and 5 deletions
|
@ -819,13 +819,14 @@ static void give_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (p == P_ANY) {
|
else if (p == P_ANY) {
|
||||||
const char *s = getstrtoken();
|
const char *s;
|
||||||
|
|
||||||
if (!check_give(u, u2, NULL, GIVE_ALLITEMS)) {
|
if (!check_give(u, u2, NULL, GIVE_ALLITEMS)) {
|
||||||
feedback_give_not_allowed(u, ord);
|
feedback_give_not_allowed(u, ord);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (*s == 0) { /* Alle Gegenstände übergeben */
|
s = getstrtoken();
|
||||||
|
if (*s == 0) { /* GIVE ALL items that you have */
|
||||||
|
|
||||||
/* do these checks once, not for each item we have: */
|
/* do these checks once, not for each item we have: */
|
||||||
if (!(u->race->ec_flags & GIVEITEM) && u2 != NULL) {
|
if (!(u->race->ec_flags & GIVEITEM) && u2 != NULL) {
|
||||||
|
@ -859,9 +860,7 @@ static void give_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
param_t p2 = findparam(s, u->faction->locale);
|
if (isparam(s, u->faction->locale, P_PERSON)) {
|
||||||
|
|
||||||
if (p2 == P_PERSON) {
|
|
||||||
if (!(u->race->ec_flags & GIVEPERSON)) {
|
if (!(u->race->ec_flags & GIVEPERSON)) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, ord, "race_noregroup", "race", u->race));
|
msg_feedback(u, ord, "race_noregroup", "race", u->race));
|
||||||
|
|
Loading…
Reference in a new issue