From 406a38c19b04a2b88bd351db4716bccdbd1cab7e Mon Sep 17 00:00:00 2001 From: dark-ether Date: Wed, 6 Jul 2022 18:59:04 -0300 Subject: [PATCH 2/4] modified rulesave to save the new dummy actions.ruleset --- tools/ruleutil/rulesave.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 713ba41059..7551e11ae2 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1048,6 +1048,17 @@ static bool save_bv_actions(struct section_file *sfile, return TRUE; } +/**********************************************************************//** + Save actions.ruleset +**************************************************************************/ +static bool save_actions_ruleset(const char *filename, const char *name){ + struct section_file *sfile = create_ruleset_file(name, "actions"); + /* TODO: move action logic from save_game_ruleset to here */ + if (sfile == NULL) { + return FALSE; + } + return save_ruleset_file(sfile, filename); +} /**********************************************************************//** Save game.ruleset @@ -1286,7 +1297,7 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_int(sfile, game.server.incite_total_factor, RS_DEFAULT_INCITE_TOTAL_FCT, "incite_cost.total_factor", NULL); - + /*start of action related code */ { /* Action auto performers aren't ready to be exposed in the ruleset * yet. The behavior when two action auto performers for the same @@ -1404,7 +1415,7 @@ static bool save_game_ruleset(const char *filename, const char *name) save_reqs_vector(sfile, &(pae->actor_reqs), path, "actor_reqs"); save_reqs_vector(sfile, &(pae->target_reqs), path, "target_reqs"); } action_enablers_iterate_end; - + /* action related code seems to end here */ if (game.info.tired_attack != RS_DEFAULT_TIRED_ATTACK) { comment_combat_rules_tired_attack(sfile); } @@ -3312,6 +3323,11 @@ bool save_ruleset(const char *path, const char *name, struct rule_data *data) fc_snprintf(filename, sizeof(filename), "%s/units.ruleset", path); success = save_units_ruleset(filename, name); } + + if (success) { + fc_snprintf(filename,sizeof(filename), "%s/actions.ruleset",path); + success = save_actions_ruleset(filename, name); + } if (success) { fc_snprintf(filename, sizeof(filename), "%s/script.lua", path); -- 2.37.0