forked from github/server
comparison to boolean values is bad form.
This commit is contained in:
parent
22ccb5cf95
commit
eea6bdb888
|
@ -913,7 +913,7 @@ static void cr_output_unit(FILE * F, const region * r, const faction * f,
|
||||||
pr = 0;
|
pr = 0;
|
||||||
if (f == u->faction || omniscient(f)) {
|
if (f == u->faction || omniscient(f)) {
|
||||||
show = u->items;
|
show = u->items;
|
||||||
} else if (itemcloak == false && mode >= see_unit && !(a_fshidden
|
} else if (!itemcloak && mode >= see_unit && !(a_fshidden
|
||||||
&& a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH) >= 3)) {
|
&& a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH) >= 3)) {
|
||||||
int n = report_items(u->items, result, MAX_INVENTORY, u, f);
|
int n = report_items(u->items, result, MAX_INVENTORY, u, f);
|
||||||
assert(n >= 0);
|
assert(n >= 0);
|
||||||
|
|
|
@ -1712,7 +1712,7 @@ static int name_cmd(unit * u, struct order *ord)
|
||||||
|
|
||||||
switch (p) {
|
switch (p) {
|
||||||
case P_ALLIANCE:
|
case P_ALLIANCE:
|
||||||
if (foreign == false && f_get_alliance(u->faction)) {
|
if (!foreign && f_get_alliance(u->faction)) {
|
||||||
alliance *al = u->faction->alliance;
|
alliance *al = u->faction->alliance;
|
||||||
faction *lead = alliance_get_leader(al);
|
faction *lead = alliance_get_leader(al);
|
||||||
if (lead == u->faction) {
|
if (lead == u->faction) {
|
||||||
|
@ -1729,7 +1729,7 @@ static int name_cmd(unit * u, struct order *ord)
|
||||||
return rename_building(u, ord, b, getstrtoken());
|
return rename_building(u, ord, b, getstrtoken());
|
||||||
|
|
||||||
case P_FACTION:
|
case P_FACTION:
|
||||||
if (foreign == true) {
|
if (foreign) {
|
||||||
faction *f;
|
faction *f;
|
||||||
|
|
||||||
f = getfaction();
|
f = getfaction();
|
||||||
|
@ -1767,7 +1767,7 @@ static int name_cmd(unit * u, struct order *ord)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_SHIP:
|
case P_SHIP:
|
||||||
if (foreign == true) {
|
if (foreign) {
|
||||||
ship *sh = getship(r);
|
ship *sh = getship(r);
|
||||||
unit *uo;
|
unit *uo;
|
||||||
|
|
||||||
|
@ -1822,7 +1822,7 @@ static int name_cmd(unit * u, struct order *ord)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_UNIT:
|
case P_UNIT:
|
||||||
if (foreign == true) {
|
if (foreign) {
|
||||||
unit *u2 = getunit(r, u->faction);
|
unit *u2 = getunit(r, u->faction);
|
||||||
|
|
||||||
if (!u2 || !cansee(u->faction, r, u2, 0)) {
|
if (!u2 || !cansee(u->faction, r, u2, 0)) {
|
||||||
|
@ -1981,7 +1981,7 @@ static int mail_cmd(unit * u, struct order *ord)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (see == false) {
|
if (!see) {
|
||||||
cmistake(u, ord, 66, MSG_MESSAGE);
|
cmistake(u, ord, 66, MSG_MESSAGE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2007,7 +2007,7 @@ static int mail_cmd(unit * u, struct order *ord)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (see == false) {
|
if (!see) {
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
|
ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
|
||||||
"feedback_unit_not_found", ""));
|
"feedback_unit_not_found", ""));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2171,7 +2171,7 @@ static int password_cmd(unit * u, struct order *ord)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(u->faction->passw);
|
free(u->faction->passw);
|
||||||
if (pwok == false) {
|
if (!pwok) {
|
||||||
cmistake(u, ord, 283, MSG_EVENT);
|
cmistake(u, ord, 283, MSG_EVENT);
|
||||||
u->faction->passw = strdup(itoa36(rng_int()));
|
u->faction->passw = strdup(itoa36(rng_int()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -3510,7 +3510,7 @@ static void setdefaults(unit * u)
|
||||||
/* Wenn die Einheit handelt, muß der Default-Befehl gelöscht
|
/* Wenn die Einheit handelt, muß der Default-Befehl gelöscht
|
||||||
* werden. */
|
* werden. */
|
||||||
|
|
||||||
if (trade == true) {
|
if (trade) {
|
||||||
/* fset(u, UFL_LONGACTION|UFL_NOTMOVING); */
|
/* fset(u, UFL_LONGACTION|UFL_NOTMOVING); */
|
||||||
set_order(&u->thisorder, NULL);
|
set_order(&u->thisorder, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ use_phoenixcompass(struct unit *u, const struct item_type *itype,
|
||||||
* at the same distance was found and the device is confused */
|
* at the same distance was found and the device is confused */
|
||||||
|
|
||||||
if (closest_phoenix == NULL
|
if (closest_phoenix == NULL
|
||||||
|| closest_phoenix->region == u->region || confusion == true) {
|
|| closest_phoenix->region == u->region || confusion) {
|
||||||
add_message(&u->faction->msgs, msg_message("phoenixcompass_confusion",
|
add_message(&u->faction->msgs, msg_message("phoenixcompass_confusion",
|
||||||
"unit region command", u, u->region, ord));
|
"unit region command", u, u->region, ord));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1742,7 +1742,7 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ord = create_order(K_CAST, lang, "'%s'", spell_name(sp, lang));
|
ord = create_order(K_CAST, lang, "'%s'", spell_name(sp, lang));
|
||||||
if (cancast(mage, sp, 1, 1, ord) == false) {
|
if (!cancast(mage, sp, 1, 1, ord)) {
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1761,7 +1761,7 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
||||||
if (power <= 0) { /* Effekt von Antimagie */
|
if (power <= 0) { /* Effekt von Antimagie */
|
||||||
report_failed_spell(b, mage, sp);
|
report_failed_spell(b, mage, sp);
|
||||||
pay_spell(mage, sp, level, 1);
|
pay_spell(mage, sp, level, 1);
|
||||||
} else if (fumble(r, mage, sp, sp->level)) {
|
} else if (fumble(r, mage, sp, level)) {
|
||||||
report_failed_spell(b, mage, sp);
|
report_failed_spell(b, mage, sp);
|
||||||
pay_spell(mage, sp, level, 1);
|
pay_spell(mage, sp, level, 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1837,7 +1837,7 @@ static void do_combatspell(troop at)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ord = create_order(K_CAST, lang, "'%s'", spell_name(sp, lang));
|
ord = create_order(K_CAST, lang, "'%s'", spell_name(sp, lang));
|
||||||
if (cancast(caster, sp, 1, 1, ord) == false) {
|
if (!cancast(caster, sp, 1, 1, ord)) {
|
||||||
fi->magic = 0; /* Kann nicht mehr Zaubern, kämpft nichtmagisch weiter */
|
fi->magic = 0; /* Kann nicht mehr Zaubern, kämpft nichtmagisch weiter */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1846,7 +1846,7 @@ static void do_combatspell(troop at)
|
||||||
if ((sl = get_combatspelllevel(caster, 1)) > 0)
|
if ((sl = get_combatspelllevel(caster, 1)) > 0)
|
||||||
level = MIN(level, sl);
|
level = MIN(level, sl);
|
||||||
|
|
||||||
if (fumble(r, caster, sp, sp->level) == true) {
|
if (fumble(r, caster, sp, level)) {
|
||||||
report_failed_spell(b, caster, sp);
|
report_failed_spell(b, caster, sp);
|
||||||
pay_spell(caster, sp, level, 1);
|
pay_spell(caster, sp, level, 1);
|
||||||
return;
|
return;
|
||||||
|
@ -3100,7 +3100,7 @@ static void print_header(battle * b)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
first = true;
|
first = true;
|
||||||
}
|
}
|
||||||
if (seematrix(f, s) == true)
|
if (seematrix(f, s))
|
||||||
lastf = sidename(s);
|
lastf = sidename(s);
|
||||||
else
|
else
|
||||||
lastf = LOC(f->locale, "unknown_faction_dative");
|
lastf = LOC(f->locale, "unknown_faction_dative");
|
||||||
|
|
|
@ -615,7 +615,7 @@ static void do_transfer_curse(curse * c, unit * u, unit * u2, int n)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dogive == true) {
|
if (dogive) {
|
||||||
curse *cnew = make_curse(c->magician, &u2->attribs, c->type, c->vigour,
|
curse *cnew = make_curse(c->magician, &u2->attribs, c->type, c->vigour,
|
||||||
c->duration, c->effect, men);
|
c->duration, c->effect, men);
|
||||||
cnew->flags = c->flags;
|
cnew->flags = c->flags;
|
||||||
|
|
|
@ -1071,8 +1071,8 @@ static int add_resourcename_cb(const void * match, const void * key, size_t keyl
|
||||||
if (name && transliterate(buffer, sizeof(buffer), name)) {
|
if (name && transliterate(buffer, sizeof(buffer), name)) {
|
||||||
size_t len = strlen(buffer);
|
size_t len = strlen(buffer);
|
||||||
assert(len+sizeof(rtype)<sizeof(buffer));
|
assert(len+sizeof(rtype)<sizeof(buffer));
|
||||||
cb_new_kv(buffer, &rtype, sizeof(rtype), buffer);
|
len = cb_new_kv(buffer, len, &rtype, sizeof(rtype), buffer);
|
||||||
cb_insert(cb, buffer, len+1+sizeof(rtype));
|
cb_insert(cb, buffer, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -598,7 +598,7 @@ void set_combatspell(unit * u, spell * sp, struct order *ord, int level)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* knowsspell prüft auf ist_magier, ist_spruch, kennt_spruch */
|
/* knowsspell prüft auf ist_magier, ist_spruch, kennt_spruch */
|
||||||
if (knowsspell(u->region, u, sp) == false) {
|
if (!knowsspell(u->region, u, sp)) {
|
||||||
/* Fehler 'Spell not found' */
|
/* Fehler 'Spell not found' */
|
||||||
cmistake(u, ord, 173, MSG_MAGIC);
|
cmistake(u, ord, 173, MSG_MAGIC);
|
||||||
return;
|
return;
|
||||||
|
@ -976,7 +976,7 @@ cancast(unit * u, const spell * sp, int level, int range, struct order * ord)
|
||||||
int itemanz;
|
int itemanz;
|
||||||
resource *reslist = NULL;
|
resource *reslist = NULL;
|
||||||
|
|
||||||
if (knowsspell(u->region, u, sp) == false) {
|
if (!knowsspell(u->region, u, sp)) {
|
||||||
/* Diesen Zauber kennt die Einheit nicht */
|
/* Diesen Zauber kennt die Einheit nicht */
|
||||||
cmistake(u, ord, 173, MSG_MAGIC);
|
cmistake(u, ord, 173, MSG_MAGIC);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1325,10 +1325,10 @@ boolean fumble(region * r, unit * u, const spell * sp, int cast_grade)
|
||||||
if (sp->magietyp == M_DRAIG) {
|
if (sp->magietyp == M_DRAIG) {
|
||||||
patzer += CHAOSPATZERCHANCE;
|
patzer += CHAOSPATZERCHANCE;
|
||||||
}
|
}
|
||||||
if (is_cursed(u->attribs, C_MBOOST, 0) == true) {
|
if (is_cursed(u->attribs, C_MBOOST, 0)) {
|
||||||
patzer += CHAOSPATZERCHANCE;
|
patzer += CHAOSPATZERCHANCE;
|
||||||
}
|
}
|
||||||
if (is_cursed(u->attribs, C_FUMBLE, 0) == true) {
|
if (is_cursed(u->attribs, C_FUMBLE, 0)) {
|
||||||
patzer += CHAOSPATZERCHANCE;
|
patzer += CHAOSPATZERCHANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2830,7 +2830,7 @@ void magic(void)
|
||||||
|
|
||||||
/* Prüfen, ob die realen Kosten für die gewünschten Stufe bezahlt
|
/* Prüfen, ob die realen Kosten für die gewünschten Stufe bezahlt
|
||||||
* werden können */
|
* werden können */
|
||||||
if (cancast(u, sp, co->level, co->distance, ord) == false) {
|
if (!cancast(u, sp, co->level, co->distance, ord)) {
|
||||||
/* die Fehlermeldung wird in cancast generiert */
|
/* die Fehlermeldung wird in cancast generiert */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1790,7 +1790,7 @@ sail(unit * u, order * ord, boolean move_on_land, region_list ** routep)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (check_takeoff(sh, current_point, next_point) == false) {
|
if (!check_takeoff(sh, current_point, next_point)) {
|
||||||
/* Schiff kann nicht ablegen */
|
/* Schiff kann nicht ablegen */
|
||||||
cmistake(u, ord, 182, MSG_MOVE);
|
cmistake(u, ord, 182, MSG_MOVE);
|
||||||
break;
|
break;
|
||||||
|
@ -2265,8 +2265,7 @@ static void piracy_cmd(unit * u, struct order *ord)
|
||||||
region *rc = rconnect(r, dir);
|
region *rc = rconnect(r, dir);
|
||||||
aff[dir].value = 0;
|
aff[dir].value = 0;
|
||||||
aff[dir].target = 0;
|
aff[dir].target = 0;
|
||||||
if (rc && fval(rc->terrain, SWIM_INTO)
|
if (rc && fval(rc->terrain, SWIM_INTO) && check_takeoff(sh, r, rc)) {
|
||||||
&& check_takeoff(sh, r, rc) == true) {
|
|
||||||
|
|
||||||
for (sh2 = rc->ships; sh2; sh2 = sh2->next) {
|
for (sh2 = rc->ships; sh2; sh2 = sh2->next) {
|
||||||
unit *cap = ship_owner(sh2);
|
unit *cap = ship_owner(sh2);
|
||||||
|
|
|
@ -26,9 +26,9 @@ static void test_building_type_exists(CuTest * tc)
|
||||||
b = new_building(btype, r, default_locale);
|
b = new_building(btype, r, default_locale);
|
||||||
|
|
||||||
CuAssertPtrNotNull(tc, b);
|
CuAssertPtrNotNull(tc, b);
|
||||||
CuAssertTrue(tc, buildingtype_exists(r, NULL, true) == false);
|
CuAssertTrue(tc, !buildingtype_exists(r, NULL, true));
|
||||||
CuAssertTrue(tc, buildingtype_exists(r, btype, true) == true);
|
CuAssertTrue(tc, buildingtype_exists(r, btype, true));
|
||||||
CuAssertTrue(tc, buildingtype_exists(r, btype2, true) == false);
|
CuAssertTrue(tc, !buildingtype_exists(r, btype2, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
CuSuite *get_move_suite(void)
|
CuSuite *get_move_suite(void)
|
||||||
|
|
|
@ -52,7 +52,8 @@ spell * create_spell(const char * name, unsigned int id)
|
||||||
size_t len = strlen(name);
|
size_t len = strlen(name);
|
||||||
|
|
||||||
assert(len+sizeof(sp)<sizeof(buffer));
|
assert(len+sizeof(sp)<sizeof(buffer));
|
||||||
if (find_spell(name)) {
|
|
||||||
|
if (cb_find_str(&cb_spells, name)) {
|
||||||
log_error("create_spell: duplicate name '%s'\n", name);
|
log_error("create_spell: duplicate name '%s'\n", name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1301,7 +1301,7 @@ get_modifier(const unit * u, skill_t sk, int level, const region * r,
|
||||||
skill += rc_skillmod(u->race, r, sk);
|
skill += rc_skillmod(u->race, r, sk);
|
||||||
skill += att_modification(u, sk);
|
skill += att_modification(u, sk);
|
||||||
|
|
||||||
if (noitem == false) {
|
if (!noitem) {
|
||||||
skill = item_modification(u, sk, skill);
|
skill = item_modification(u, sk, skill);
|
||||||
}
|
}
|
||||||
skill = skillmod(u->attribs, u, r, sk, skill, SMF_ALWAYS);
|
skill = skillmod(u->attribs, u, r, sk, skill, SMF_ALWAYS);
|
||||||
|
|
|
@ -1490,6 +1490,9 @@ static int parse_spells(xmlDocPtr doc)
|
||||||
assert(propValue != NULL);
|
assert(propValue != NULL);
|
||||||
sp = create_spell((const char *)propValue, index);
|
sp = create_spell((const char *)propValue, index);
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
|
if (!sp) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "parameters");
|
propValue = xmlGetProp(node, BAD_CAST "parameters");
|
||||||
if (propValue) {
|
if (propValue) {
|
||||||
|
|
Loading…
Reference in New Issue