Feature #878 » 0039-Move-cargo-sanity-check-to-rssanity.patch
server/ruleset/rssanity.c | ||
---|---|---|
return FALSE;
|
||
}
|
||
unit_type_iterate(ptype) {
|
||
bool cargo = FALSE;
|
||
unit_class_iterate(pclass) {
|
||
if (BV_ISSET(ptype->cargo, uclass_index(pclass))) {
|
||
cargo = TRUE;
|
||
break;
|
||
}
|
||
} unit_class_iterate_end;
|
||
if (ptype->transport_capacity > 0) {
|
||
if (!cargo) {
|
||
ruleset_error(logger, LOG_ERROR,
|
||
_("%s has transport capacity %d, but no cargo types."),
|
||
utype_rule_name(ptype), ptype->transport_capacity);
|
||
return FALSE;
|
||
}
|
||
} else if (cargo) {
|
||
ruleset_error(logger, LOG_ERROR,
|
||
_("%s has cargo types, but no transport capacity."),
|
||
utype_rule_name(ptype));
|
||
return FALSE;
|
||
}
|
||
} unit_type_iterate_end;
|
||
return TRUE;
|
||
}
|
||
server/ruleset/ruleload.c | ||
---|---|---|
} output_type_iterate_end;
|
||
slist = secfile_lookup_str_vec(file, &nval, "%s.cargo", sec_name);
|
||
if (u->transport_capacity > 0) {
|
||
if (nval == 0) {
|
||
ruleset_error(NULL, LOG_ERROR,
|
||
"\"%s\" unit type \"%s\" "
|
||
"has transport_cap %d, but no cargo unit classes.",
|
||
filename, utype_rule_name(u), u->transport_capacity);
|
||
ok = FALSE;
|
||
break;
|
||
}
|
||
} else {
|
||
if (nval > 0) {
|
||
ruleset_error(NULL, LOG_ERROR,
|
||
"\"%s\" unit type \"%s\" "
|
||
"has cargo defined, but transport_cap is 0.",
|
||
filename, utype_rule_name(u));
|
||
ok = FALSE;
|
||
break;
|
||
}
|
||
}
|
||
BV_CLR_ALL(u->cargo);
|
||
for (j = 0; j < nval; j++) {
|