Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #876210 ยป 0015-Sanity-check-action-unit-order-extra-is-relevant.patch

Sveinung Kvilhaugsvik, 2020-06-04 12:35 PM

View differences:

server/unittools.c
for (i = 0; i < length; i++) {
struct action *paction;
struct extra_type *pextra;
if (orders[i].order > ORDER_LAST) {
log_error("invalid order %d at index %d", orders[i].order, i);
......
if (orders[i].sub_target == EXTRA_NONE
|| (orders[i].sub_target < 0
|| orders[i].sub_target >= game.control.num_extra_types)
|| extra_by_number(orders[i].sub_target)->ruledit_disabled) {
|| !(pextra = extra_by_number(orders[i].sub_target))
|| pextra->ruledit_disabled) {
/* Target extra is invalid. */
log_error("at index %d, cannot do %s without a target.", i,
action_id_rule_name(orders[i].action));
return FALSE;
}
if (!(action_removes_extra(paction, pextra)
|| action_creates_extra(paction, pextra))) {
/* Target extra is irrelevant for the action. */
log_error("at index %d, cannot do %s to %s.", i,
action_id_rule_name(orders[i].action),
extra_rule_name(pextra));
return FALSE;
}
break;
case ASTK_NONE:
/* No validation required. */
    (1-1/1)