forked from github/server
consistently rename ec_flags constants (ECF_*)
This commit is contained in:
parent
f934e4d5e3
commit
eb1dc731cb
14
src/give.c
14
src/give.c
|
@ -682,7 +682,7 @@ void give_cmd(unit * u, order * ord)
|
||||||
feedback_give_not_allowed(u, ord);
|
feedback_give_not_allowed(u, ord);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (u2 && !(u_race(u2)->ec_flags & GETITEM)) {
|
if (u2 && !(u_race(u2)->ec_flags & ECF_GETITEM)) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
|
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
|
||||||
return;
|
return;
|
||||||
|
@ -716,7 +716,7 @@ void give_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (p == P_UNIT) { /* Einheiten uebergeben */
|
else if (p == P_UNIT) { /* Einheiten uebergeben */
|
||||||
if (!(u_race(u)->ec_flags & GIVEUNIT)) {
|
if (!(u_race(u)->ec_flags & ECF_GIVEUNIT)) {
|
||||||
cmistake(u, ord, 167, MSG_COMMERCE);
|
cmistake(u, ord, 167, MSG_COMMERCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -736,7 +736,7 @@ void give_cmd(unit * u, order * ord)
|
||||||
if (!s || *s == 0) { /* GIVE ALL items that you have */
|
if (!s || *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 (u2 && !(u_race(u2)->ec_flags & GETITEM)) {
|
if (u2 && !(u_race(u2)->ec_flags & ECF_GETITEM)) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
|
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
|
||||||
return;
|
return;
|
||||||
|
@ -763,7 +763,7 @@ void give_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (isparam(s, u->faction->locale, P_PERSON)) {
|
if (isparam(s, u->faction->locale, P_PERSON)) {
|
||||||
if (!(u_race(u)->ec_flags & GIVEPERSON)) {
|
if (!(u_race(u)->ec_flags & ECF_GIVEPERSON)) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
|
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
|
||||||
}
|
}
|
||||||
|
@ -775,7 +775,7 @@ void give_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (u2 && !(u_race(u2)->ec_flags & GETITEM)) {
|
else if (u2 && !(u_race(u2)->ec_flags & ECF_GETITEM)) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
|
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
|
||||||
}
|
}
|
||||||
|
@ -816,7 +816,7 @@ void give_cmd(unit * u, order * ord)
|
||||||
|
|
||||||
if (isparam(s, u->faction->locale, P_PERSON)) {
|
if (isparam(s, u->faction->locale, P_PERSON)) {
|
||||||
message * msg;
|
message * msg;
|
||||||
if (!(u_race(u)->ec_flags & GIVEPERSON)) {
|
if (!(u_race(u)->ec_flags & ECF_GIVEPERSON)) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
|
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
|
||||||
return;
|
return;
|
||||||
|
@ -830,7 +830,7 @@ void give_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u2 != NULL) {
|
if (u2 != NULL) {
|
||||||
if (!(u_race(u2)->ec_flags & GETITEM)) {
|
if (!(u_race(u2)->ec_flags & ECF_GETITEM)) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
|
msg_feedback(u, ord, "race_notake", "race", u_race(u2)));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -36,7 +36,7 @@ static void setup_give(struct give *env) {
|
||||||
|
|
||||||
assert(env->f1);
|
assert(env->f1);
|
||||||
rc = test_create_race(env->f1->race ? env->f1->race->_name : "humon");
|
rc = test_create_race(env->f1->race ? env->f1->race->_name : "humon");
|
||||||
rc->ec_flags |= GIVEPERSON;
|
rc->ec_flags |= ECF_GIVEPERSON;
|
||||||
|
|
||||||
env->r = test_create_region(0, 0, ter);
|
env->r = test_create_region(0, 0, ter);
|
||||||
env->src = test_create_unit(env->f1, env->r);
|
env->src = test_create_unit(env->f1, env->r);
|
||||||
|
|
|
@ -58,9 +58,9 @@ static void test_flags(CuTest *tc) {
|
||||||
check_flag(tc, "undead", RCF_UNDEAD);
|
check_flag(tc, "undead", RCF_UNDEAD);
|
||||||
check_flag(tc, "dragon", RCF_DRAGON);
|
check_flag(tc, "dragon", RCF_DRAGON);
|
||||||
check_flag(tc, "fly", RCF_FLY);
|
check_flag(tc, "fly", RCF_FLY);
|
||||||
check_ec_flag(tc, "getitem", GETITEM);
|
check_ec_flag(tc, "getitem", ECF_GETITEM);
|
||||||
check_ec_flag(tc, "giveperson", GIVEPERSON);
|
check_ec_flag(tc, "giveperson", ECF_GIVEPERSON);
|
||||||
check_ec_flag(tc, "giveunit", GIVEUNIT);
|
check_ec_flag(tc, "giveunit", ECF_GIVEUNIT);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ int count)
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
int have = get_resource(u, rtype);
|
int have = get_resource(u, rtype);
|
||||||
|
|
||||||
if ((u_race(u)->ec_flags & GETITEM) == 0) {
|
if ((u_race(u)->ec_flags & ECF_GETITEM) == 0) {
|
||||||
mode &= (GET_SLACK | GET_RESERVE);
|
mode &= (GET_SLACK | GET_RESERVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ use_pooled(unit * u, const resource_type * rtype, unsigned int mode, int count)
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
int n = 0, have = get_resource(u, rtype);
|
int n = 0, have = get_resource(u, rtype);
|
||||||
|
|
||||||
if ((u_race(u)->ec_flags & GETITEM) == 0) {
|
if ((u_race(u)->ec_flags & ECF_GETITEM) == 0) {
|
||||||
mode &= (GET_SLACK | GET_RESERVE);
|
mode &= (GET_SLACK | GET_RESERVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,9 +233,9 @@ extern "C" {
|
||||||
#define RCF_FAMILIAR (1<<31) /* may be a familiar */
|
#define RCF_FAMILIAR (1<<31) /* may be a familiar */
|
||||||
|
|
||||||
/* Economic flags */
|
/* Economic flags */
|
||||||
#define GIVEPERSON (1<<2) /* <20>bergibt Personen */
|
#define ECF_GIVEPERSON (1<<2) /* <20>bergibt Personen */
|
||||||
#define GIVEUNIT (1<<3) /* Einheiten an andere Partei <20>bergeben */
|
#define ECF_GIVEUNIT (1<<3) /* Einheiten an andere Partei <20>bergeben */
|
||||||
#define GETITEM (1<<4) /* nimmt Gegenst<73>nde an */
|
#define ECF_GETITEM (1<<4) /* nimmt Gegenst<73>nde an */
|
||||||
#define ECF_REC_ETHEREAL (1<<7) /* Rekrutiert aus dem Nichts */
|
#define ECF_REC_ETHEREAL (1<<7) /* Rekrutiert aus dem Nichts */
|
||||||
#define ECF_REC_UNLIMITED (1<<8) /* Rekrutiert ohne Limit */
|
#define ECF_REC_UNLIMITED (1<<8) /* Rekrutiert ohne Limit */
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ static buddy *get_friends(const unit * u, int *numfriends)
|
||||||
buddy *nf, **fr = &friends;
|
buddy *nf, **fr = &friends;
|
||||||
|
|
||||||
/* some units won't take stuff: */
|
/* some units won't take stuff: */
|
||||||
if (u_race(u2)->ec_flags & GETITEM) {
|
if (u_race(u2)->ec_flags & ECF_GETITEM) {
|
||||||
while (*fr && (*fr)->faction->no < u2->faction->no)
|
while (*fr && (*fr)->faction->no < u2->faction->no)
|
||||||
fr = &(*fr)->next;
|
fr = &(*fr)->next;
|
||||||
nf = *fr;
|
nf = *fr;
|
||||||
|
@ -269,7 +269,7 @@ int gift_items(unit * u, int flags)
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
for (u2 = r->units; u2; u2 = u2->next) {
|
||||||
if (u2 != u && u2->faction == u->faction && u2->number > 0) {
|
if (u2 != u && u2->faction == u->faction && u2->number > 0) {
|
||||||
/* some units won't take stuff: */
|
/* some units won't take stuff: */
|
||||||
if (u_race(u2)->ec_flags & GETITEM) {
|
if (u_race(u2)->ec_flags & ECF_GETITEM) {
|
||||||
i_merge(&u2->items, &u->items);
|
i_merge(&u2->items, &u->items);
|
||||||
u->items = NULL;
|
u->items = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1424,11 +1424,11 @@ static int parse_races(xmlDocPtr doc)
|
||||||
rc->flags |= RCF_IRONGOLEM;
|
rc->flags |= RCF_IRONGOLEM;
|
||||||
|
|
||||||
if (xml_bvalue(node, "giveperson", false))
|
if (xml_bvalue(node, "giveperson", false))
|
||||||
rc->ec_flags |= GIVEPERSON;
|
rc->ec_flags |= ECF_GIVEPERSON;
|
||||||
if (xml_bvalue(node, "giveunit", false))
|
if (xml_bvalue(node, "giveunit", false))
|
||||||
rc->ec_flags |= GIVEUNIT;
|
rc->ec_flags |= ECF_GIVEUNIT;
|
||||||
if (xml_bvalue(node, "getitem", false))
|
if (xml_bvalue(node, "getitem", false))
|
||||||
rc->ec_flags |= GETITEM;
|
rc->ec_flags |= ECF_GETITEM;
|
||||||
if (xml_bvalue(node, "recruitethereal", false))
|
if (xml_bvalue(node, "recruitethereal", false))
|
||||||
rc->ec_flags |= ECF_REC_ETHEREAL;
|
rc->ec_flags |= ECF_REC_ETHEREAL;
|
||||||
if (xml_bvalue(node, "recruitunlimited", false))
|
if (xml_bvalue(node, "recruitunlimited", false))
|
||||||
|
|
|
@ -3533,7 +3533,7 @@ int pay_cmd(unit * u, struct order *ord)
|
||||||
static int reserve_i(unit * u, struct order *ord, int flags)
|
static int reserve_i(unit * u, struct order *ord, int flags)
|
||||||
{
|
{
|
||||||
char token[128];
|
char token[128];
|
||||||
if (u->number > 0 && (u_race(u)->ec_flags & GETITEM)) {
|
if (u->number > 0 && (u_race(u)->ec_flags & ECF_GETITEM)) {
|
||||||
int use, count, para;
|
int use, count, para;
|
||||||
const item_type *itype;
|
const item_type *itype;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct race *test_create_race(const char *name)
|
||||||
rc->maintenance = 10;
|
rc->maintenance = 10;
|
||||||
rc->hitpoints = 20;
|
rc->hitpoints = 20;
|
||||||
rc->maxaura = 100;
|
rc->maxaura = 100;
|
||||||
rc->ec_flags |= GETITEM;
|
rc->ec_flags |= ECF_GETITEM;
|
||||||
rc->battle_flags = BF_EQUIPMENT;
|
rc->battle_flags = BF_EQUIPMENT;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue