forked from github/server
remove unused ECF_KEEP_ITEM flag.
This commit is contained in:
parent
1f996f1b04
commit
f934e4d5e3
|
@ -1062,16 +1062,6 @@
|
||||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) können nichts stehelen."</text>
|
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) können nichts stehelen."</text>
|
||||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) cannot steal anything."</text>
|
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) cannot steal anything."</text>
|
||||||
</message>
|
</message>
|
||||||
<message name="race_nogive" section="production">
|
|
||||||
<type>
|
|
||||||
<arg name="unit" type="unit"/>
|
|
||||||
<arg name="region" type="region"/>
|
|
||||||
<arg name="command" type="order"/>
|
|
||||||
<arg name="race" type="race"/>
|
|
||||||
</type>
|
|
||||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) geben nichts weg."</text>
|
|
||||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - $race($race,0) do not give things away."</text>
|
|
||||||
</message>
|
|
||||||
<message name="regionmessage" section="mail">
|
<message name="regionmessage" section="mail">
|
||||||
<type>
|
<type>
|
||||||
<arg name="sender" type="unit"/>
|
<arg name="sender" type="unit"/>
|
||||||
|
|
19
src/give.c
19
src/give.c
|
@ -678,11 +678,6 @@ void give_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
else if (p == P_HERBS) {
|
else if (p == P_HERBS) {
|
||||||
bool given = false;
|
bool given = false;
|
||||||
if ((u_race(u)->ec_flags & ECF_KEEP_ITEM) && u2 != NULL) {
|
|
||||||
ADDMSG(&u->faction->msgs,
|
|
||||||
msg_feedback(u, ord, "race_nogive", "race", u_race(u)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!can_give(u, u2, NULL, GIVE_HERBS)) {
|
if (!can_give(u, u2, NULL, GIVE_HERBS)) {
|
||||||
feedback_give_not_allowed(u, ord);
|
feedback_give_not_allowed(u, ord);
|
||||||
return;
|
return;
|
||||||
|
@ -741,11 +736,6 @@ 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 ((u_race(u)->ec_flags & ECF_KEEP_ITEM) && u2 != NULL) {
|
|
||||||
ADDMSG(&u->faction->msgs,
|
|
||||||
msg_feedback(u, ord, "race_nogive", "race", u_race(u)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (u2 && !(u_race(u2)->ec_flags & GETITEM)) {
|
if (u2 && !(u_race(u2)->ec_flags & 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)));
|
||||||
|
@ -785,10 +775,6 @@ void give_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((u_race(u)->ec_flags & ECF_KEEP_ITEM) && u2 != NULL) {
|
|
||||||
ADDMSG(&u->faction->msgs,
|
|
||||||
msg_feedback(u, ord, "race_nogive", "race", u_race(u)));
|
|
||||||
}
|
|
||||||
else if (u2 && !(u_race(u2)->ec_flags & GETITEM)) {
|
else if (u2 && !(u_race(u2)->ec_flags & 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)));
|
||||||
|
@ -844,11 +830,6 @@ void give_cmd(unit * u, order * ord)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u2 != NULL) {
|
if (u2 != NULL) {
|
||||||
if ((u_race(u)->ec_flags & ECF_KEEP_ITEM)) {
|
|
||||||
ADDMSG(&u->faction->msgs,
|
|
||||||
msg_feedback(u, ord, "race_nogive", "race", u_race(u)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!(u_race(u2)->ec_flags & GETITEM)) {
|
if (!(u_race(u2)->ec_flags & 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)));
|
||||||
|
|
|
@ -59,7 +59,6 @@ static void test_flags(CuTest *tc) {
|
||||||
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", GETITEM);
|
||||||
check_ec_flag(tc, "keepitem", ECF_KEEP_ITEM);
|
|
||||||
check_ec_flag(tc, "giveperson", GIVEPERSON);
|
check_ec_flag(tc, "giveperson", GIVEPERSON);
|
||||||
check_ec_flag(tc, "giveunit", GIVEUNIT);
|
check_ec_flag(tc, "giveunit", GIVEUNIT);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
|
|
@ -179,9 +179,6 @@ int count)
|
||||||
if (u != v) {
|
if (u != v) {
|
||||||
int mask;
|
int mask;
|
||||||
|
|
||||||
if ((u_race(v)->ec_flags & ECF_KEEP_ITEM))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (v->faction == f) {
|
if (v->faction == f) {
|
||||||
mask = (mode >> 3) & (GET_SLACK | GET_RESERVE);
|
mask = (mode >> 3) & (GET_SLACK | GET_RESERVE);
|
||||||
}
|
}
|
||||||
|
@ -232,9 +229,6 @@ use_pooled(unit * u, const resource_type * rtype, unsigned int mode, int count)
|
||||||
for (v = r->units; use > 0 && v != NULL; v = v->next) {
|
for (v = r->units; use > 0 && v != NULL; v = v->next) {
|
||||||
if (u != v) {
|
if (u != v) {
|
||||||
int mask;
|
int mask;
|
||||||
if ((u_race(v)->ec_flags & ECF_KEEP_ITEM))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (v->faction == f) {
|
if (v->faction == f) {
|
||||||
mask = (mode >> 3) & (GET_SLACK | GET_RESERVE);
|
mask = (mode >> 3) & (GET_SLACK | GET_RESERVE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,6 @@ 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 ECF_KEEP_ITEM (1<<1) /* gibt Gegenst<73>nde weg */
|
|
||||||
#define GIVEPERSON (1<<2) /* <20>bergibt Personen */
|
#define GIVEPERSON (1<<2) /* <20>bergibt Personen */
|
||||||
#define GIVEUNIT (1<<3) /* Einheiten an andere Partei <20>bergeben */
|
#define GIVEUNIT (1<<3) /* Einheiten an andere Partei <20>bergeben */
|
||||||
#define GETITEM (1<<4) /* nimmt Gegenst<73>nde an */
|
#define GETITEM (1<<4) /* nimmt Gegenst<73>nde an */
|
||||||
|
|
|
@ -225,13 +225,6 @@ static buddy *get_friends(const unit * u, int *numfriends)
|
||||||
nf->number = 0;
|
nf->number = 0;
|
||||||
*fr = nf;
|
*fr = nf;
|
||||||
}
|
}
|
||||||
else if (nf->faction == u2->faction
|
|
||||||
&& !(u_race(u2)->ec_flags & ECF_KEEP_ITEM)) {
|
|
||||||
/* we don't like to gift it to units that won't give it back */
|
|
||||||
if ((u_race(nf->unit)->ec_flags & ECF_KEEP_ITEM)) {
|
|
||||||
nf->unit = u2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nf->number += u2->number;
|
nf->number += u2->number;
|
||||||
number += u2->number;
|
number += u2->number;
|
||||||
}
|
}
|
||||||
|
@ -269,8 +262,6 @@ int gift_items(unit * u, int flags)
|
||||||
|
|
||||||
if (u->items == NULL || fval(u_race(u), RCF_ILLUSIONARY))
|
if (u->items == NULL || fval(u_race(u), RCF_ILLUSIONARY))
|
||||||
return 0;
|
return 0;
|
||||||
if ((u_race(u)->ec_flags & ECF_KEEP_ITEM))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* at first, I should try giving my crap to my own units in this region */
|
/* at first, I should try giving my crap to my own units in this region */
|
||||||
if (u->faction && (u->faction->flags & FFL_QUIT) == 0 && (flags & GIFT_SELF)) {
|
if (u->faction && (u->faction->flags & FFL_QUIT) == 0 && (flags & GIFT_SELF)) {
|
||||||
|
@ -279,16 +270,10 @@ int gift_items(unit * u, int flags)
|
||||||
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 & GETITEM) {
|
||||||
/* we don't like to gift it to units that won't give it back */
|
|
||||||
if (!(u_race(u2)->ec_flags & ECF_KEEP_ITEM)) {
|
|
||||||
i_merge(&u2->items, &u->items);
|
i_merge(&u2->items, &u->items);
|
||||||
u->items = NULL;
|
u->items = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
u3 = u2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (u->items && u3) {
|
if (u->items && u3) {
|
||||||
|
|
|
@ -1423,8 +1423,6 @@ static int parse_races(xmlDocPtr doc)
|
||||||
if (xml_bvalue(node, "irongolem", false))
|
if (xml_bvalue(node, "irongolem", false))
|
||||||
rc->flags |= RCF_IRONGOLEM;
|
rc->flags |= RCF_IRONGOLEM;
|
||||||
|
|
||||||
if (xml_bvalue(node, "keepitem", false))
|
|
||||||
rc->ec_flags |= ECF_KEEP_ITEM;
|
|
||||||
if (xml_bvalue(node, "giveperson", false))
|
if (xml_bvalue(node, "giveperson", false))
|
||||||
rc->ec_flags |= GIVEPERSON;
|
rc->ec_flags |= GIVEPERSON;
|
||||||
if (xml_bvalue(node, "giveunit", false))
|
if (xml_bvalue(node, "giveunit", false))
|
||||||
|
|
|
@ -2823,7 +2823,7 @@ static void age_stonecircle(building *b) {
|
||||||
if (!mage && is_mage(u)) {
|
if (!mage && is_mage(u)) {
|
||||||
mage = u;
|
mage = u;
|
||||||
}
|
}
|
||||||
if (rtype && (u_race(u)->ec_flags & ECF_KEEP_ITEM) == 0) {
|
if (rtype) {
|
||||||
int n, unicorns = 0;
|
int n, unicorns = 0;
|
||||||
for (n = 0; n != u->number; ++n) {
|
for (n = 0; n != u->number; ++n) {
|
||||||
if (chance(0.02)) {
|
if (chance(0.02)) {
|
||||||
|
|
13
src/upkeep.c
13
src/upkeep.c
|
@ -38,11 +38,6 @@ int lifestyle(const unit * u)
|
||||||
return need;
|
return need;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool help_money(const unit * u)
|
|
||||||
{
|
|
||||||
return !(u_race(u)->ec_flags & ECF_KEEP_ITEM);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void help_feed(unit * donor, unit * u, int *need_p)
|
static void help_feed(unit * donor, unit * u, int *need_p)
|
||||||
{
|
{
|
||||||
int need = *need_p;
|
int need = *need_p;
|
||||||
|
@ -172,7 +167,7 @@ void get_food(region * r)
|
||||||
unit *v;
|
unit *v;
|
||||||
|
|
||||||
for (v = r->units; need && v; v = v->next) {
|
for (v = r->units; need && v; v = v->next) {
|
||||||
if (v->faction == u->faction && help_money(v)) {
|
if (v->faction == u->faction) {
|
||||||
int give = get_money(v) - lifestyle(v);
|
int give = get_money(v) - lifestyle(v);
|
||||||
give = MIN(need, give);
|
give = MIN(need, give);
|
||||||
if (give > 0) {
|
if (give > 0) {
|
||||||
|
@ -202,8 +197,7 @@ void get_food(region * r)
|
||||||
faction *owner = region_get_owner(r);
|
faction *owner = region_get_owner(r);
|
||||||
if (owner && owner != u->faction) {
|
if (owner && owner != u->faction) {
|
||||||
for (v = r->units; v; v = v->next) {
|
for (v = r->units; v; v = v->next) {
|
||||||
if (v->faction == owner && alliedunit(v, f, HELP_MONEY)
|
if (v->faction == owner && alliedunit(v, f, HELP_MONEY)) {
|
||||||
&& help_money(v)) {
|
|
||||||
help_feed(v, u, &need);
|
help_feed(v, u, &need);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -211,8 +205,7 @@ void get_food(region * r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (v = r->units; need && v; v = v->next) {
|
for (v = r->units; need && v; v = v->next) {
|
||||||
if (v->faction != f && alliedunit(v, f, HELP_MONEY)
|
if (v->faction != f && alliedunit(v, f, HELP_MONEY)) {
|
||||||
&& help_money(v)) {
|
|
||||||
help_feed(v, u, &need);
|
help_feed(v, u, &need);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue