Project

General

Profile

Feature #152 ยป 0041-Add-either_reqs-support-for-clauses.patch

Marko Lindqvist, 01/08/2024 11:36 PM

View differences:

client/packhand.c
requirement_vector_append(&info->receiver_reqs, p->receiver_reqs[i]);
}
fc_assert(info->receiver_reqs.size == p->receiver_reqs_count);
for (i = 0; i < p->either_reqs_count; i++) {
requirement_vector_append(&info->either_reqs, p->either_reqs[i]);
}
fc_assert(info->either_reqs.size == p->either_reqs_count);
}
/************************************************************************//**
common/diptreaty.c
return FALSE;
}
}
if (client_player == NULL) {
if (!are_reqs_active(&(const struct req_context) { .player = pfrom },
pfrom, &clause_infos[type].either_reqs,
RPT_POSSIBLE)
&& !are_reqs_active(&(const struct req_context) { .player = pto },
pfrom, &clause_infos[type].either_reqs,
RPT_POSSIBLE)) {
return FALSE;
}
}
clause_list_iterate(ptreaty->clauses, old_clause) {
if (old_clause->type == type
common/diptreaty.h
bool enabled;
struct requirement_vector giver_reqs;
struct requirement_vector receiver_reqs;
struct requirement_vector either_reqs;
};
/* For when we need to iterate over treaties */
common/networking/packets.def
REQUIREMENT giver_reqs[MAX_NUM_REQS:giver_reqs_count];
UINT8 receiver_reqs_count;
REQUIREMENT receiver_reqs[MAX_NUM_REQS:receiver_reqs_count];
UINT8 either_reqs_count;
REQUIREMENT either_reqs[MAX_NUM_REQS:either_reqs_count];
end
/**************************************************************************
data/alien/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/civ1/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/civ2/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/civ2civ3/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/classic/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/goldkeep/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/granularity/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/multiplayer/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/ruledit/comments-3.3.txt
; type = Type of the clause, one of \"Advance\", \"Gold\", \"Map\", \"Seamap\",\n\
; \"City\", \"Ceasefire\", \"Peace\", \"Alliance\", \"Vision\", \"Embassy\",\n\
; \"SharedTiles\"\n\
; giver_reqs = requirements that the giving side of the clause needs to fulfill\n\
; giver_reqs = requirements that the giving side of the clause needs to meet\n\
; (see effects.ruleset and README.effects for help on requirements)\n\
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill\n\
; receiver_reqs = requirements that the receiving side of the clause needs to meet\n\
; either_reqs = requirements that either side of the clause transaction would need to meet\n\
;\n\
; */ <-- avoid gettext warnings\n\
"
data/sandbox/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/stub/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
data/webperimental/game.ruleset
; type = Type of the clause, one of "Advance", "Gold", "Map", "Seamap",
; "City", "Ceasefire", "Peace", "Alliance", "Vision", "Embassy",
; "SharedTiles"
; giver_reqs = requirements that the giving side of the clause needs to fulfill
; giver_reqs = requirements that the giving side of the clause needs to meet
; (see effects.ruleset and README.effects for help on requirements)
; receiver_reqs = requirements that the receiving side of the clause needs to fulfill
; receiver_reqs = requirements that the receiving side of the clause needs to meet
; either_reqs = requirements that either side of the clause transaction would need to meet
;
; */ <-- avoid gettext warnings
server/ruleset/ruleload.c
}
requirement_vector_copy(&info->receiver_reqs, reqs);
reqs = lookup_req_list(file, compat, sec_name, "either_reqs", clause_name);
if (reqs == NULL) {
ok = FALSE;
break;
}
requirement_vector_copy(&info->either_reqs, reqs);
info->enabled = TRUE;
}
}
......
} requirement_vector_iterate_end;
packet.receiver_reqs_count = j;
j = 0;
requirement_vector_iterate(&info->either_reqs, preq) {
packet.either_reqs[j++] = *preq;
} requirement_vector_iterate_end;
packet.either_reqs_count = j;
lsend_packet_ruleset_clause(dest, &packet);
}
}
tools/ruleutil/rulesave.c
"%s.type", path);
save_reqs_vector(sfile, &(info->giver_reqs), path, "giver_reqs");
save_reqs_vector(sfile, &(info->receiver_reqs), path, "receiver_reqs");
save_reqs_vector(sfile, &(info->either_reqs), path, "either_reqs");
}
}
    (1-1/1)