forked from github/server
Shifting signed 32-bit value by 31 bits is undefined behaviour
This commit is contained in:
parent
c39708f40c
commit
fdd28835b5
|
@ -207,7 +207,7 @@ static void test_build_building_with_golem(CuTest *tc) {
|
||||||
const building_type *btype;
|
const building_type *btype;
|
||||||
|
|
||||||
u = setup_build(&bf);
|
u = setup_build(&bf);
|
||||||
bf.rc->flags |= RCF_STONEGOLEM;
|
bf.rc->ec_flags |= ECF_STONEGOLEM;
|
||||||
btype = bt_find("castle");
|
btype = bt_find("castle");
|
||||||
assert(btype);
|
assert(btype);
|
||||||
assert(btype->construction);
|
assert(btype->construction);
|
||||||
|
|
|
@ -105,10 +105,10 @@ static int res_changepeasants(unit * u, const resource_type * rtype, int delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int golem_factor(const unit *u, const resource_type *rtype) {
|
static int golem_factor(const unit *u, const resource_type *rtype) {
|
||||||
if (rtype == get_resourcetype(R_STONE) && (u_race(u)->flags & RCF_STONEGOLEM)) {
|
if (rtype == get_resourcetype(R_STONE) && (u_race(u)->ec_flags & ECF_STONEGOLEM)) {
|
||||||
return GOLEM_STONE;
|
return GOLEM_STONE;
|
||||||
}
|
}
|
||||||
if (rtype == get_resourcetype(R_IRON) && (u_race(u)->flags & RCF_IRONGOLEM)) {
|
if (rtype == get_resourcetype(R_IRON) && (u_race(u)->ec_flags & ECF_IRONGOLEM)) {
|
||||||
return GOLEM_IRON;
|
return GOLEM_IRON;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -665,7 +665,7 @@ static int
|
||||||
mod_dwarves_only(const unit * u, const region * r, skill_t sk, int value)
|
mod_dwarves_only(const unit * u, const region * r, skill_t sk, int value)
|
||||||
{
|
{
|
||||||
UNUSED_ARG(r);
|
UNUSED_ARG(r);
|
||||||
if (u_race(u) == get_race(RC_DWARF) || (u_race(u)->flags & RCF_IRONGOLEM)) {
|
if (u_race(u) == get_race(RC_DWARF) || (u_race(u)->ec_flags & ECF_IRONGOLEM)) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return -118;
|
return -118;
|
||||||
|
|
|
@ -88,9 +88,9 @@ int get_reservation(const unit * u, const item_type * itype)
|
||||||
{
|
{
|
||||||
reservation *res = u->reservations;
|
reservation *res = u->reservations;
|
||||||
|
|
||||||
if (itype->rtype == get_resourcetype(R_STONE) && (u_race(u)->flags & RCF_STONEGOLEM))
|
if (itype->rtype == get_resourcetype(R_STONE) && (u_race(u)->ec_flags & ECF_STONEGOLEM))
|
||||||
return (u->number * GOLEM_STONE);
|
return (u->number * GOLEM_STONE);
|
||||||
if (itype->rtype == get_resourcetype(R_IRON) && (u_race(u)->flags & RCF_IRONGOLEM))
|
if (itype->rtype == get_resourcetype(R_IRON) && (u_race(u)->ec_flags & ECF_IRONGOLEM))
|
||||||
return (u->number * GOLEM_IRON);
|
return (u->number * GOLEM_IRON);
|
||||||
while (res && res->type != itype)
|
while (res && res->type != itype)
|
||||||
res = res->next;
|
res = res->next;
|
||||||
|
|
|
@ -226,11 +226,9 @@ extern "C" {
|
||||||
#define RCF_CANSAIL (1<<24) /* Einheit darf Schiffe betreten */
|
#define RCF_CANSAIL (1<<24) /* Einheit darf Schiffe betreten */
|
||||||
#define RCF_INVISIBLE (1<<25) /* not visible in any report */
|
#define RCF_INVISIBLE (1<<25) /* not visible in any report */
|
||||||
#define RCF_SHIPSPEED (1<<26) /* race gets +1 on shipspeed */
|
#define RCF_SHIPSPEED (1<<26) /* race gets +1 on shipspeed */
|
||||||
#define RCF_STONEGOLEM (1<<27) /* race gets stonegolem properties */
|
#define RCF_MIGRANTS (1<<27) /* may have migrant units (human bonus) */
|
||||||
#define RCF_IRONGOLEM (1<<28) /* race gets irongolem properties */
|
#define RCF_FAMILIAR (1<<28) /* may be a familiar */
|
||||||
#define RCF_ATTACK_MOVED (1<<29) /* may attack if it has moved */
|
#define RCF_ATTACK_MOVED (1<<29) /* may attack if it has moved */
|
||||||
#define RCF_MIGRANTS (1<<30) /* may have migrant units (human bonus) */
|
|
||||||
#define RCF_FAMILIAR (1<<31) /* may be a familiar */
|
|
||||||
|
|
||||||
/* Economic flags */
|
/* Economic flags */
|
||||||
#define ECF_GIVEPERSON (1<<2) /* <20>bergibt Personen */
|
#define ECF_GIVEPERSON (1<<2) /* <20>bergibt Personen */
|
||||||
|
@ -238,6 +236,8 @@ extern "C" {
|
||||||
#define ECF_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 */
|
||||||
|
#define ECF_STONEGOLEM (1<<9) /* race gets stonegolem properties */
|
||||||
|
#define ECF_IRONGOLEM (1<<10) /* race gets irongolem properties */
|
||||||
|
|
||||||
/* Battle-Flags */
|
/* Battle-Flags */
|
||||||
#define BF_EQUIPMENT (1<<0) /* Kann Ausr<73>stung benutzen */
|
#define BF_EQUIPMENT (1<<0) /* Kann Ausr<73>stung benutzen */
|
||||||
|
|
|
@ -1434,10 +1434,6 @@ static int parse_races(xmlDocPtr doc)
|
||||||
rc->flags |= RCF_DRAGON;
|
rc->flags |= RCF_DRAGON;
|
||||||
if (xml_bvalue(node, "shipspeed", false))
|
if (xml_bvalue(node, "shipspeed", false))
|
||||||
rc->flags |= RCF_SHIPSPEED;
|
rc->flags |= RCF_SHIPSPEED;
|
||||||
if (xml_bvalue(node, "stonegolem", false))
|
|
||||||
rc->flags |= RCF_STONEGOLEM;
|
|
||||||
if (xml_bvalue(node, "irongolem", false))
|
|
||||||
rc->flags |= RCF_IRONGOLEM;
|
|
||||||
|
|
||||||
if (xml_bvalue(node, "giveperson", false))
|
if (xml_bvalue(node, "giveperson", false))
|
||||||
rc->ec_flags |= ECF_GIVEPERSON;
|
rc->ec_flags |= ECF_GIVEPERSON;
|
||||||
|
@ -1449,6 +1445,10 @@ static int parse_races(xmlDocPtr doc)
|
||||||
rc->ec_flags |= ECF_REC_ETHEREAL;
|
rc->ec_flags |= ECF_REC_ETHEREAL;
|
||||||
if (xml_bvalue(node, "recruitunlimited", false))
|
if (xml_bvalue(node, "recruitunlimited", false))
|
||||||
rc->ec_flags |= ECF_REC_UNLIMITED;
|
rc->ec_flags |= ECF_REC_UNLIMITED;
|
||||||
|
if (xml_bvalue(node, "stonegolem", false))
|
||||||
|
rc->ec_flags |= ECF_STONEGOLEM;
|
||||||
|
if (xml_bvalue(node, "irongolem", false))
|
||||||
|
rc->ec_flags |= ECF_IRONGOLEM;
|
||||||
|
|
||||||
if (xml_bvalue(node, "equipment", false))
|
if (xml_bvalue(node, "equipment", false))
|
||||||
rc->battle_flags |= BF_EQUIPMENT; /* TODO: invert this flag, so rc_get_or_create gets simpler */
|
rc->battle_flags |= BF_EQUIPMENT; /* TODO: invert this flag, so rc_get_or_create gets simpler */
|
||||||
|
|
|
@ -155,7 +155,7 @@ newfaction *read_newfactions(const char *filename)
|
||||||
email[0] = '\0';
|
email[0] = '\0';
|
||||||
password[0] = '\0';
|
password[0] = '\0';
|
||||||
|
|
||||||
if (sscanf(buf, "%54s %20s %8s %16s %d %d", email, race, lang,
|
if (sscanf(buf, "%54s %19s %8s %16s %d %d", email, race, lang,
|
||||||
password, &subscription, &alliance) < 3) {
|
password, &subscription, &alliance) < 3) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue