[Freeciv-commits] r35653 - /branches/S2_6/ai/default/aicity.c
Author: cazfi Date: Thu May 18 17:24:57 2017 New Revision: 35653 URL: http://svn.gna.org/viewcvs/freeciv?rev=35653=rev Log: Multiply AI want for Great Wonders by 1.5 See hrm Feature #661176 Modified: branches/S2_6/ai/default/aicity.c Modified: branches/S2_6/ai/default/aicity.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/aicity.c?rev=35653=35652=35653=diff == --- branches/S2_6/ai/default/aicity.c (original) +++ branches/S2_6/ai/default/aicity.c Thu May 18 17:24:57 2017 @@ -1753,19 +1753,26 @@ * We DO want to calculate (tech) wants because of buildings * we already have. */ const bool already = city_has_building(pcity, pimprove); + int idx = improvement_index(pimprove); adjust_improvement_wants_by_effects(ait, pplayer, pcity, pimprove, already); fc_assert(!(already - && 0 < pcity->server.adv->building_want[improvement_index(pimprove)])); + && 0 < pcity->server.adv->building_want[idx])); + + if (is_great_wonder(pimprove)) { +/* Not only would we get the wonder, but we would also prevent + * opponents from getting it. */ +pcity->server.adv->building_want[idx] *= 1.5; + } /* If I am not an expansionist, I want buildings more than units */ - if (pcity->server.adv->building_want[improvement_index(pimprove)] > 0) { -pcity->server.adv->building_want[improvement_index(pimprove)] - = pcity->server.adv->building_want[improvement_index(pimprove)] - * TRAIT_DEFAULT_VALUE - / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer); + if (pcity->server.adv->building_want[idx] > 0) { +pcity->server.adv->building_want[idx] + = pcity->server.adv->building_want[idx] + * TRAIT_DEFAULT_VALUE + / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer); } } /* else wait until a later turn */ ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35651 - /trunk/ai/default/aicity.c
Author: cazfi Date: Thu May 18 17:24:44 2017 New Revision: 35651 URL: http://svn.gna.org/viewcvs/freeciv?rev=35651=rev Log: Multiply AI want for Great Wonders by 1.5 See hrm Feature #661176 Modified: trunk/ai/default/aicity.c Modified: trunk/ai/default/aicity.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=35651=35650=35651=diff == --- trunk/ai/default/aicity.c (original) +++ trunk/ai/default/aicity.c Thu May 18 17:24:44 2017 @@ -1867,19 +1867,26 @@ * We DO want to calculate (tech) wants because of buildings * we already have. */ const bool already = city_has_building(pcity, pimprove); + int idx = improvement_index(pimprove); adjust_improvement_wants_by_effects(ait, pplayer, pcity, pimprove, already); fc_assert(!(already - && 0 < pcity->server.adv->building_want[improvement_index(pimprove)])); + && 0 < pcity->server.adv->building_want[idx])); + + if (is_great_wonder(pimprove)) { +/* Not only would we get the wonder, but we would also prevent + * opponents from getting it. */ +pcity->server.adv->building_want[idx] *= 1.5; + } /* If I am not an expansionist, I want buildings more than units */ - if (pcity->server.adv->building_want[improvement_index(pimprove)] > 0) { -pcity->server.adv->building_want[improvement_index(pimprove)] - = pcity->server.adv->building_want[improvement_index(pimprove)] - * TRAIT_DEFAULT_VALUE - / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer); + if (pcity->server.adv->building_want[idx] > 0) { +pcity->server.adv->building_want[idx] + = pcity->server.adv->building_want[idx] + * TRAIT_DEFAULT_VALUE + / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer); } } /* else wait until a later turn */ ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35652 - /branches/S3_0/ai/default/aicity.c
Author: cazfi Date: Thu May 18 17:24:51 2017 New Revision: 35652 URL: http://svn.gna.org/viewcvs/freeciv?rev=35652=rev Log: Multiply AI want for Great Wonders by 1.5 See hrm Feature #661176 Modified: branches/S3_0/ai/default/aicity.c Modified: branches/S3_0/ai/default/aicity.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/aicity.c?rev=35652=35651=35652=diff == --- branches/S3_0/ai/default/aicity.c (original) +++ branches/S3_0/ai/default/aicity.c Thu May 18 17:24:51 2017 @@ -1867,19 +1867,26 @@ * We DO want to calculate (tech) wants because of buildings * we already have. */ const bool already = city_has_building(pcity, pimprove); + int idx = improvement_index(pimprove); adjust_improvement_wants_by_effects(ait, pplayer, pcity, pimprove, already); fc_assert(!(already - && 0 < pcity->server.adv->building_want[improvement_index(pimprove)])); + && 0 < pcity->server.adv->building_want[idx])); + + if (is_great_wonder(pimprove)) { +/* Not only would we get the wonder, but we would also prevent + * opponents from getting it. */ +pcity->server.adv->building_want[idx] *= 1.5; + } /* If I am not an expansionist, I want buildings more than units */ - if (pcity->server.adv->building_want[improvement_index(pimprove)] > 0) { -pcity->server.adv->building_want[improvement_index(pimprove)] - = pcity->server.adv->building_want[improvement_index(pimprove)] - * TRAIT_DEFAULT_VALUE - / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer); + if (pcity->server.adv->building_want[idx] > 0) { +pcity->server.adv->building_want[idx] + = pcity->server.adv->building_want[idx] + * TRAIT_DEFAULT_VALUE + / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer); } } /* else wait until a later turn */ ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35650 - /branches/S2_6/ai/default/daidomestic.c
Author: cazfi Date: Thu May 18 15:24:00 2017 New Revision: 35650 URL: http://svn.gna.org/viewcvs/freeciv?rev=35650=rev Log: Fix NULL dereference when there's no suitable founder unit type See hrm Bug #661409 Modified: branches/S2_6/ai/default/daidomestic.c Modified: branches/S2_6/ai/default/daidomestic.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/daidomestic.c?rev=35650=35649=35650=diff == --- branches/S2_6/ai/default/daidomestic.c (original) +++ branches/S2_6/ai/default/daidomestic.c Thu May 18 15:24:00 2017 @@ -460,7 +460,7 @@ settler_want = city_data->settler_want * pplayer->ai_common.expand / 100; if (adv->wonder_city == pcity->id) { -if (!settler_type || settler_type->pop_cost > 0) { +if (settler_type == NULL || settler_type->pop_cost > 0) { settler_want /= 5; } else { settler_want /= 2; @@ -492,13 +492,13 @@ founder_want = city_data->founder_want; if (adv->wonder_city == pcity->id) { - if (founder_type->pop_cost > 0) { + if (founder_type == NULL || founder_type->pop_cost > 0) { founder_want /= 5; } else { founder_want /= 2; } } - + if (adv->max_num_cities <= city_list_size(pplayer->cities)) { founder_want /= 100; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35648 - /trunk/ai/default/daidomestic.c
Author: cazfi Date: Thu May 18 15:23:46 2017 New Revision: 35648 URL: http://svn.gna.org/viewcvs/freeciv?rev=35648=rev Log: Fix NULL dereference when there's no suitable founder unit type See hrm Bug #661409 Modified: trunk/ai/default/daidomestic.c Modified: trunk/ai/default/daidomestic.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daidomestic.c?rev=35648=35647=35648=diff == --- trunk/ai/default/daidomestic.c (original) +++ trunk/ai/default/daidomestic.c Thu May 18 15:23:46 2017 @@ -475,7 +475,7 @@ worker_want = city_data->worker_want * pplayer->ai_common.expand / 100; if (adv->wonder_city == pcity->id) { -if (!worker_type || worker_type->pop_cost > 0) { +if (worker_type == NULL || worker_type->pop_cost > 0) { worker_want /= 5; } else { worker_want /= 2; @@ -509,13 +509,13 @@ founder_want = city_data->founder_want; if (adv->wonder_city == pcity->id) { - if (founder_type->pop_cost > 0) { + if (founder_type == NULL || founder_type->pop_cost > 0) { founder_want /= 5; } else { founder_want /= 2; } } - + if (adv->max_num_cities <= city_list_size(pplayer->cities)) { founder_want /= 100; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35649 - /branches/S3_0/ai/default/daidomestic.c
Author: cazfi Date: Thu May 18 15:23:53 2017 New Revision: 35649 URL: http://svn.gna.org/viewcvs/freeciv?rev=35649=rev Log: Fix NULL dereference when there's no suitable founder unit type See hrm Bug #661409 Modified: branches/S3_0/ai/default/daidomestic.c Modified: branches/S3_0/ai/default/daidomestic.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/daidomestic.c?rev=35649=35648=35649=diff == --- branches/S3_0/ai/default/daidomestic.c (original) +++ branches/S3_0/ai/default/daidomestic.c Thu May 18 15:23:53 2017 @@ -475,7 +475,7 @@ worker_want = city_data->worker_want * pplayer->ai_common.expand / 100; if (adv->wonder_city == pcity->id) { -if (!worker_type || worker_type->pop_cost > 0) { +if (worker_type == NULL || worker_type->pop_cost > 0) { worker_want /= 5; } else { worker_want /= 2; @@ -509,13 +509,13 @@ founder_want = city_data->founder_want; if (adv->wonder_city == pcity->id) { - if (founder_type->pop_cost > 0) { + if (founder_type == NULL || founder_type->pop_cost > 0) { founder_want /= 5; } else { founder_want /= 2; } } - + if (adv->max_num_cities <= city_list_size(pplayer->cities)) { founder_want /= 100; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35647 - /trunk/tools/mpdb.c
Author: cazfi Date: Thu May 18 15:17:19 2017 New Revision: 35647 URL: http://svn.gna.org/viewcvs/freeciv?rev=35647=rev Log: Create directory for modpack database if it doesn't exist See hrm Bug #661353 Modified: trunk/tools/mpdb.c Modified: trunk/tools/mpdb.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/mpdb.c?rev=35647=35646=35647=diff == --- trunk/tools/mpdb.c (original) +++ trunk/tools/mpdb.c Thu May 18 15:17:19 2017 @@ -135,6 +135,19 @@ { sqlite3 **handle; int ret; + int llen = strlen(filename) + 1; + char *local_name = fc_malloc(llen); + int i; + + strncpy(local_name, filename, llen); + for (i = llen - 1 ; local_name[i] != DIR_SEPARATOR_CHAR ; i--) { +/* Nothing */ + } + local_name[i] = '\0'; + if (!make_dir(local_name)) { +log_error(_("Can't create directory \"%s\" for modpack database."), local_name); +return; + } if (scenario_db) { handle = _handle; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35643 - /trunk/server/unittools.c
Author: cazfi Date: Thu May 18 15:13:00 2017 New Revision: 35643 URL: http://svn.gna.org/viewcvs/freeciv?rev=35643=rev Log: Make sure unit vision radius is not negative Reported by David Fernandez (bard) See hrm Bug #661313 Modified: trunk/server/unittools.c Modified: trunk/server/unittools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=35643=35642=35643=diff == --- trunk/server/unittools.c(original) +++ trunk/server/unittools.cThu May 18 15:13:00 2017 @@ -4453,17 +4453,17 @@ properly. / int get_unit_vision_at(struct unit *punit, struct tile *ptile, - enum vision_layer vlayer) + enum vision_layer vlayer) { const int base = (unit_type_get(punit)->vision_radius_sq - + get_unittype_bonus(unit_owner(punit), ptile, ++ get_unittype_bonus(unit_owner(punit), ptile, unit_type_get(punit), -EFT_UNIT_VISION_RADIUS_SQ)); + EFT_UNIT_VISION_RADIUS_SQ)); switch (vlayer) { case V_MAIN: -return base; +return MAX(0, base); case V_INVIS: -return MIN(base, 2); +return CLIP(0, base, 2); case V_COUNT: break; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35645 - /branches/S2_6/server/unittools.c
Author: cazfi Date: Thu May 18 15:13:14 2017 New Revision: 35645 URL: http://svn.gna.org/viewcvs/freeciv?rev=35645=rev Log: Make sure unit vision radius is not negative Reported by David Fernandez (bard) See hrm Bug #661313 Modified: branches/S2_6/server/unittools.c Modified: branches/S2_6/server/unittools.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/unittools.c?rev=35645=35644=35645=diff == --- branches/S2_6/server/unittools.c(original) +++ branches/S2_6/server/unittools.cThu May 18 15:13:14 2017 @@ -4308,17 +4308,17 @@ properly. / int get_unit_vision_at(struct unit *punit, struct tile *ptile, - enum vision_layer vlayer) + enum vision_layer vlayer) { const int base = (unit_type_get(punit)->vision_radius_sq - + get_unittype_bonus(unit_owner(punit), ptile, ++ get_unittype_bonus(unit_owner(punit), ptile, unit_type_get(punit), -EFT_UNIT_VISION_RADIUS_SQ)); + EFT_UNIT_VISION_RADIUS_SQ)); switch (vlayer) { case V_MAIN: -return base; +return MAX(0, base); case V_INVIS: -return MIN(base, 2); +return CLIP(0, base, 2); case V_COUNT: break; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35646 - /branches/S2_5/server/unittools.c
Author: cazfi Date: Thu May 18 15:13:21 2017 New Revision: 35646 URL: http://svn.gna.org/viewcvs/freeciv?rev=35646=rev Log: Make sure unit vision radius is not negative Reported by David Fernandez (bard) See hrm Bug #661313 Modified: branches/S2_5/server/unittools.c Modified: branches/S2_5/server/unittools.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/unittools.c?rev=35646=35645=35646=diff == --- branches/S2_5/server/unittools.c(original) +++ branches/S2_5/server/unittools.cThu May 18 15:13:21 2017 @@ -4164,16 +4164,16 @@ properly. / int get_unit_vision_at(struct unit *punit, struct tile *ptile, - enum vision_layer vlayer) + enum vision_layer vlayer) { const int base = (unit_type(punit)->vision_radius_sq - + get_unittype_bonus(unit_owner(punit), ptile, unit_type(punit), -EFT_UNIT_VISION_RADIUS_SQ)); ++ get_unittype_bonus(unit_owner(punit), ptile, unit_type(punit), + EFT_UNIT_VISION_RADIUS_SQ)); switch (vlayer) { case V_MAIN: -return base; +return MAX(0, base); case V_INVIS: -return MIN(base, 2); +return CLIP(0, base, 2); case V_COUNT: break; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35642 - /branches/S2_5/server/diplomats.c
Author: sveinung Date: Thu May 18 11:31:47 2017 New Revision: 35642 URL: http://svn.gna.org/viewcvs/freeciv?rev=35642=rev Log: A non Spy is spent, not caught. It can't escape. See hrm Feature #657298 Modified: branches/S2_5/server/diplomats.c Modified: branches/S2_5/server/diplomats.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/diplomats.c?rev=35642=35641=35642=diff == --- branches/S2_5/server/diplomats.c(original) +++ branches/S2_5/server/diplomats.cThu May 18 11:31:47 2017 @@ -1391,8 +1391,10 @@ } } - /* FIXME: Reason should be ULR_USED for diplomats? */ - wipe_unit(pdiplomat, ULR_CAUGHT, NULL); + wipe_unit(pdiplomat, +/* A non Spy can't escape. It is therefore spent, not caught. */ +unit_has_type_flag(pdiplomat, UTYF_SPY) ? ULR_CAUGHT : ULR_USED, +NULL); } / ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35641 - /branches/S2_5/doc/README.ruleset_civ2civ3
Author: sveinung Date: Thu May 18 11:31:39 2017 New Revision: 35641 URL: http://svn.gna.org/viewcvs/freeciv?rev=35641=rev Log: civ2civ3: improve README.civ2civ3 text. Happy borders aren't disabled after gna patch #7080. Don't claim it is. Improve the English by removing capitalization from some words. Expand pop to population. Patch by David Fernandez See hrm Feature #657562 Modified: branches/S2_5/doc/README.ruleset_civ2civ3 Modified: branches/S2_5/doc/README.ruleset_civ2civ3 URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/doc/README.ruleset_civ2civ3?rev=35641=35640=35641=diff == --- branches/S2_5/doc/README.ruleset_civ2civ3 (original) +++ branches/S2_5/doc/README.ruleset_civ2civ3 Thu May 18 11:31:39 2017 @@ -101,7 +101,7 @@ random technology is lost, and half of its value is restored to the count of Bulbs. -- Enabled risk of Plague at cities with pop greater than 4. Chances +- Enabled risk of Plague at cities with population greater than 4. Chances reduced by the buildings Aqueduct and Sewer System, the tech Medicine, and the wonder Cure for Cancer. @@ -127,10 +127,6 @@ - Set Occupy Chance to 100%: Units automatically move to the target tile if the attack is successful and ZoC rules allow the movement. - -- Disabled Happy Borders: Military Units cause unhappiness if they end - the turn outside cities or fortresses, no matter if they are inside - national borders. FOODBOX: @@ -798,11 +794,11 @@ periods when government changes. - (#)"United Nations" 600: +10 to AI love for the owner. Revolution_When_Unhappy and Has_Senate - for Every Nation. + for every nation. - "Great Wall" 300, Obsolete by Machine Tools (Artillery): +50% Defense bonus against Land units in every city, and cities do not - lose Population due to attacks. + lose population due to attacks. - "Leonardo's Workshop" 400, Obsolete by Combustion: Upgrades one obsolete unit per game turn. - "Hoover Dam" 600, Requires Factory: @@ -832,9 +828,6 @@ - Large cities (Pop>=8) no longer get extra units free of upkeep or military unhappiness. The result is 1, 2, or 3 free units per city, depending on the government. -- Disabled happyborders: Units cause military unhappiness if they end - the turn outside cities or fortresses, no matter if they are inside - national borders. - Readjusted effect of some wonders: Mausoleum of Mausolos, Statue of Liberty, and those related to military unhappiness. Marco Polo's Embassy obsolete by Democracy. ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35638 - in /trunk: ./ client/ client/gui-gtk-3.0/ client/gui-gtk-3.22/ client/gui-gtk-4.0/ client/gui-qt/ client/gui-sdl2/ ...
Author: sveinung Date: Thu May 18 11:25:20 2017 New Revision: 35638 URL: http://svn.gna.org/viewcvs/freeciv?rev=35638=rev Log: Prepare targeted sabotage for generic actions. Return the action id with the lists of buildings that can be targeted in the target city. Forward the action to the clients in popup_sabotage_dialog(). Have the clients use the specified action (rather than hard coding ACTION_SPY_TARGETED_SABOTAGE_CITY) when ordering the action to take place. See hrm Feature #661177 Modified: trunk/client/gui-gtk-3.0/action_dialog.c trunk/client/gui-gtk-3.22/action_dialog.c trunk/client/gui-gtk-4.0/action_dialog.c trunk/client/gui-qt/dialogs.cpp trunk/client/gui-sdl2/action_dialog.c trunk/client/gui-stub/dialogs.c trunk/client/include/dialogs_g.h trunk/client/packhand.c trunk/common/networking/packets.def trunk/fc_version trunk/server/diplomats.c Modified: trunk/client/gui-gtk-3.0/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/action_dialog.c?rev=35638=35637=35638=diff == --- trunk/client/gui-gtk-3.0/action_dialog.c(original) +++ trunk/client/gui-gtk-3.0/action_dialog.cThu May 18 11:25:20 2017 @@ -1171,12 +1171,13 @@ Pops-up the Spy sabotage dialog, upon return of list of available improvements requested by the above function. **/ -void popup_sabotage_dialog(struct unit *actor, struct city *pcity) +void popup_sabotage_dialog(struct unit *actor, struct city *pcity, + const struct action *paction) { /* FIXME: Don't discard the second target choice dialog. */ if (!spy_sabotage_shell) { create_improvements_list(client.conn.playing, pcity, - act_data(ACTION_SPY_TARGETED_SABOTAGE_CITY, + act_data(paction->id, actor->id, pcity->id, 0, 0, 0)); gtk_window_present(GTK_WINDOW(spy_sabotage_shell)); } Modified: trunk/client/gui-gtk-3.22/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/action_dialog.c?rev=35638=35637=35638=diff == --- trunk/client/gui-gtk-3.22/action_dialog.c (original) +++ trunk/client/gui-gtk-3.22/action_dialog.c Thu May 18 11:25:20 2017 @@ -1165,12 +1165,13 @@ Pops-up the Spy sabotage dialog, upon return of list of available improvements requested by the above function. **/ -void popup_sabotage_dialog(struct unit *actor, struct city *pcity) +void popup_sabotage_dialog(struct unit *actor, struct city *pcity, + const struct action *paction) { /* FIXME: Don't discard the second target choice dialog. */ if (!spy_sabotage_shell) { create_improvements_list(client.conn.playing, pcity, - act_data(ACTION_SPY_TARGETED_SABOTAGE_CITY, + act_data(paction->id, actor->id, pcity->id, 0, 0, 0)); gtk_window_present(GTK_WINDOW(spy_sabotage_shell)); } Modified: trunk/client/gui-gtk-4.0/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-4.0/action_dialog.c?rev=35638=35637=35638=diff == --- trunk/client/gui-gtk-4.0/action_dialog.c(original) +++ trunk/client/gui-gtk-4.0/action_dialog.cThu May 18 11:25:20 2017 @@ -1165,12 +1165,13 @@ Pops-up the Spy sabotage dialog, upon return of list of available improvements requested by the above function. **/ -void popup_sabotage_dialog(struct unit *actor, struct city *pcity) +void popup_sabotage_dialog(struct unit *actor, struct city *pcity, + const struct action *paction) { /* FIXME: Don't discard the second target choice dialog. */ if (!spy_sabotage_shell) { create_improvements_list(client.conn.playing, pcity, - act_data(ACTION_SPY_TARGETED_SABOTAGE_CITY, + act_data(paction->id, actor->id, pcity->id, 0, 0, 0)); gtk_window_present(GTK_WINDOW(spy_sabotage_shell)); } Modified: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=35638=35637=35638=diff == --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Thu May 18 11:25:20 2017 @@ -2658,6 +2658,7 @@ { int diplomat_id = data1.toList().at(0).toInt(); int diplomat_target_id = data1.toList().at(1).toInt(); + int action_id =
[Freeciv-commits] r35639 - in /branches/S3_0/data: civ2civ3/ multiplayer/
Author: sveinung Date: Thu May 18 11:25:55 2017 New Revision: 35639 URL: http://svn.gna.org/viewcvs/freeciv?rev=35639=rev Log: civ2civ3 and multiplayer are web compatible. The rulesets civ2civ3 and multiplayer are currently used unmodified in Freeciv-web. Document the current compatibility. Thanks to Marko Lindqvist for clarifying that web-compatible isn't a promise of future compatibility in hrm Bug #660894 comment #8. See hrm Feature #661168 Modified: branches/S3_0/data/civ2civ3/buildings.ruleset branches/S3_0/data/civ2civ3/cities.ruleset branches/S3_0/data/civ2civ3/effects.ruleset branches/S3_0/data/civ2civ3/game.ruleset branches/S3_0/data/civ2civ3/governments.ruleset branches/S3_0/data/civ2civ3/nations.ruleset branches/S3_0/data/civ2civ3/styles.ruleset branches/S3_0/data/civ2civ3/techs.ruleset branches/S3_0/data/civ2civ3/terrain.ruleset branches/S3_0/data/civ2civ3/units.ruleset branches/S3_0/data/multiplayer/buildings.ruleset branches/S3_0/data/multiplayer/cities.ruleset branches/S3_0/data/multiplayer/effects.ruleset branches/S3_0/data/multiplayer/game.ruleset branches/S3_0/data/multiplayer/governments.ruleset branches/S3_0/data/multiplayer/nations.ruleset branches/S3_0/data/multiplayer/styles.ruleset branches/S3_0/data/multiplayer/techs.ruleset branches/S3_0/data/multiplayer/terrain.ruleset branches/S3_0/data/multiplayer/units.ruleset Modified: branches/S3_0/data/civ2civ3/buildings.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/civ2civ3/buildings.ruleset?rev=35639=35638=35639=diff == --- branches/S3_0/data/civ2civ3/buildings.ruleset (original) +++ branches/S3_0/data/civ2civ3/buildings.ruleset Thu May 18 11:25:55 2017 @@ -12,7 +12,7 @@ [datafile] description="Civ2Civ3 buildings data for Freeciv" -options="+Freeciv-ruleset-Devel-2015.January.14" +options="+Freeciv-ruleset-Devel-2015.January.14 web-compatible" format_version=10 ; /* <-- avoid gettext warnings Modified: branches/S3_0/data/civ2civ3/cities.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/civ2civ3/cities.ruleset?rev=35639=35638=35639=diff == --- branches/S3_0/data/civ2civ3/cities.ruleset (original) +++ branches/S3_0/data/civ2civ3/cities.ruleset Thu May 18 11:25:55 2017 @@ -9,7 +9,7 @@ [datafile] description="Civ2Civ3 cities data for Freeciv" -options="+Freeciv-ruleset-Devel-2015.January.14" +options="+Freeciv-ruleset-Devel-2015.January.14 web-compatible" format_version=10 ; /* <-- avoid gettext warnings Modified: branches/S3_0/data/civ2civ3/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/civ2civ3/effects.ruleset?rev=35639=35638=35639=diff == --- branches/S3_0/data/civ2civ3/effects.ruleset (original) +++ branches/S3_0/data/civ2civ3/effects.ruleset Thu May 18 11:25:55 2017 @@ -11,7 +11,7 @@ [datafile] description="Civ2Civ3 effects data for Freeciv" -options="+Freeciv-ruleset-Devel-2015.January.14" +options="+Freeciv-ruleset-Devel-2015.January.14 web-compatible" format_version=10 ; /* <-- avoid gettext warnings Modified: branches/S3_0/data/civ2civ3/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/civ2civ3/game.ruleset?rev=35639=35638=35639=diff == --- branches/S3_0/data/civ2civ3/game.ruleset(original) +++ branches/S3_0/data/civ2civ3/game.rulesetThu May 18 11:25:55 2017 @@ -11,7 +11,7 @@ [datafile] description="Civ2Civ3 game rules for Freeciv" -options="+Freeciv-ruleset-Devel-2015.January.14" +options="+Freeciv-ruleset-Devel-2015.January.14 web-compatible" format_version=10 ; This section contains meta information for freeciv-ruledit to recreate the ruleset Modified: branches/S3_0/data/civ2civ3/governments.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/civ2civ3/governments.ruleset?rev=35639=35638=35639=diff == --- branches/S3_0/data/civ2civ3/governments.ruleset (original) +++ branches/S3_0/data/civ2civ3/governments.ruleset Thu May 18 11:25:55 2017 @@ -12,7 +12,7 @@ [datafile] description="Civ2Civ3 governments data for Freeciv" -options="+Freeciv-ruleset-Devel-2015.January.14" +options="+Freeciv-ruleset-Devel-2015.January.14 web-compatible" format_version=10 [governments] Modified: branches/S3_0/data/civ2civ3/nations.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/civ2civ3/nations.ruleset?rev=35639=35638=35639=diff == --- branches/S3_0/data/civ2civ3/nations.ruleset (original) +++
[Freeciv-commits] r35640 - in /branches/S3_0: ./ client/ client/gui-gtk-2.0/ client/gui-gtk-3.0/ client/gui-gtk-3.22/ client/gui-qt/ client/gu...
Author: sveinung Date: Thu May 18 11:26:05 2017 New Revision: 35640 URL: http://svn.gna.org/viewcvs/freeciv?rev=35640=rev Log: Prepare targeted sabotage for generic actions. Return the action id with the lists of buildings that can be targeted in the target city. Forward the action to the clients in popup_sabotage_dialog(). Have the clients use the specified action (rather than hard coding ACTION_SPY_TARGETED_SABOTAGE_CITY) when ordering the action to take place. See hrm Feature #661177 Modified: branches/S3_0/client/gui-gtk-2.0/action_dialog.c branches/S3_0/client/gui-gtk-3.0/action_dialog.c branches/S3_0/client/gui-gtk-3.22/action_dialog.c branches/S3_0/client/gui-qt/dialogs.cpp branches/S3_0/client/gui-sdl2/action_dialog.c branches/S3_0/client/gui-stub/dialogs.c branches/S3_0/client/include/dialogs_g.h branches/S3_0/client/packhand.c branches/S3_0/common/networking/packets.def branches/S3_0/fc_version branches/S3_0/server/diplomats.c Modified: branches/S3_0/client/gui-gtk-2.0/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-gtk-2.0/action_dialog.c?rev=35640=35639=35640=diff == --- branches/S3_0/client/gui-gtk-2.0/action_dialog.c(original) +++ branches/S3_0/client/gui-gtk-2.0/action_dialog.cThu May 18 11:26:05 2017 @@ -1151,12 +1151,13 @@ Pops-up the Spy sabotage dialog, upon return of list of available improvements requested by the above function. **/ -void popup_sabotage_dialog(struct unit *actor, struct city *pcity) +void popup_sabotage_dialog(struct unit *actor, struct city *pcity, + const struct action *paction) { /* FIXME: Don't discard the second target choice dialog. */ if (!spy_sabotage_shell) { create_improvements_list(client.conn.playing, pcity, - act_data(ACTION_SPY_TARGETED_SABOTAGE_CITY, + act_data(paction->id, actor->id, pcity->id, 0, 0, 0)); gtk_window_present(GTK_WINDOW(spy_sabotage_shell)); } Modified: branches/S3_0/client/gui-gtk-3.0/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-gtk-3.0/action_dialog.c?rev=35640=35639=35640=diff == --- branches/S3_0/client/gui-gtk-3.0/action_dialog.c(original) +++ branches/S3_0/client/gui-gtk-3.0/action_dialog.cThu May 18 11:26:05 2017 @@ -1171,12 +1171,13 @@ Pops-up the Spy sabotage dialog, upon return of list of available improvements requested by the above function. **/ -void popup_sabotage_dialog(struct unit *actor, struct city *pcity) +void popup_sabotage_dialog(struct unit *actor, struct city *pcity, + const struct action *paction) { /* FIXME: Don't discard the second target choice dialog. */ if (!spy_sabotage_shell) { create_improvements_list(client.conn.playing, pcity, - act_data(ACTION_SPY_TARGETED_SABOTAGE_CITY, + act_data(paction->id, actor->id, pcity->id, 0, 0, 0)); gtk_window_present(GTK_WINDOW(spy_sabotage_shell)); } Modified: branches/S3_0/client/gui-gtk-3.22/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-gtk-3.22/action_dialog.c?rev=35640=35639=35640=diff == --- branches/S3_0/client/gui-gtk-3.22/action_dialog.c (original) +++ branches/S3_0/client/gui-gtk-3.22/action_dialog.c Thu May 18 11:26:05 2017 @@ -1165,12 +1165,13 @@ Pops-up the Spy sabotage dialog, upon return of list of available improvements requested by the above function. **/ -void popup_sabotage_dialog(struct unit *actor, struct city *pcity) +void popup_sabotage_dialog(struct unit *actor, struct city *pcity, + const struct action *paction) { /* FIXME: Don't discard the second target choice dialog. */ if (!spy_sabotage_shell) { create_improvements_list(client.conn.playing, pcity, - act_data(ACTION_SPY_TARGETED_SABOTAGE_CITY, + act_data(paction->id, actor->id, pcity->id, 0, 0, 0)); gtk_window_present(GTK_WINDOW(spy_sabotage_shell)); } Modified: branches/S3_0/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/dialogs.cpp?rev=35640=35639=35640=diff == --- branches/S3_0/client/gui-qt/dialogs.cpp (original) +++
[Freeciv-commits] r35637 - in /trunk/data: civ2civ3/ multiplayer/
Author: sveinung Date: Thu May 18 11:25:08 2017 New Revision: 35637 URL: http://svn.gna.org/viewcvs/freeciv?rev=35637=rev Log: civ2civ3 and multiplayer are web compatible. The rulesets civ2civ3 and multiplayer are currently used unmodified in Freeciv-web. Document the current compatibility. Thanks to Marko Lindqvist for clarifying that web-compatible isn't a promise of future compatibility in hrm Bug #660894 comment #8. See hrm Feature #661168 Modified: trunk/data/civ2civ3/buildings.ruleset trunk/data/civ2civ3/cities.ruleset trunk/data/civ2civ3/effects.ruleset trunk/data/civ2civ3/game.ruleset trunk/data/civ2civ3/governments.ruleset trunk/data/civ2civ3/nations.ruleset trunk/data/civ2civ3/styles.ruleset trunk/data/civ2civ3/techs.ruleset trunk/data/civ2civ3/terrain.ruleset trunk/data/civ2civ3/units.ruleset trunk/data/multiplayer/buildings.ruleset trunk/data/multiplayer/cities.ruleset trunk/data/multiplayer/effects.ruleset trunk/data/multiplayer/game.ruleset trunk/data/multiplayer/governments.ruleset trunk/data/multiplayer/nations.ruleset trunk/data/multiplayer/styles.ruleset trunk/data/multiplayer/techs.ruleset trunk/data/multiplayer/terrain.ruleset trunk/data/multiplayer/units.ruleset Modified: trunk/data/civ2civ3/buildings.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/buildings.ruleset?rev=35637=35636=35637=diff == --- trunk/data/civ2civ3/buildings.ruleset (original) +++ trunk/data/civ2civ3/buildings.ruleset Thu May 18 11:25:08 2017 @@ -12,7 +12,7 @@ [datafile] description="Civ2Civ3 buildings data for Freeciv" -options="+Freeciv-ruleset-Devel-2017.Jan.02" +options="+Freeciv-ruleset-Devel-2017.Jan.02 web-compatible" format_version=20 ; /* <-- avoid gettext warnings Modified: trunk/data/civ2civ3/cities.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/cities.ruleset?rev=35637=35636=35637=diff == --- trunk/data/civ2civ3/cities.ruleset (original) +++ trunk/data/civ2civ3/cities.ruleset Thu May 18 11:25:08 2017 @@ -9,7 +9,7 @@ [datafile] description="Civ2Civ3 cities data for Freeciv" -options="+Freeciv-ruleset-Devel-2017.Jan.02" +options="+Freeciv-ruleset-Devel-2017.Jan.02 web-compatible" format_version=20 ; /* <-- avoid gettext warnings Modified: trunk/data/civ2civ3/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/effects.ruleset?rev=35637=35636=35637=diff == --- trunk/data/civ2civ3/effects.ruleset (original) +++ trunk/data/civ2civ3/effects.ruleset Thu May 18 11:25:08 2017 @@ -11,7 +11,7 @@ [datafile] description="Civ2Civ3 effects data for Freeciv" -options="+Freeciv-ruleset-Devel-2017.Jan.02" +options="+Freeciv-ruleset-Devel-2017.Jan.02 web-compatible" format_version=20 ; /* <-- avoid gettext warnings Modified: trunk/data/civ2civ3/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=35637=35636=35637=diff == --- trunk/data/civ2civ3/game.ruleset(original) +++ trunk/data/civ2civ3/game.rulesetThu May 18 11:25:08 2017 @@ -11,7 +11,7 @@ [datafile] description="Civ2Civ3 game rules for Freeciv" -options="+Freeciv-ruleset-Devel-2017.Jan.02" +options="+Freeciv-ruleset-Devel-2017.Jan.02 web-compatible" format_version=20 ; This section contains meta information for freeciv-ruledit to recreate the ruleset Modified: trunk/data/civ2civ3/governments.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/governments.ruleset?rev=35637=35636=35637=diff == --- trunk/data/civ2civ3/governments.ruleset (original) +++ trunk/data/civ2civ3/governments.ruleset Thu May 18 11:25:08 2017 @@ -12,7 +12,7 @@ [datafile] description="Civ2Civ3 governments data for Freeciv" -options="+Freeciv-ruleset-Devel-2017.Jan.02" +options="+Freeciv-ruleset-Devel-2017.Jan.02 web-compatible" format_version=20 [governments] Modified: trunk/data/civ2civ3/nations.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/nations.ruleset?rev=35637=35636=35637=diff == --- trunk/data/civ2civ3/nations.ruleset (original) +++ trunk/data/civ2civ3/nations.ruleset Thu May 18 11:25:08 2017 @@ -9,7 +9,7 @@ [datafile] description="Default nations data for Freeciv" -options="+Freeciv-ruleset-Devel-2017.Jan.02" +options="+Freeciv-ruleset-Devel-2017.Jan.02 web-compatible" format_version=20 ; This section contains meta information for freeciv-ruledit to recreate the ruleset Modified: trunk/data/civ2civ3/styles.ruleset URL:
[Freeciv-commits] r35636 - /branches/S2_5/server/citytools.c
Author: cazfi Date: Thu May 18 11:16:25 2017 New Revision: 35636 URL: http://svn.gna.org/viewcvs/freeciv?rev=35636=rev Log: Make sure veterancy of the newly built unit is not negative Reported by David Fernandez (bard) See hrm Bug #661193 Modified: branches/S2_5/server/citytools.c Modified: branches/S2_5/server/citytools.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/citytools.c?rev=35636=35635=35636=diff == --- branches/S2_5/server/citytools.c(original) +++ branches/S2_5/server/citytools.cThu May 18 11:16:25 2017 @@ -563,9 +563,13 @@ int do_make_unit_veteran(struct city *pcity, const struct unit_type *punittype) { - return MIN(get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, -EFT_VETERAN_BUILD), - utype_veteran_levels(punittype) - 1); + int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, + EFT_VETERAN_BUILD); + int max_levels = utype_veteran_levels(punittype) - 1; + + levels = CLIP(0, levels, max_levels); + + return levels; } /* ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35635 - /branches/S2_6/server/citytools.c
Author: cazfi Date: Thu May 18 11:16:18 2017 New Revision: 35635 URL: http://svn.gna.org/viewcvs/freeciv?rev=35635=rev Log: Make sure veterancy of the newly built unit is not negative Reported by David Fernandez (bard) See hrm Bug #661193 Modified: branches/S2_6/server/citytools.c Modified: branches/S2_6/server/citytools.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/citytools.c?rev=35635=35634=35635=diff == --- branches/S2_6/server/citytools.c(original) +++ branches/S2_6/server/citytools.cThu May 18 11:16:18 2017 @@ -571,9 +571,13 @@ int do_make_unit_veteran(struct city *pcity, const struct unit_type *punittype) { - return MIN(get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, -EFT_VETERAN_BUILD), - utype_veteran_levels(punittype) - 1); + int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, + EFT_VETERAN_BUILD); + int max_levels = utype_veteran_levels(punittype) - 1; + + levels = CLIP(0, levels, max_levels); + + return levels; } /* ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35634 - /branches/S3_0/server/citytools.c
Author: cazfi Date: Thu May 18 11:16:11 2017 New Revision: 35634 URL: http://svn.gna.org/viewcvs/freeciv?rev=35634=rev Log: Make sure veterancy of the newly built unit is not negative Reported by David Fernandez (bard) See hrm Bug #661193 Modified: branches/S3_0/server/citytools.c Modified: branches/S3_0/server/citytools.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/citytools.c?rev=35634=35633=35634=diff == --- branches/S3_0/server/citytools.c(original) +++ branches/S3_0/server/citytools.cThu May 18 11:16:11 2017 @@ -571,9 +571,13 @@ int do_make_unit_veteran(struct city *pcity, const struct unit_type *punittype) { - return MIN(get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, -EFT_VETERAN_BUILD), - utype_veteran_levels(punittype) - 1); + int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, + EFT_VETERAN_BUILD); + int max_levels = utype_veteran_levels(punittype) - 1; + + levels = CLIP(0, levels, max_levels); + + return levels; } /* ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35633 - /trunk/server/citytools.c
Author: cazfi Date: Thu May 18 11:16:05 2017 New Revision: 35633 URL: http://svn.gna.org/viewcvs/freeciv?rev=35633=rev Log: Make sure veterancy of the newly built unit is not negative Reported by David Fernandez (bard) See hrm Bug #661193 Modified: trunk/server/citytools.c Modified: trunk/server/citytools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=35633=35632=35633=diff == --- trunk/server/citytools.c(original) +++ trunk/server/citytools.cThu May 18 11:16:05 2017 @@ -571,9 +571,13 @@ int do_make_unit_veteran(struct city *pcity, const struct unit_type *punittype) { - return MIN(get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, -EFT_VETERAN_BUILD), - utype_veteran_levels(punittype) - 1); + int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, + EFT_VETERAN_BUILD); + int max_levels = utype_veteran_levels(punittype) - 1; + + levels = CLIP(0, levels, max_levels); + + return levels; } /* ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35632 - /branches/S2_5/common/unit.c
Author: cazfi Date: Thu May 18 11:03:06 2017 New Revision: 35632 URL: http://svn.gna.org/viewcvs/freeciv?rev=35632=rev Log: Fix division by zero when unit activity rate is zero Reported by David Fernandez (bard) See hrm Bug #660342 Modified: branches/S2_5/common/unit.c Modified: branches/S2_5/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unit.c?rev=35632=35631=35632=diff == --- branches/S2_5/common/unit.c (original) +++ branches/S2_5/common/unit.c Thu May 18 11:03:06 2017 @@ -606,15 +606,15 @@ already done by this unit. **/ int get_turns_for_activity_at(const struct unit *punit, - enum unit_activity activity, - const struct tile *ptile) + enum unit_activity activity, + const struct tile *ptile) { /* FIXME: This is just an approximation since we don't account for * get_activity_rate_this_turn. */ int speed = get_activity_rate(punit); int time = tile_activity_time(activity, ptile); - if (time >= 0 && speed >= 0) { + if (time >= 0 && speed > 0) { return (time - 1) / speed + 1; /* round up */ } else { return FC_INFINITY; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35630 - /branches/S3_0/common/unit.c
Author: cazfi Date: Thu May 18 11:02:52 2017 New Revision: 35630 URL: http://svn.gna.org/viewcvs/freeciv?rev=35630=rev Log: Fix division by zero when unit activity rate is zero Reported by David Fernandez (bard) See hrm Bug #660342 Modified: branches/S3_0/common/unit.c Modified: branches/S3_0/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/unit.c?rev=35630=35629=35630=diff == --- branches/S3_0/common/unit.c (original) +++ branches/S3_0/common/unit.c Thu May 18 11:02:52 2017 @@ -414,8 +414,8 @@ already done by this unit. **/ int get_turns_for_activity_at(const struct unit *punit, - enum unit_activity activity, - const struct tile *ptile, + enum unit_activity activity, + const struct tile *ptile, struct extra_type *tgt) { /* FIXME: This is just an approximation since we don't account for @@ -423,7 +423,7 @@ int speed = get_activity_rate(punit); int points_needed = tile_activity_time(activity, ptile, tgt); - if (points_needed >= 0 && speed >= 0) { + if (points_needed >= 0 && speed > 0) { return (points_needed - 1) / speed + 1; /* round up */ } else { return FC_INFINITY; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35631 - /branches/S2_6/common/unit.c
Author: cazfi Date: Thu May 18 11:02:58 2017 New Revision: 35631 URL: http://svn.gna.org/viewcvs/freeciv?rev=35631=rev Log: Fix division by zero when unit activity rate is zero Reported by David Fernandez (bard) See hrm Bug #660342 Modified: branches/S2_6/common/unit.c Modified: branches/S2_6/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/unit.c?rev=35631=35630=35631=diff == --- branches/S2_6/common/unit.c (original) +++ branches/S2_6/common/unit.c Thu May 18 11:02:58 2017 @@ -504,8 +504,8 @@ already done by this unit. **/ int get_turns_for_activity_at(const struct unit *punit, - enum unit_activity activity, - const struct tile *ptile, + enum unit_activity activity, + const struct tile *ptile, struct extra_type *tgt) { /* FIXME: This is just an approximation since we don't account for @@ -513,7 +513,7 @@ int speed = get_activity_rate(punit); int points_needed = tile_activity_time(activity, ptile, tgt); - if (points_needed >= 0 && speed >= 0) { + if (points_needed >= 0 && speed > 0) { return (points_needed - 1) / speed + 1; /* round up */ } else { return FC_INFINITY; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35629 - /trunk/common/unit.c
Author: cazfi Date: Thu May 18 11:02:44 2017 New Revision: 35629 URL: http://svn.gna.org/viewcvs/freeciv?rev=35629=rev Log: Fix division by zero when unit activity rate is zero Reported by David Fernandez (bard) See hrm Bug #660342 Modified: trunk/common/unit.c Modified: trunk/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=35629=35628=35629=diff == --- trunk/common/unit.c (original) +++ trunk/common/unit.c Thu May 18 11:02:44 2017 @@ -415,8 +415,8 @@ already done by this unit. **/ int get_turns_for_activity_at(const struct unit *punit, - enum unit_activity activity, - const struct tile *ptile, + enum unit_activity activity, + const struct tile *ptile, struct extra_type *tgt) { /* FIXME: This is just an approximation since we don't account for @@ -424,7 +424,7 @@ int speed = get_activity_rate(punit); int points_needed = tile_activity_time(activity, ptile, tgt); - if (points_needed >= 0 && speed >= 0) { + if (points_needed >= 0 && speed > 0) { return (points_needed - 1) / speed + 1; /* round up */ } else { return FC_INFINITY; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits