[Freeciv-commits] r25680 - in /trunk/data/alien: cities.ruleset effects.ruleset
Author: sveinung Date: Tue Jul 22 04:39:39 2014 New Revision: 25680 URL: http://svn.gna.org/viewcvs/freeciv?rev=25680&view=rev Log: Alien ruleset: Change specialist name to avoid savegame corruption The name of the "Government Merchants" specialist contains a space. The specialist rule name is used as an entry name in savegames. Freeciv savegames are section files. Section file entry names can't contain spaces. Add a separate rule name without a space to make saving work again. See bug #22377 Modified: trunk/data/alien/cities.ruleset trunk/data/alien/effects.ruleset Modified: trunk/data/alien/cities.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/cities.ruleset?rev=25680&r1=25679&r2=25680&view=diff == --- trunk/data/alien/cities.ruleset (original) +++ trunk/data/alien/cities.ruleset Tue Jul 22 04:39:39 2014 @@ -62,6 +62,7 @@ [specialist_government_merchant] name = _("Government Merchants") +rule_name = "Government_Merchants" short_name = _("?Merchant:M") graphic_alt = "specialist.taxman_0" reqs = Modified: trunk/data/alien/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/effects.ruleset?rev=25680&r1=25679&r2=25680&view=diff == --- trunk/data/alien/effects.ruleset(original) +++ trunk/data/alien/effects.rulesetTue Jul 22 04:39:39 2014 @@ -125,7 +125,7 @@ value = 2 reqs= { "type", "name", "range" - "Specialist", "Government Merchants", "Local" + "Specialist", "Government_Merchants", "Local" "OutputType", "gold", "Local" } @@ -135,7 +135,7 @@ reqs= { "type", "name", "range" "Tech", "Specialist Training", "Player" - "Specialist", "Government Merchants", "Local" + "Specialist", "Government_Merchants", "Local" "OutputType", "gold", "Local" } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25679 - in /branches/S2_4: bootstrap/fc_svnrev_gen.h.in bootstrap/generate_svnrev.sh common/version.c
Author: cazfi Date: Tue Jul 22 01:47:13 2014 New Revision: 25679 URL: http://svn.gna.org/viewcvs/freeciv?rev=25679&view=rev Log: Made word "modified", potentially appearing in version number string when freeciv is built with --enable-svnrev, translatable. See bug #22303 Modified: branches/S2_4/bootstrap/fc_svnrev_gen.h.in branches/S2_4/bootstrap/generate_svnrev.sh branches/S2_4/common/version.c Modified: branches/S2_4/bootstrap/fc_svnrev_gen.h.in URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/bootstrap/fc_svnrev_gen.h.in?rev=25679&r1=25678&r2=25679&view=diff == --- branches/S2_4/bootstrap/fc_svnrev_gen.h.in (original) +++ branches/S2_4/bootstrap/fc_svnrev_gen.h.in Tue Jul 22 01:47:13 2014 @@ -19,13 +19,15 @@ #define FC__FC_SVNREV_H /* One of the macros FC_SVNREV_OFF, FC_SVNREV_ON or FC_SVNREV_MOD defined. - * If FC_SVNREV_ON is defined, FC_SVNREV contains valid svn revision number + * If FC_SVNREV_ON is defined, FC_SVNREV2 contains valid svn revision number * string (currently starting with 'r') * If FC_SVNREV_MOD is defined, this seems to be modified svn checkout. - * In that case FC_SVNREV contains revision number and word "modified". - * If FC_SVNREV_OFF is defined, you should not use FC_SVNREV even though - * it does contain fallback string (currently "dist") */ + * In that case FC_SVNREV1 contains word "modified " and FC_SVNREV2 + * revision number. + * If FC_SVNREV_OFF is defined, you should not use FC_SVNREV1 and + * FC_SVNREV2 even though they contain fallback string (currently "dist") */ #define FC_SVNREV_ -#define FC_SVNREV "" +#define FC_SVNREV1 "" +#define FC_SVNREV2 "" #endif /* FC__FC_SVNREV_H */ Modified: branches/S2_4/bootstrap/generate_svnrev.sh URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/bootstrap/generate_svnrev.sh?rev=25679&r1=25678&r2=25679&view=diff == --- branches/S2_4/bootstrap/generate_svnrev.sh (original) +++ branches/S2_4/bootstrap/generate_svnrev.sh Tue Jul 22 01:47:13 2014 @@ -15,7 +15,8 @@ OUTPUTDIR="$(cd "$2/common" ; pwd)" REVSTATE="OFF" -REV="dist" +REV1="" +REV2="dist" (cd "$INPUTDIR" # Check that all commands required by this script are available @@ -27,15 +28,16 @@ # This is svn checkout. Check for local modifications if test $(cd "$SRCROOT" ; svn diff | wc -l) -eq 0 ; then REVSTATE=ON - REV="$REVTMP" + REV2="$REVTMP" else REVSTATE=MOD - REV="modified $REVTMP" + REV1="modified " + REV2="$REVTMP" fi fi fi - sed -e "s,,$REV," -e "s,,$REVSTATE," fc_svnrev_gen.h.in > "$OUTPUTDIR/fc_svnrev_gen.h.tmp" + sed -e "s,,$REV1," -e "s,,$REV2," -e "s,,$REVSTATE," fc_svnrev_gen.h.in > "$OUTPUTDIR/fc_svnrev_gen.h.tmp" if ! test -f "$OUTPUTDIR/fc_svnrev_gen.h" || ! cmp "$OUTPUTDIR/fc_svnrev_gen.h" "$OUTPUTDIR/fc_svnrev_gen.h.tmp" then Modified: branches/S2_4/common/version.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/common/version.c?rev=25679&r1=25678&r2=25679&view=diff == --- branches/S2_4/common/version.c (original) +++ branches/S2_4/common/version.c Tue Jul 22 01:47:13 2014 @@ -70,7 +70,11 @@ const char *fc_svn_revision(void) { #if defined(SVNREV) && !defined(FC_SVNREV_OFF) - return FC_SVNREV; /* Either revision, or modified revision */ + static char buf[100]; + + fc_snprintf(buf, sizeof(buf), "%s%s", _(FC_SVNREV1), FC_SVNREV2); + + return buf; /* Either revision, or modified revision */ #else /* FC_SVNREV_OFF */ return NULL; #endif /* FC_SVNREV_OFF */ @@ -82,8 +86,8 @@ const char *fc_comparable_version(void) { #ifdef FC_SVNREV_ON - /* Sane revision number in FC_SVNREV */ - return VERSION_STRING "-" FC_SVNREV; + /* Sane revision number in FC_SVNREV2 */ + return VERSION_STRING "-" FC_SVNREV2; #else /* FC_SVNREV_ON */ return VERSION_STRING; #endif ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25678 - in /branches/S2_5: bootstrap/ common/ translations/
Author: cazfi Date: Tue Jul 22 01:47:01 2014 New Revision: 25678 URL: http://svn.gna.org/viewcvs/freeciv?rev=25678&view=rev Log: Made word "modified", potentially appearing in version number string when freeciv is built with --enable-svnrev or --enable-gitrev, translatable. See bug #22303 Modified: branches/S2_5/bootstrap/fc_gitrev_gen.h.tmpl branches/S2_5/bootstrap/fc_svnrev_gen.h.tmpl branches/S2_5/bootstrap/generate_gitrev.sh branches/S2_5/bootstrap/generate_svnrev.sh branches/S2_5/common/version.c branches/S2_5/translations/Strings.txt Modified: branches/S2_5/bootstrap/fc_gitrev_gen.h.tmpl URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/bootstrap/fc_gitrev_gen.h.tmpl?rev=25678&r1=25677&r2=25678&view=diff == --- branches/S2_5/bootstrap/fc_gitrev_gen.h.tmpl(original) +++ branches/S2_5/bootstrap/fc_gitrev_gen.h.tmplTue Jul 22 01:47:01 2014 @@ -19,13 +19,15 @@ #define FC__FC_GITREV_H /* One of the macros FC_GITREV_OFF, FC_GITREV_ON or FC_GITREV_MOD defined. - * If FC_GITREV_ON is defined, FC_GITREV contains valid git commit id + * If FC_GITREV_ON is defined, FC_GITREV2 contains valid git commit id * string. * If FC_GITREV_MOD is defined, this seems to be modified git commit. - * In that case FC_GITREV contains commit id and word "modified". - * If FC_GITREV_OFF is defined, you should not use FC_GITREV even though - * it does contain fallback string (currently "dist") */ + * In that case FC_GITREV1 contains word "modified " and FC_GITREV2 + * revision number. + * If FC_GITREV_OFF is defined, you should not use FC_GITREV1 and + * FC_GITREV2 even though they contain fallback string (currently "dist") */ #define FC_GITREV_ -#define FC_GITREV "" +#define FC_GITREV1 "" +#define FC_GITREV2 "" #endif /* FC__FC_GITREV_H */ Modified: branches/S2_5/bootstrap/fc_svnrev_gen.h.tmpl URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/bootstrap/fc_svnrev_gen.h.tmpl?rev=25678&r1=25677&r2=25678&view=diff == --- branches/S2_5/bootstrap/fc_svnrev_gen.h.tmpl(original) +++ branches/S2_5/bootstrap/fc_svnrev_gen.h.tmplTue Jul 22 01:47:01 2014 @@ -19,13 +19,15 @@ #define FC__FC_SVNREV_H /* One of the macros FC_SVNREV_OFF, FC_SVNREV_ON or FC_SVNREV_MOD defined. - * If FC_SVNREV_ON is defined, FC_SVNREV contains valid svn revision number + * If FC_SVNREV_ON is defined, FC_SVNREV2 contains valid svn revision number * string (currently starting with 'r') * If FC_SVNREV_MOD is defined, this seems to be modified svn checkout. - * In that case FC_SVNREV contains revision number and word "modified". - * If FC_SVNREV_OFF is defined, you should not use FC_SVNREV even though - * it does contain fallback string (currently "dist") */ + * In that case FC_SVNREV1 contains word "modified " and FC_SVNREV2 + * revision number. + * If FC_SVNREV_OFF is defined, you should not use FC_SVNREV1 and + * FC_SVNREV2 even though they contain fallback string (currently "dist") */ #define FC_SVNREV_ -#define FC_SVNREV "" +#define FC_SVNREV1 "" +#define FC_SVNREV2 "" #endif /* FC__FC_SVNREV_H */ Modified: branches/S2_5/bootstrap/generate_gitrev.sh URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/bootstrap/generate_gitrev.sh?rev=25678&r1=25677&r2=25678&view=diff == --- branches/S2_5/bootstrap/generate_gitrev.sh (original) +++ branches/S2_5/bootstrap/generate_gitrev.sh Tue Jul 22 01:47:01 2014 @@ -15,7 +15,8 @@ OUTPUTDIR="$(cd "$2/common" ; pwd)" REVSTATE="OFF" -REV="dist" +REV1="" +REV2="dist" (cd "$INPUTDIR" # Check that all commands required by this script are available @@ -27,15 +28,16 @@ # This is git repository. Check for local modifications if test $(cd "$SRCROOT" ; git diff | wc -l) -eq 0 ; then REVSTATE=ON - REV="$REVTMP" + REV2="$REVTMP" else REVSTATE=MOD - REV="modified $REVTMP" + REV1="modified " + REV2="$REVTMP" fi fi fi - sed -e "s,,$REV," -e "s,,$REVSTATE," fc_gitrev_gen.h.tmpl > "$OUTPUTDIR/fc_gitrev_gen.h.tmp" + sed -e "s,,$REV1," -e "s,,$REV1," -e "s,,$REVSTATE," fc_gitrev_gen.h.tmpl > "$OUTPUTDIR/fc_gitrev_gen.h.tmp" if ! test -f "$OUTPUTDIR/fc_fitrev_gen.h" || ! cmp "$OUTPUTDIR/fc_gitrev_gen.h" "$OUTPUTDIR/fc_gitrev_gen.h.tmp" then Modified: branches/S2_5/bootstrap/generate_svnrev.sh URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/bootstrap/generate_svnrev.sh?rev=25678&r1=25677&r2=25678&view=diff == --- branches/S2_5/bootstrap/generate_svnrev.sh (original) +++ branches/S2_5/bootstrap/generate_svnrev.sh Tue Jul 22 01:47:01 2014 @@ -15,7 +15,8 @@ OUTPUTDIR="$(cd "$2/common" ; pwd)" REVSTATE="OFF" -REV="dist" +REV1="" +REV2="dist" (
[Freeciv-commits] r25675 - in /trunk: data/alien/techs.ruleset data/alien/units.ruleset doc/README.ruleset_alien
Author: cazfi Date: Mon Jul 21 23:37:43 2014 New Revision: 25675 URL: http://svn.gna.org/viewcvs/freeciv?rev=25675&view=rev Log: Alien ruleset: Added tech "Controlled Biomass" and Native unit "Biomass" that can transport one Earthly or Amphibious unit over Radiating terrains. See patch #4960 Modified: trunk/data/alien/techs.ruleset trunk/data/alien/units.ruleset trunk/doc/README.ruleset_alien Modified: trunk/data/alien/techs.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/techs.ruleset?rev=25675&r1=25674&r2=25675&view=diff == --- trunk/data/alien/techs.ruleset (original) +++ trunk/data/alien/techs.ruleset Mon Jul 21 23:37:43 2014 @@ -179,6 +179,16 @@ graphic_alt = "-" helptext= _("Stronger materials mean stronger armors.") +[advance_controlled_biomass] +name= _("Controlled Biomass"); +req1= "Spitter Control" +req2= "None" +flags = "" +graphic = "a.controlled_biomass" +graphic_alt = "-" +helptext= _("Bugs, Slimes, Molds. We can drive masses of them together and then\ + control movement of that biomass to act like a one being.") + [advance_crust_defense] name= _("Crust Defense"); req1= "Modified Spitter" @@ -502,7 +512,7 @@ [advance_protein_modifications] name= _("Protein Modifications"); req1= "Organic Structures" -req2= "Spitter Control" +req2= "Controlled Biomass" graphic = "a.protein_mod" graphic_alt = "-" ; /* xgettext:no-c-format */ Modified: trunk/data/alien/units.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/units.ruleset?rev=25675&r1=25674&r2=25675&view=diff == --- trunk/data/alien/units.ruleset (original) +++ trunk/data/alien/units.ruleset Mon Jul 21 23:37:43 2014 @@ -981,6 +981,37 @@ This improved spitter can both make bombard attacks, and transport missiles \ next to targets.") +[unit_biomass] +name = _("Biomass") +class = "Native" +tech_req = "Controlled Biomass" +obsolete_by = "None" +graphic = "u.biomass" +graphic_alt = "u.transport" +sound_move= "m_transport" +sound_move_alt = "m_generic" +sound_fight = "f_transport" +sound_fight_alt = "f_generic" +build_cost= 20 +pop_cost = 0 +attack= 0 +defense = 2 +hitpoints = 20 +firepower = 1 +move_rate = 1 +vision_radius_sq = 2 +transport_cap = 1 +fuel = 0 +uk_happy = 0 +uk_shield = 1 +uk_food = 0 +uk_gold = 0 +cargo = "Earthly", "Amphibious" +flags = "" +helptext = _("\ +Just let the biomass to engulf your tank and pick it up, then enjoy \ +the ride in the radiation-safe inside of the slimy being.") + [unit_explorer] name = _("Explorer") class = "Earthly" Modified: trunk/doc/README.ruleset_alien URL: http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.ruleset_alien?rev=25675&r1=25674&r2=25675&view=diff == --- trunk/doc/README.ruleset_alien (original) +++ trunk/doc/README.ruleset_alien Mon Jul 21 23:37:43 2014 @@ -106,3 +106,6 @@ - Empire size causes additional unhappiness only once every 15 bases (was 10), and knowledge of Communication eases it so that the step is 20 bases + +- Added tech "Controlled Biomass" that provides new unit "Biomass" that can + transport Earthly and Amphibious units through Radiating tiles ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25674 - /trunk/tools/ruledit/rulesave.c
Author: cazfi Date: Mon Jul 21 22:15:31 2014 New Revision: 25674 URL: http://svn.gna.org/viewcvs/freeciv?rev=25674&view=rev Log: Fixed clang warning by adding empty block for for-loop that does nothing besides the loop-construct itself. See patch #4963 Modified: trunk/tools/ruledit/rulesave.c Modified: trunk/tools/ruledit/rulesave.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/rulesave.c?rev=25674&r1=25673&r2=25674&view=diff == --- trunk/tools/ruledit/rulesave.c (original) +++ trunk/tools/ruledit/rulesave.c Mon Jul 21 22:15:31 2014 @@ -1435,7 +1435,9 @@ } output_type_iterate_end; /* Check resource count */ -for (i = 0; pterr->resources[i] != NULL; i++); +for (i = 0; pterr->resources[i] != NULL; i++) { + /* Just increasing i as long as there is resources */ +} { const char *resource_names[i]; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25673 - in /trunk/ai/default: aicity.c aicity.h aitech.c
Author: cazfi Date: Mon Jul 21 21:56:18 2014 New Revision: 25673 URL: http://svn.gna.org/viewcvs/freeciv?rev=25673&view=rev Log: Add tech want because of effects provided directly by the tech. See patch #4944 Modified: trunk/ai/default/aicity.c trunk/ai/default/aicity.h trunk/ai/default/aitech.c Modified: trunk/ai/default/aicity.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=25673&r1=25672&r2=25673&view=diff == --- trunk/ai/default/aicity.c (original) +++ trunk/ai/default/aicity.c Mon Jul 21 21:56:18 2014 @@ -150,7 +150,7 @@ int building_want) { /* The conversion factor was determined by experiment, - * and might need adjustment. + * and might need adjustment. See also dai_tech_effect_values() */ const int tech_want = building_want * def_ai_city_data(pcity, ait)->building_wait * 14 / 8; @@ -1132,8 +1132,8 @@ nothing in the city has changed, and you just want to know the base want of a city. **/ -static int city_want(struct player *pplayer, struct city *acity, - struct adv_data *adv, struct impr_type *pimprove) +int dai_city_want(struct player *pplayer, struct city *acity, + struct adv_data *adv, struct impr_type *pimprove) { int want = 0, prod[O_LAST], bonus[O_LAST], waste[O_LAST], i; @@ -1228,7 +1228,7 @@ /* Stir, then compare notes */ city_range_iterate(pcity, pplayer->cities, adv->impr_range[improvement_index(pimprove)], acity) { -final_want += city_want(pplayer, acity, adv, pimprove) +final_want += dai_city_want(pplayer, acity, adv, pimprove) - def_ai_city_data(acity, ait)->worth; } city_range_iterate_end; @@ -1622,7 +1622,7 @@ /* Find current worth of cities and cache this. */ city_list_iterate(pplayer->cities, pcity) { -def_ai_city_data(pcity, ait)->worth = city_want(pplayer, pcity, ai, NULL); +def_ai_city_data(pcity, ait)->worth = dai_city_want(pplayer, pcity, ai, NULL); } city_list_iterate_end; } Modified: trunk/ai/default/aicity.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.h?rev=25673&r1=25672&r2=25673&view=diff == --- trunk/ai/default/aicity.h (original) +++ trunk/ai/default/aicity.h Mon Jul 21 21:56:18 2014 @@ -103,4 +103,7 @@ enum effect_type effect_type, struct unit_type *utype); +int dai_city_want(struct player *pplayer, struct city *acity, + struct adv_data *adv, struct impr_type *pimprove); + #endif /* FC__AICITY_H */ Modified: trunk/ai/default/aitech.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aitech.c?rev=25673&r1=25672&r2=25673&view=diff == --- trunk/ai/default/aitech.c (original) +++ trunk/ai/default/aitech.c Mon Jul 21 21:56:18 2014 @@ -38,6 +38,7 @@ #include "ailog.h" #include "aiplayer.h" #include "aitools.h" +#include "daieffects.h" #include "aitech.h" @@ -197,6 +198,118 @@ } /** + Calculates want for some techs by actually adding the tech and + measuring the effect. +**/ +static int dai_tech_base_want(struct ai_type *ait, struct player *pplayer, + struct city *pcity, struct advance *padv) +{ + struct research *pres = research_get(pplayer); + Tech_type_id tech = advance_number(padv); + enum tech_state old_state = research_invention_state(pres, tech); + struct adv_data *adv = adv_data_get(pplayer, NULL); + int orig_want = dai_city_want(pplayer, pcity, adv, NULL); + int final_want; + + research_invention_set(pres, tech, TECH_KNOWN); + + final_want = dai_city_want(pplayer, pcity, adv, NULL); + + research_invention_set(pres, tech, old_state); + + return final_want - orig_want; +} + +/** + Add effect values in to tech wants. +**/ +static void dai_tech_effect_values(struct ai_type *ait, struct player *pplayer) +{ + /* TODO: Currently this duplicates code from aicity.c improvement effect + * evaluating almost verbose - refactor so that they can share code. */ + struct government *gov = government_of_player(pplayer); + struct adv_data *adv = adv_data_get(pplayer, NULL); + struct ai_plr *aip = def_ai_player_data(pplayer, ait); + int turns = ; /* TODO: Set to correct value */ + int nplayers = normal_player_count(); + + /* Remove team members from t
[Freeciv-commits] r25672 - /trunk/data/stub/game.ruleset
Author: sveinung Date: Mon Jul 21 14:13:06 2014 New Revision: 25672 URL: http://svn.gna.org/viewcvs/freeciv?rev=25672&view=rev Log: Make the stub ruleset more minimal by removing all action enablers. See patch #4959 Modified: trunk/data/stub/game.ruleset Modified: trunk/data/stub/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/game.ruleset?rev=25672&r1=25671&r2=25672&view=diff == --- trunk/data/stub/game.ruleset(original) +++ trunk/data/stub/game.rulesetMon Jul 21 14:13:06 2014 @@ -175,23 +175,9 @@ ; ; */ <-- avoid gettext warnings -[actionenabler_sabotage_city] -action = "Sabotage City" - -[actionenabler_sabotage_city_target] -action = "Targeted Sabotage City" - -[actionenabler_poison_city] -action = "Poison City" - -[actionenabler_incite_city] -action = "Incite City" - -[actionenabler_bribe_unit] -action = "Bribe Unit" - -[actionenabler_sabotage_unit] -action = "Sabotage Unit" +; No enabled actions +; [actionenabler_embassy] +; action = "Establish Embassy" [borders] ; Base border radius from city. ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25671 - in /trunk/translations: nations/fr.po ruledit/fr.po
Author: igx31 Date: Mon Jul 21 11:45:05 2014 New Revision: 25671 URL: http://svn.gna.org/viewcvs/freeciv?rev=25671&view=rev Log: - Updated following latest string changes Modified: trunk/translations/nations/fr.po trunk/translations/ruledit/fr.po [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/translations/nations/fr.po URL: http://svn.gna.org/viewcvs/freeciv/trunk/translations/nations/fr.po?rev=25671&r1=25670&r2=25671&view=diff Modified: trunk/translations/ruledit/fr.po URL: http://svn.gna.org/viewcvs/freeciv/trunk/translations/ruledit/fr.po?rev=25671&r1=25670&r2=25671&view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r25669 - in /branches/S2_5: common/aicore/path_finding.c utility/pqueue.c utility/pqueue.h
Author: pepeto Date: Mon Jul 21 10:25:27 2014 New Revision: 25669 URL: http://svn.gna.org/viewcvs/freeciv?rev=25669&view=rev Log: Adjustements for path-finding for fueled units: * better synchronization between the two priority queues to ensure the nodes to be processed in a good order ; * safety of a node is taken in account in total_CC calculation ; * handle correctly if the unit would implicitly refuel. See gna patch #4931 Modified: branches/S2_5/common/aicore/path_finding.c branches/S2_5/utility/pqueue.c branches/S2_5/utility/pqueue.h Modified: branches/S2_5/common/aicore/path_finding.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/aicore/path_finding.c?rev=25669&r1=25668&r2=25669&view=diff == --- branches/S2_5/common/aicore/path_finding.c (original) +++ branches/S2_5/common/aicore/path_finding.c Mon Jul 21 10:25:27 2014 @@ -1723,7 +1723,8 @@ struct pqueue *queue; /* Queue of nodes we have reached but not * processed yet (NS_NEW), sorted by their * total_CC */ - struct pqueue *out_of_fuel_queue; /* Dangerous positions go there */ + struct pqueue *waited_queue; /* Queue of nodes to reach farer positions + * after having refueled. */ struct pf_fuel_node *lattice; /* Lattice of nodes */ }; @@ -1745,6 +1746,23 @@ #endif /* PF_DEBUG */ /* = Specific pf_fuel_* mode functions == */ + +/ + Obtain cost-of-path from pure cost, extra cost and safety. +/ +static inline int pf_fuel_total_CC(const struct pf_parameter *param, + int cost, int extra, int safety) +{ + return pf_total_CC(param, cost, extra) - safety; +} + +/ + Obtain cost-of-path for constant extra cost (used for node after waited). +/ +static inline int pf_fuel_waited_total_CC(int cost, int safety) +{ + return PF_TURN_FACTOR * (cost + 1) - safety - 1; +} / Calculates cached values of the target node. Set the node status to @@ -2321,6 +2339,8 @@ struct tile *tile = pfm->tile; int index = tile_index(tile); struct pf_fuel_node *node = pffm->lattice + index; + int priority, waited_priority; + bool waited = FALSE; /* The previous position is defined by 'tile' (tile pointer), 'node' * (the data of the tile for the pf_map), and index (the index of the @@ -2331,14 +2351,20 @@ if (node->behavior != TB_DONT_LEAVE) { int loc_cost, loc_moves_left; - if (node->status != NS_WAITING) { -loc_cost = node->cost; -loc_moves_left = node->moves_left; - } else { + if (node->status == NS_WAITING) { /* Cost and moves left at tile but taking into account waiting. */ loc_cost = pf_fuel_map_fill_cost_for_full_moves(params, node->cost, node->moves_left); loc_moves_left = pf_move_rate(params); + } else if (0 == node->moves_left_req + && 0 == node->moves_left % params->move_rate + && node->cost >= params->moves_left_initially) { +/* We have implicitly refueled at the end of the turn. */ +loc_cost = node->cost; +loc_moves_left = pf_move_rate(params); + } else { +loc_cost = node->cost; +loc_moves_left = node->moves_left; } adjc_dir_iterate(tile, tile1, dir) { @@ -2347,9 +2373,8 @@ int index1 = tile_index(tile1); struct pf_fuel_node *node1 = pffm->lattice + index1; int cost, extra = 0; -int moves_left, mlr = 0; +int moves_left; int cost_of_path, old_cost_of_path; -struct tile *prev_tile; struct pf_fuel_pos *pos; /* As for the previous position, 'tile1', 'node1' and 'index1' are @@ -2435,7 +2460,8 @@ /* Update costs and add to queue, if this is a better route * to tile1. Case safe tiles or reached directly without waiting. */ pos = node1->fuel_segment; -cost_of_path = pf_total_CC(params, cost, extra); +cost_of_path = pf_fuel_total_CC(params, cost, extra, +moves_left - node1->moves_left_req); if (node1->status == NS_INIT) { /* Not calculated yet. */ old_cost_of_path = 0; @@ -2444,29 +2470,20 @@ * overwritten if we had more moves left to deal with waiting. * Then, we have to get back the value of this node to calculate * the cost. */ -