[Freeciv-commits] r35498 - /branches/S3_0/tools/ruledit/validity.c
Author: cazfi Date: Wed May 10 21:14:51 2017 New Revision: 35498 URL: http://svn.gna.org/viewcvs/freeciv?rev=35498=rev Log: Consider extra, that is visibility_req of another one, needed See hrm Bug #658575 Modified: branches/S3_0/tools/ruledit/validity.c Modified: branches/S3_0/tools/ruledit/validity.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/ruledit/validity.c?rev=35498=35497=35498=diff == --- branches/S3_0/tools/ruledit/validity.c (original) +++ branches/S3_0/tools/ruledit/validity.c Wed May 10 21:14:51 2017 @@ -190,6 +190,16 @@ } } unit_type_iterate_end; + extra_type_iterate(pextra) { +if (pextra->visibility_req == advance_number(padv)) { + char buf[512]; + + fc_snprintf(buf, sizeof(buf), "%s visibility", + extra_rule_name(pextra)); + cb(buf, data); +} + } extra_type_iterate_end; + needed |= is_universal_needed(, cb, data); return needed; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35497 - /trunk/tools/ruledit/validity.c
Author: cazfi Date: Wed May 10 21:14:43 2017 New Revision: 35497 URL: http://svn.gna.org/viewcvs/freeciv?rev=35497=rev Log: Consider extra, that is visibility_req of another one, needed See hrm Bug #658575 Modified: trunk/tools/ruledit/validity.c Modified: trunk/tools/ruledit/validity.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/validity.c?rev=35497=35496=35497=diff == --- trunk/tools/ruledit/validity.c (original) +++ trunk/tools/ruledit/validity.c Wed May 10 21:14:43 2017 @@ -190,6 +190,16 @@ } } unit_type_iterate_end; + extra_type_iterate(pextra) { +if (pextra->visibility_req == advance_number(padv)) { + char buf[512]; + + fc_snprintf(buf, sizeof(buf), "%s visibility", + extra_rule_name(pextra)); + cb(buf, data); +} + } extra_type_iterate_end; + needed |= is_universal_needed(, cb, data); return needed; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35496 - /trunk/tools/ruledit/
Author: cazfi Date: Wed May 10 18:55:59 2017 New Revision: 35496 URL: http://svn.gna.org/viewcvs/freeciv?rev=35496=rev Log: Add initial version of effect edit dialog to ruledit See hrm Feature #658566 Added: trunk/tools/ruledit/effect_edit.cpp trunk/tools/ruledit/effect_edit.h Modified: trunk/tools/ruledit/Makefile.am trunk/tools/ruledit/tab_building.cpp trunk/tools/ruledit/tab_building.h trunk/tools/ruledit/validity.c trunk/tools/ruledit/validity.h Modified: trunk/tools/ruledit/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/Makefile.am?rev=35496=35495=35496=diff == --- trunk/tools/ruledit/Makefile.am (original) +++ trunk/tools/ruledit/Makefile.am Wed May 10 18:55:59 2017 @@ -25,6 +25,7 @@ MOC_FILES = \ meta_edit_utype.cpp \ + meta_effect_edit.cpp \ meta_req_edit.cpp \ meta_requirers_dlg.cpp \ meta_ruledit_qt.cpp \ @@ -42,6 +43,8 @@ freeciv_ruledit_SOURCES = \ edit_utype.cpp \ edit_utype.h\ + effect_edit.cpp \ + effect_edit.h \ tab_building.cpp \ tab_building.h \ tab_enablers.cpp \ Added: trunk/tools/ruledit/effect_edit.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/effect_edit.cpp?rev=35496=auto == --- trunk/tools/ruledit/effect_edit.cpp (added) +++ trunk/tools/ruledit/effect_edit.cpp Wed May 10 18:55:59 2017 @@ -0,0 +1,203 @@ +/*** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +// Qt +#include +#include +#include +#include +#include + +// utility +#include "fcintl.h" + +// common +#include "effects.h" + +// ruledit +#include "ruledit.h" +#include "validity.h" + +#include "effect_edit.h" + +/** + Setup effect_edit object +**/ +effect_edit::effect_edit(ruledit_gui *ui_in, QString target, + struct universal *filter_in) : QDialog() +{ + QVBoxLayout *main_layout = new QVBoxLayout(this); + QGridLayout *effect_edit_layout = new QGridLayout(); + QHBoxLayout *active_layout = new QHBoxLayout(); + QPushButton *close_button; + QMenu *menu; + QLabel *lbl; + enum effect_type eff; + + ui = ui_in; + selected = nullptr; + filter = *filter_in; + + list_widget = new QListWidget(this); + effects = effect_list_new(); + + connect(list_widget, SIGNAL(itemSelectionChanged()), this, SLOT(select_effect())); + main_layout->addWidget(list_widget); + + lbl = new QLabel(R__("Type:")); + active_layout->addWidget(lbl, 0, 0); + edit_type_button = new QToolButton(); + menu = new QMenu(); + edit_type_button->setToolButtonStyle(Qt::ToolButtonTextOnly); + edit_type_button->setPopupMode(QToolButton::MenuButtonPopup); + connect(menu, SIGNAL(triggered(QAction *)), this, SLOT(effect_type_menu(QAction *))); + edit_type_button->setMenu(menu); + for (eff = (enum effect_type)0; eff < EFT_COUNT; + eff = (enum effect_type)(eff + 1)) { +menu->addAction(effect_type_name(eff)); + } + active_layout->addWidget(edit_type_button, 1, 0); + + main_layout->addLayout(active_layout); + + close_button = new QPushButton(QString::fromUtf8(R__("Close")), this); + connect(close_button, SIGNAL(pressed()), this, SLOT(close_now())); + effect_edit_layout->addWidget(close_button, 0, 0); + + refresh(); + + main_layout->addLayout(effect_edit_layout); + + setLayout(main_layout); + setWindowTitle(target); +} + +/** + Effect edit destructor +**/ +effect_edit::~effect_edit() +{ + effect_list_destroy(effects); +} + +/** + Callback to fill effects list from iterate_effect_cache() +**/ +static bool effect_list_fill_cb(struct effect *peffect, void *data) +{ + struct
[Freeciv-commits] r35493 - in /branches/S3_0: ai/default/aitools.c server/advisors/advgoto.c
Author: cazfi Date: Wed May 10 17:38:55 2017 New Revision: 35493 URL: http://svn.gna.org/viewcvs/freeciv?rev=35493=rev Log: Avoid double map_move_cost_unit() See hrm Feature #658612 Modified: branches/S3_0/ai/default/aitools.c branches/S3_0/server/advisors/advgoto.c Modified: branches/S3_0/ai/default/aitools.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/aitools.c?rev=35493=35492=35493=diff == --- branches/S3_0/ai/default/aitools.c (original) +++ branches/S3_0/ai/default/aitools.c Wed May 10 17:38:55 2017 @@ -916,6 +916,7 @@ int sanity = punit->id; struct player *pplayer = unit_owner(punit); const bool is_plr_ai = is_ai(pplayer); + int mcost; CHECK_UNIT(punit); fc_assert_ret_val_msg(is_tiles_adjacent(unit_tile(punit), ptile), FALSE, @@ -948,8 +949,9 @@ } /* Try not to end move next to an enemy if we can avoid it by waiting */ - if (punit->moves_left <= map_move_cost_unit(punit, ptile) - && unit_move_rate(punit) > map_move_cost_unit(punit, ptile) + mcost = map_move_cost_unit(punit, ptile); + if (punit->moves_left <= mcost + && unit_move_rate(punit) > mcost && adv_danger_at(punit, ptile) && !adv_danger_at(punit, unit_tile(punit))) { UNIT_LOG(LOG_DEBUG, punit, "ending move early to stay out of trouble"); Modified: branches/S3_0/server/advisors/advgoto.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/advisors/advgoto.c?rev=35493=35492=35493=diff == --- branches/S3_0/server/advisors/advgoto.c (original) +++ branches/S3_0/server/advisors/advgoto.c Wed May 10 17:38:55 2017 @@ -129,6 +129,7 @@ static bool adv_unit_move(struct unit *punit, struct tile *ptile) { struct player *pplayer = unit_owner(punit); + int mcost; /* if enemy, stop and give a chance for the human player to handle this case */ @@ -139,8 +140,9 @@ } /* Try not to end move next to an enemy if we can avoid it by waiting */ - if (punit->moves_left <= map_move_cost_unit(punit, ptile) - && unit_move_rate(punit) > map_move_cost_unit(punit, ptile) + mcost = map_move_cost_unit(punit, ptile); + if (punit->moves_left <= mcost + && unit_move_rate(punit) > mcost && adv_danger_at(punit, ptile) && !adv_danger_at(punit, unit_tile(punit))) { UNIT_LOG(LOG_DEBUG, punit, "ending move early to stay out of trouble"); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35495 - in /branches/S2_5: ai/default/aitools.c server/advisors/advgoto.c
Author: cazfi Date: Wed May 10 17:39:07 2017 New Revision: 35495 URL: http://svn.gna.org/viewcvs/freeciv?rev=35495=rev Log: Avoid double map_move_cost_unit() See hrm Feature #658612 Modified: branches/S2_5/ai/default/aitools.c branches/S2_5/server/advisors/advgoto.c Modified: branches/S2_5/ai/default/aitools.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/ai/default/aitools.c?rev=35495=35494=35495=diff == --- branches/S2_5/ai/default/aitools.c (original) +++ branches/S2_5/ai/default/aitools.c Wed May 10 17:39:07 2017 @@ -951,6 +951,7 @@ int sanity = punit->id; struct player *pplayer = unit_owner(punit); const bool is_ai = pplayer->ai_controlled; + int mcost; CHECK_UNIT(punit); fc_assert_ret_val_msg(is_tiles_adjacent(unit_tile(punit), ptile), FALSE, @@ -983,8 +984,9 @@ } /* Try not to end move next to an enemy if we can avoid it by waiting */ - if (punit->moves_left <= map_move_cost_unit(punit, ptile) - && unit_move_rate(punit) > map_move_cost_unit(punit, ptile) + mcost = map_move_cost_unit(punit, ptile); + if (punit->moves_left <= mcost + && unit_move_rate(punit) > mcost && adv_danger_at(punit, ptile) && !adv_danger_at(punit, unit_tile(punit))) { UNIT_LOG(LOG_DEBUG, punit, "ending move early to stay out of trouble"); Modified: branches/S2_5/server/advisors/advgoto.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/advisors/advgoto.c?rev=35495=35494=35495=diff == --- branches/S2_5/server/advisors/advgoto.c (original) +++ branches/S2_5/server/advisors/advgoto.c Wed May 10 17:39:07 2017 @@ -129,6 +129,7 @@ static bool adv_unit_move(struct unit *punit, struct tile *ptile) { struct player *pplayer = unit_owner(punit); + int mcost; /* if enemy, stop and give a chance for the human player to handle this case */ @@ -139,8 +140,9 @@ } /* Try not to end move next to an enemy if we can avoid it by waiting */ - if (punit->moves_left <= map_move_cost_unit(punit, ptile) - && unit_move_rate(punit) > map_move_cost_unit(punit, ptile) + mcost = map_move_cost_unit(punit, ptile); + if (punit->moves_left <= mcost + && unit_move_rate(punit) > mcost && adv_danger_at(punit, ptile) && !adv_danger_at(punit, unit_tile(punit))) { UNIT_LOG(LOG_DEBUG, punit, "ending move early to stay out of trouble"); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35494 - in /branches/S2_6: ai/default/aitools.c server/advisors/advgoto.c
Author: cazfi Date: Wed May 10 17:39:01 2017 New Revision: 35494 URL: http://svn.gna.org/viewcvs/freeciv?rev=35494=rev Log: Avoid double map_move_cost_unit() See hrm Feature #658612 Modified: branches/S2_6/ai/default/aitools.c branches/S2_6/server/advisors/advgoto.c Modified: branches/S2_6/ai/default/aitools.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/aitools.c?rev=35494=35493=35494=diff == --- branches/S2_6/ai/default/aitools.c (original) +++ branches/S2_6/ai/default/aitools.c Wed May 10 17:39:01 2017 @@ -880,6 +880,7 @@ int sanity = punit->id; struct player *pplayer = unit_owner(punit); const bool is_ai = pplayer->ai_controlled; + int mcost; CHECK_UNIT(punit); fc_assert_ret_val_msg(is_tiles_adjacent(unit_tile(punit), ptile), FALSE, @@ -912,8 +913,9 @@ } /* Try not to end move next to an enemy if we can avoid it by waiting */ - if (punit->moves_left <= map_move_cost_unit(punit, ptile) - && unit_move_rate(punit) > map_move_cost_unit(punit, ptile) + mcost = map_move_cost_unit(punit, ptile); + if (punit->moves_left <= mcost + && unit_move_rate(punit) > mcost && adv_danger_at(punit, ptile) && !adv_danger_at(punit, unit_tile(punit))) { UNIT_LOG(LOG_DEBUG, punit, "ending move early to stay out of trouble"); Modified: branches/S2_6/server/advisors/advgoto.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/advisors/advgoto.c?rev=35494=35493=35494=diff == --- branches/S2_6/server/advisors/advgoto.c (original) +++ branches/S2_6/server/advisors/advgoto.c Wed May 10 17:39:01 2017 @@ -129,6 +129,7 @@ static bool adv_unit_move(struct unit *punit, struct tile *ptile) { struct player *pplayer = unit_owner(punit); + int mcost; /* if enemy, stop and give a chance for the human player to handle this case */ @@ -139,8 +140,9 @@ } /* Try not to end move next to an enemy if we can avoid it by waiting */ - if (punit->moves_left <= map_move_cost_unit(punit, ptile) - && unit_move_rate(punit) > map_move_cost_unit(punit, ptile) + mcost = map_move_cost_unit(punit, ptile); + if (punit->moves_left <= mcost + && unit_move_rate(punit) > mcost && adv_danger_at(punit, ptile) && !adv_danger_at(punit, unit_tile(punit))) { UNIT_LOG(LOG_DEBUG, punit, "ending move early to stay out of trouble"); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35492 - in /trunk: ai/default/aitools.c server/advisors/advgoto.c
Author: cazfi Date: Wed May 10 17:38:47 2017 New Revision: 35492 URL: http://svn.gna.org/viewcvs/freeciv?rev=35492=rev Log: Avoid double map_move_cost_unit() See hrm Feature #658612 Modified: trunk/ai/default/aitools.c trunk/server/advisors/advgoto.c Modified: trunk/ai/default/aitools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aitools.c?rev=35492=35491=35492=diff == --- trunk/ai/default/aitools.c (original) +++ trunk/ai/default/aitools.c Wed May 10 17:38:47 2017 @@ -916,6 +916,7 @@ int sanity = punit->id; struct player *pplayer = unit_owner(punit); const bool is_plr_ai = is_ai(pplayer); + int mcost; CHECK_UNIT(punit); fc_assert_ret_val_msg(is_tiles_adjacent(unit_tile(punit), ptile), FALSE, @@ -948,8 +949,9 @@ } /* Try not to end move next to an enemy if we can avoid it by waiting */ - if (punit->moves_left <= map_move_cost_unit(punit, ptile) - && unit_move_rate(punit) > map_move_cost_unit(punit, ptile) + mcost = map_move_cost_unit(punit, ptile); + if (punit->moves_left <= mcost + && unit_move_rate(punit) > mcost && adv_danger_at(punit, ptile) && !adv_danger_at(punit, unit_tile(punit))) { UNIT_LOG(LOG_DEBUG, punit, "ending move early to stay out of trouble"); Modified: trunk/server/advisors/advgoto.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/advisors/advgoto.c?rev=35492=35491=35492=diff == --- trunk/server/advisors/advgoto.c (original) +++ trunk/server/advisors/advgoto.c Wed May 10 17:38:47 2017 @@ -129,6 +129,7 @@ static bool adv_unit_move(struct unit *punit, struct tile *ptile) { struct player *pplayer = unit_owner(punit); + int mcost; /* if enemy, stop and give a chance for the human player to handle this case */ @@ -139,8 +140,9 @@ } /* Try not to end move next to an enemy if we can avoid it by waiting */ - if (punit->moves_left <= map_move_cost_unit(punit, ptile) - && unit_move_rate(punit) > map_move_cost_unit(punit, ptile) + mcost = map_move_cost_unit(punit, ptile); + if (punit->moves_left <= mcost + && unit_move_rate(punit) > mcost && adv_danger_at(punit, ptile) && !adv_danger_at(punit, unit_tile(punit))) { UNIT_LOG(LOG_DEBUG, punit, "ending move early to stay out of trouble"); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35491 - /branches/S2_5/data/nation/newfoundland.ruleset
Author: cazfi Date: Wed May 10 17:08:28 2017 New Revision: 35491 URL: http://svn.gna.org/viewcvs/freeciv?rev=35491=rev Log: Fix typo in the name of Grand Falls-Windsor Reported by Michael Neil See hrm Bug #658528 Modified: branches/S2_5/data/nation/newfoundland.ruleset Modified: branches/S2_5/data/nation/newfoundland.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/nation/newfoundland.ruleset?rev=35491=35490=35491=diff == --- branches/S2_5/data/nation/newfoundland.ruleset (original) +++ branches/S2_5/data/nation/newfoundland.ruleset Wed May 10 17:08:28 2017 @@ -45,7 +45,7 @@ cities = "St. John's", "Corner Brook", - "Grand Galls-Windsor", + "Grand Falls-Windsor", "Bay Roberts", "Gander", "Labrador City", ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35490 - /branches/S2_6/data/nation/newfoundland.ruleset
Author: cazfi Date: Wed May 10 17:08:22 2017 New Revision: 35490 URL: http://svn.gna.org/viewcvs/freeciv?rev=35490=rev Log: Fix typo in the name of Grand Falls-Windsor Reported by Michael Neil See hrm Bug #658528 Modified: branches/S2_6/data/nation/newfoundland.ruleset Modified: branches/S2_6/data/nation/newfoundland.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/nation/newfoundland.ruleset?rev=35490=35489=35490=diff == --- branches/S2_6/data/nation/newfoundland.ruleset (original) +++ branches/S2_6/data/nation/newfoundland.ruleset Wed May 10 17:08:22 2017 @@ -45,7 +45,7 @@ cities = "St. John's", "Corner Brook", - "Grand Galls-Windsor", + "Grand Falls-Windsor", "Bay Roberts", "Gander", "Labrador City", ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35489 - /branches/S3_0/data/nation/newfoundland.ruleset
Author: cazfi Date: Wed May 10 17:08:15 2017 New Revision: 35489 URL: http://svn.gna.org/viewcvs/freeciv?rev=35489=rev Log: Fix typo in the name of Grand Falls-Windsor Reported by Michael Neil See hrm Bug #658528 Modified: branches/S3_0/data/nation/newfoundland.ruleset Modified: branches/S3_0/data/nation/newfoundland.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/nation/newfoundland.ruleset?rev=35489=35488=35489=diff == --- branches/S3_0/data/nation/newfoundland.ruleset (original) +++ branches/S3_0/data/nation/newfoundland.ruleset Wed May 10 17:08:15 2017 @@ -45,7 +45,7 @@ cities = "St. John's", "Corner Brook", - "Grand Galls-Windsor", + "Grand Falls-Windsor", "Bay Roberts", "Gander", "Labrador City", ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35488 - /trunk/data/nation/newfoundland.ruleset
Author: cazfi Date: Wed May 10 17:08:09 2017 New Revision: 35488 URL: http://svn.gna.org/viewcvs/freeciv?rev=35488=rev Log: Fix typo in the name of Grand Falls-Windsor Reported by Michael Neil See hrm Bug #658528 Modified: trunk/data/nation/newfoundland.ruleset Modified: trunk/data/nation/newfoundland.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/nation/newfoundland.ruleset?rev=35488=35487=35488=diff == --- trunk/data/nation/newfoundland.ruleset (original) +++ trunk/data/nation/newfoundland.ruleset Wed May 10 17:08:09 2017 @@ -45,7 +45,7 @@ cities = "St. John's", "Corner Brook", - "Grand Galls-Windsor", + "Grand Falls-Windsor", "Bay Roberts", "Gander", "Labrador City", ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35487 - /branches/S2_5/client/gui-gtk-3.0/unitselect.c
Author: sveinung Date: Wed May 10 10:19:54 2017 New Revision: 35487 URL: http://svn.gna.org/viewcvs/freeciv?rev=35487=rev Log: unitselect: don't initialize pix twice. This fixes a memory leak. (Detectable with Valgrind.) Reported by Marko Lindqvist See gna bug #25246 Modified: branches/S2_5/client/gui-gtk-3.0/unitselect.c Modified: branches/S2_5/client/gui-gtk-3.0/unitselect.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/unitselect.c?rev=35487=35486=35487=diff == --- branches/S2_5/client/gui-gtk-3.0/unitselect.c (original) +++ branches/S2_5/client/gui-gtk-3.0/unitselect.c Wed May 10 10:19:54 2017 @@ -690,10 +690,6 @@ gtk_tree_store_append(GTK_TREE_STORE(store), it, NULL); /* Create a icon */ - pix = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, - tileset_full_tile_width(tileset), - tileset_full_tile_height(tileset)); - { struct canvas canvas_store = FC_STATIC_CANVAS_INIT; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35486 - /branches/S2_6/server/ruleset.c
Author: sveinung Date: Wed May 10 10:19:17 2017 New Revision: 35486 URL: http://svn.gna.org/viewcvs/freeciv?rev=35486=rev Log: Destroy the rs section list of achievements. Destroy the section list used to load achievements from the ruleset. Reported by Valgrind. See hrm Bug #658472 Modified: branches/S2_6/server/ruleset.c Modified: branches/S2_6/server/ruleset.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/ruleset.c?rev=35486=35485=35486=diff == --- branches/S2_6/server/ruleset.c (original) +++ branches/S2_6/server/ruleset.c Wed May 10 10:19:17 2017 @@ -5884,6 +5884,7 @@ break; } } achievements_iterate_end; +section_list_destroy(sec); } if (ok) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35485 - in /branches/S3_0/data/webperimental: buildings.ruleset effects.ruleset game.ruleset
Author: sveinung Date: Wed May 10 10:18:06 2017 New Revision: 35485 URL: http://svn.gna.org/viewcvs/freeciv?rev=35485=rev Log: webperimental: ally share Sun Tzu's War Academy. Make Sun Tzu's War Academy give its veteran bonus (combat and production) to both its owner and to all his allies. See hrm Feature #658515 Modified: branches/S3_0/data/webperimental/buildings.ruleset branches/S3_0/data/webperimental/effects.ruleset branches/S3_0/data/webperimental/game.ruleset Modified: branches/S3_0/data/webperimental/buildings.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/webperimental/buildings.ruleset?rev=35485=35484=35485=diff == --- branches/S3_0/data/webperimental/buildings.ruleset (original) +++ branches/S3_0/data/webperimental/buildings.ruleset Wed May 10 10:18:06 2017 @@ -1727,7 +1727,8 @@ sound = "w_sun_tzus_war_academy" sound_alt = "w_generic" helptext = _("\ -All your new military land units start with an additional veteran level\ +All new military land units belonging to you or to your allies start with \ +an additional veteran level\ (this is cumulative with any Barracks building in a city; with both, units\ are created as Hardened). The chance of a land unit getting the next\ veteran level after a battle increases by half.\ Modified: branches/S3_0/data/webperimental/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/webperimental/effects.ruleset?rev=35485=35484=35485=diff == --- branches/S3_0/data/webperimental/effects.ruleset(original) +++ branches/S3_0/data/webperimental/effects.rulesetWed May 10 10:18:06 2017 @@ -2145,7 +2145,7 @@ value = 1 reqs = { "type", "name", "range", "present" - "Building", "Sun Tzu's War Academy", "Player", TRUE + "Building", "Sun Tzu's War Academy", "Alliance", TRUE "UnitClass", "Land", "Local", TRUE "UnitFlag", "NonMil", "Local", FALSE "UnitFlag", "NoVeteran", "Local", FALSE @@ -2156,7 +2156,7 @@ value = 50 reqs = { "type", "name", "range", "present" - "Building", "Sun Tzu's War Academy", "Player", TRUE + "Building", "Sun Tzu's War Academy", "Alliance", TRUE "UnitClass", "Land", "Local", TRUE "UnitFlag", "Diplomat", "Local", FALSE } Modified: branches/S3_0/data/webperimental/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/webperimental/game.ruleset?rev=35485=35484=35485=diff == --- branches/S3_0/data/webperimental/game.ruleset (original) +++ branches/S3_0/data/webperimental/game.ruleset Wed May 10 10:18:06 2017 @@ -91,7 +91,10 @@ - Railroads can't be used by enemy units by default. Regular roads can be \ used by the enemy even if the restrictinfra server setting is enabled. \ (The restrictinfra server setting is enabled by default.)\n\ -- Caravan and Freight can help allies to complete wonders.\n\ +- An alliance has more in game consequences:\n\ + - Caravan and Freight can help allies to complete wonders.\n\ + - Sun Tzu's War Academy gives its veteran bonus (combat and production) \ +to both its owner and to all his allies.\n\ \n\ This ruleset is still in development. If playing it makes you think that \ a rule should change go to the Freeciv-web board at \ ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35482 - /branches/S3_0/common/networking/dataio_json.c
Author: sveinung Date: Wed May 10 10:17:36 2017 New Revision: 35482 URL: http://svn.gna.org/viewcvs/freeciv?rev=35482=rev Log: JSON protocol: make estring reading more careful. See hrm Feature #658458 Modified: branches/S3_0/common/networking/dataio_json.c Modified: branches/S3_0/common/networking/dataio_json.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/networking/dataio_json.c?rev=35482=35481=35482=diff == --- branches/S3_0/common/networking/dataio_json.c (original) +++ branches/S3_0/common/networking/dataio_json.c Wed May 10 10:17:36 2017 @@ -946,11 +946,16 @@ FC_FREE(escaped_value); /* Copy the unescaped value so CURL can free its own copy. */ - memcpy(dest, unescaped_value, max_dest_size); + memcpy(dest, unescaped_value, + /* Don't copy the memory following unescaped_value. */ + MIN(max_dest_size, strlen(unescaped_value) + 1)); /* CURL's memory management wants to free this it self. */ curl_free(unescaped_value); + /* Make sure that the string is terminated. */ + dest[max_dest_size - 1] = '\0'; + return TRUE; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35483 - /branches/S3_0/server/ruleset.c
Author: sveinung Date: Wed May 10 10:17:45 2017 New Revision: 35483 URL: http://svn.gna.org/viewcvs/freeciv?rev=35483=rev Log: Destroy the rs section list of achievements. Destroy the section list used to load achievements from the ruleset. Reported by Valgrind. See hrm Bug #658472 Modified: branches/S3_0/server/ruleset.c Modified: branches/S3_0/server/ruleset.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/ruleset.c?rev=35483=35482=35483=diff == --- branches/S3_0/server/ruleset.c (original) +++ branches/S3_0/server/ruleset.c Wed May 10 10:17:45 2017 @@ -6648,6 +6648,7 @@ break; } } achievements_iterate_end; +section_list_destroy(sec); } if (ok) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35481 - /branches/S3_0/common/networking/dataio_json.c
Author: sveinung Date: Wed May 10 10:17:15 2017 New Revision: 35481 URL: http://svn.gna.org/viewcvs/freeciv?rev=35481=rev Log: JSON protocol: fix sub field sending memory leak. Steal the references to values created inline when put inside an object by using json_object_set_new() rather than json_object_set(). Reported by Andreas Røsdal See hrm Bug #658386 Modified: branches/S3_0/common/networking/dataio_json.c Modified: branches/S3_0/common/networking/dataio_json.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/networking/dataio_json.c?rev=35481=35480=35481=diff == --- branches/S3_0/common/networking/dataio_json.c (original) +++ branches/S3_0/common/networking/dataio_json.c Wed May 10 10:17:15 2017 @@ -239,9 +239,9 @@ location->sub_location->number = i; -json_object_set(universal, "kind", json_integer(pcp->kind)); -json_object_set(universal, "value", -json_integer(universal_number(pcp))); +json_object_set_new(universal, "kind", json_integer(pcp->kind)); +json_object_set_new(universal, "value", +json_integer(universal_number(pcp))); plocation_write_data(dout->json, location, universal); } @@ -708,14 +708,14 @@ /* Write the requirement values to the fields of the requirement * object. */ - json_object_set(requirement, "kind", json_integer(kind)); - json_object_set(requirement, "value", json_integer(value)); - - json_object_set(requirement, "range", json_integer(range)); - - json_object_set(requirement, "survives", json_boolean(survives)); - json_object_set(requirement, "present", json_boolean(present)); - json_object_set(requirement, "quiet", json_boolean(quiet)); + json_object_set_new(requirement, "kind", json_integer(kind)); + json_object_set_new(requirement, "value", json_integer(value)); + + json_object_set_new(requirement, "range", json_integer(range)); + + json_object_set_new(requirement, "survives", json_boolean(survives)); + json_object_set_new(requirement, "present", json_boolean(present)); + json_object_set_new(requirement, "quiet", json_boolean(quiet)); /* Put the requirement object in the packet. */ plocation_write_data(dout->json, location, requirement); @@ -733,8 +733,8 @@ /* Write the action probability values to the fields of the action * probability object. */ - json_object_set(action_probability, "min", json_integer(prob->min)); - json_object_set(action_probability, "max", json_integer(prob->max)); + json_object_set_new(action_probability, "min", json_integer(prob->min)); + json_object_set_new(action_probability, "max", json_integer(prob->max)); /* Put the action probability object in the packet. */ plocation_write_data(dout->json, location, action_probability); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35484 - /branches/S3_0/server/ruleset.c
Author: sveinung Date: Wed May 10 10:17:53 2017 New Revision: 35484 URL: http://svn.gna.org/viewcvs/freeciv?rev=35484=rev Log: Destroy the rs section list of goods. Destroy the section list used to load goods from the ruleset. Reported by Valgrind. See hrm Bug #658475 Modified: branches/S3_0/server/ruleset.c Modified: branches/S3_0/server/ruleset.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/ruleset.c?rev=35484=35483=35484=diff == --- branches/S3_0/server/ruleset.c (original) +++ branches/S3_0/server/ruleset.c Wed May 10 10:17:53 2017 @@ -1092,6 +1092,7 @@ } } goods_type_iterate_end; } + section_list_destroy(sec); } } @@ -6753,6 +6754,7 @@ pgood->helptext = lookup_strvec(file, sec_name, "helptext"); } goods_type_iterate_end; + section_list_destroy(sec); } } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35479 - /branches/S3_0/data/webperimental/game.ruleset
Author: sveinung Date: Wed May 10 10:16:50 2017 New Revision: 35479 URL: http://svn.gna.org/viewcvs/freeciv?rev=35479=rev Log: webperimental: allow allied build wonder help. See hrm Feature #658361 Modified: branches/S3_0/data/webperimental/game.ruleset Modified: branches/S3_0/data/webperimental/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/webperimental/game.ruleset?rev=35479=35478=35479=diff == --- branches/S3_0/data/webperimental/game.ruleset (original) +++ branches/S3_0/data/webperimental/game.ruleset Wed May 10 10:16:50 2017 @@ -91,6 +91,7 @@ - Railroads can't be used by enemy units by default. Regular roads can be \ used by the enemy even if the restrictinfra server setting is enabled. \ (The restrictinfra server setting is enabled by default.)\n\ +- Caravan and Freight can help allies to complete wonders.\n\ \n\ This ruleset is still in development. If playing it makes you think that \ a rule should change go to the Freeciv-web board at \ @@ -645,9 +646,12 @@ [actionenabler_help_build_wonder] action = "Help Wonder" actor_reqs= -{ "type", "name", "range", "present" +{ "type", "name", "range", "present" "UnitFlag", "HelpWonder", "Local", TRUE - "DiplRel", "Is foreign", "Local", FALSE + "DiplRel", "Armistice", "Local", FALSE + "DiplRel", "War","Local", FALSE + "DiplRel", "Cease-fire", "Local", FALSE + "DiplRel", "Peace", "Local", FALSE } target_reqs= { "type", "name", "range" @@ -657,9 +661,12 @@ [actionenabler_help_build_small_wonder] action = "Help Wonder" actor_reqs= -{ "type", "name", "range", "present" +{ "type", "name", "range", "present" "UnitFlag", "HelpWonder", "Local", TRUE - "DiplRel", "Is foreign", "Local", FALSE + "DiplRel", "Armistice", "Local", FALSE + "DiplRel", "War","Local", FALSE + "DiplRel", "Cease-fire", "Local", FALSE + "DiplRel", "Peace", "Local", FALSE } target_reqs= { "type", "name", "range" ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35480 - in /branches/S3_0/common: generate_packets.py networking/dataio_json.c networking/packets_json.h
Author: sveinung Date: Wed May 10 10:17:01 2017 New Revision: 35480 URL: http://svn.gna.org/viewcvs/freeciv?rev=35480=rev Log: JSON protocol: fix field_addr memory leak. Don't leak the memory where a packet's field address is stored. Reported by Andreas Røsdal See hrm Bug #658389 Modified: branches/S3_0/common/generate_packets.py branches/S3_0/common/networking/dataio_json.c branches/S3_0/common/networking/packets_json.h Modified: branches/S3_0/common/generate_packets.py URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/generate_packets.py?rev=35480=35479=35480=diff == --- branches/S3_0/common/generate_packets.py(original) +++ branches/S3_0/common/generate_packets.pyWed May 10 10:17:01 2017 @@ -1064,7 +1064,12 @@ if len(self.fields) != 0: faddr = '''#ifdef FREECIV_JSON_CONNECTION - struct plocation field_addr = *plocation_field_new(NULL); + struct plocation field_addr; + { +struct plocation *field_addr_tmp = plocation_field_new(NULL); +field_addr = *field_addr_tmp; +FC_FREE(field_addr_tmp); + } #endif /* FREECIV_JSON_CONNECTION */ ''' else: @@ -1200,7 +1205,12 @@ if len(self.fields) != 0: faddr = '''#ifdef FREECIV_JSON_CONNECTION - struct plocation field_addr = *plocation_field_new(NULL); + struct plocation field_addr; + { +struct plocation *field_addr_tmp = plocation_field_new(NULL); +field_addr = *field_addr_tmp; +FC_FREE(field_addr_tmp); + } #endif /* FREECIV_JSON_CONNECTION */ ''' else: Modified: branches/S3_0/common/networking/dataio_json.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/networking/dataio_json.c?rev=35480=35479=35480=diff == --- branches/S3_0/common/networking/dataio_json.c (original) +++ branches/S3_0/common/networking/dataio_json.c Wed May 10 10:17:01 2017 @@ -442,7 +442,7 @@ int kind, range, value; bool survives, present, quiet; - struct plocation req_field; + struct plocation *req_field; /* Find the requirement object. */ json_t *requirement = plocation_read_data(json_packet, location); @@ -452,47 +452,49 @@ } /* Find the requirement object fields and translate their values. */ - req_field = *plocation_field_new("kind"); - if (!dio_get_uint8_json(requirement, _field, )) { + req_field = plocation_field_new("kind"); + if (!dio_get_uint8_json(requirement, req_field, )) { log_error("ERROR: Unable to get part of requirement from location: %s", plocation_name(location)); return FALSE; } - req_field.name = "value"; - if (!dio_get_sint32_json(requirement, _field, )) { + req_field->name = "value"; + if (!dio_get_sint32_json(requirement, req_field, )) { log_error("ERROR: Unable to get part of requirement from location: %s", plocation_name(location)); return FALSE; } - req_field.name = "range"; - if (!dio_get_uint8_json(requirement, _field, )) { + req_field->name = "range"; + if (!dio_get_uint8_json(requirement, req_field, )) { log_error("ERROR: Unable to get part of requirement from location: %s", plocation_name(location)); return FALSE; } - req_field.name = "survives"; - if (!dio_get_bool8_json(requirement, _field, )) { + req_field->name = "survives"; + if (!dio_get_bool8_json(requirement, req_field, )) { log_error("ERROR: Unable to get part of requirement from location: %s", plocation_name(location)); return FALSE; } - req_field.name = "present"; - if (!dio_get_bool8_json(requirement, _field, )) { + req_field->name = "present"; + if (!dio_get_bool8_json(requirement, req_field, )) { log_error("ERROR: Unable to get part of requirement from location: %s", plocation_name(location)); return FALSE; } - req_field.name = "quiet"; - if (!dio_get_bool8_json(requirement, _field, )) { + req_field->name = "quiet"; + if (!dio_get_bool8_json(requirement, req_field, )) { log_error("ERROR: Unable to get part of requirement from location: %s", plocation_name(location)); return FALSE; } + + FC_FREE(req_field); /* Create a requirement with the values sent over the network. */ *preq = req_from_values(kind, range, survives, present, quiet, value); @@ -507,7 +509,7 @@ const struct plocation *location, struct act_prob *prob) { - struct plocation ap_field; + struct plocation *ap_field; /* Find the action probability object. */ json_t *action_probability = plocation_read_data(json_packet, location); @@ -519,21 +521,23 @@ /* Find the action probability object fields and translate their * values. */ - ap_field = *plocation_field_new("min"); - if
[Freeciv-commits] r35478 - /branches/S3_0/client/helpdata.c
Author: sveinung Date: Wed May 10 10:16:39 2017 New Revision: 35478 URL: http://svn.gna.org/viewcvs/freeciv?rev=35478=rev Log: Auto help: say what the unit upgrades to. See hrm Feature #658346 Modified: branches/S3_0/client/helpdata.c Modified: branches/S3_0/client/helpdata.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/helpdata.c?rev=35478=35477=35478=diff == --- branches/S3_0/client/helpdata.c (original) +++ branches/S3_0/client/helpdata.c Wed May 10 10:16:39 2017 @@ -2382,6 +2382,13 @@ " defenders on a tile, and have no risk for the" " attacker.\n")); break; + case ACTION_UPGRADE_UNIT: +cat_snprintf(buf, bufsz, + /* TRANS: %s is a unit type. */ + _(" * upgraded to %s or, when possible, to the unit " + "type it upgrades to.\n"), + utype_name_translation(utype->obsoleted_by)); +break; default: /* No action specific details. */ break; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35477 - in /trunk/data/webperimental: buildings.ruleset effects.ruleset game.ruleset
Author: sveinung Date: Wed May 10 10:15:16 2017 New Revision: 35477 URL: http://svn.gna.org/viewcvs/freeciv?rev=35477=rev Log: webperimental: ally share Sun Tzu's War Academy. Make Sun Tzu's War Academy give its veteran bonus (combat and production) to both its owner and to all his allies. See hrm Feature #658515 Modified: trunk/data/webperimental/buildings.ruleset trunk/data/webperimental/effects.ruleset trunk/data/webperimental/game.ruleset Modified: trunk/data/webperimental/buildings.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/webperimental/buildings.ruleset?rev=35477=35476=35477=diff == --- trunk/data/webperimental/buildings.ruleset (original) +++ trunk/data/webperimental/buildings.ruleset Wed May 10 10:15:16 2017 @@ -1727,7 +1727,8 @@ sound = "w_sun_tzus_war_academy" sound_alt = "w_generic" helptext = _("\ -All your new military land units start with an additional veteran level\ +All new military land units belonging to you or to your allies start with \ +an additional veteran level\ (this is cumulative with any Barracks building in a city; with both, units\ are created as Hardened). The chance of a land unit getting the next\ veteran level after a battle increases by half.\ Modified: trunk/data/webperimental/effects.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/webperimental/effects.ruleset?rev=35477=35476=35477=diff == --- trunk/data/webperimental/effects.ruleset(original) +++ trunk/data/webperimental/effects.rulesetWed May 10 10:15:16 2017 @@ -2145,7 +2145,7 @@ value = 1 reqs = { "type", "name", "range", "present" - "Building", "Sun Tzu's War Academy", "Player", TRUE + "Building", "Sun Tzu's War Academy", "Alliance", TRUE "UnitClass", "Land", "Local", TRUE "UnitFlag", "NonMil", "Local", FALSE "UnitFlag", "NoVeteran", "Local", FALSE @@ -2156,7 +2156,7 @@ value = 50 reqs = { "type", "name", "range", "present" - "Building", "Sun Tzu's War Academy", "Player", TRUE + "Building", "Sun Tzu's War Academy", "Alliance", TRUE "UnitClass", "Land", "Local", TRUE "UnitFlag", "Diplomat", "Local", FALSE } Modified: trunk/data/webperimental/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/webperimental/game.ruleset?rev=35477=35476=35477=diff == --- trunk/data/webperimental/game.ruleset (original) +++ trunk/data/webperimental/game.ruleset Wed May 10 10:15:16 2017 @@ -91,7 +91,10 @@ - Railroads can't be used by enemy units by default. Regular roads can be \ used by the enemy even if the restrictinfra server setting is enabled. \ (The restrictinfra server setting is enabled by default.)\n\ -- Caravan and Freight can help allies to complete wonders.\n\ +- An alliance has more in game consequences:\n\ + - Caravan and Freight can help allies to complete wonders.\n\ + - Sun Tzu's War Academy gives its veteran bonus (combat and production) \ +to both its owner and to all his allies.\n\ \n\ This ruleset is still in development. If playing it makes you think that \ a rule should change go to the Freeciv-web board at \ ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35476 - /trunk/server/ruleset.c
Author: sveinung Date: Wed May 10 10:15:08 2017 New Revision: 35476 URL: http://svn.gna.org/viewcvs/freeciv?rev=35476=rev Log: Destroy the rs section list of goods. Destroy the section list used to load goods from the ruleset. Reported by Valgrind. See hrm Bug #658475 Modified: trunk/server/ruleset.c Modified: trunk/server/ruleset.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=35476=35475=35476=diff == --- trunk/server/ruleset.c (original) +++ trunk/server/ruleset.c Wed May 10 10:15:08 2017 @@ -1093,6 +1093,7 @@ } } goods_type_iterate_end; } + section_list_destroy(sec); } } @@ -6741,6 +6742,7 @@ pgood->helptext = lookup_strvec(file, sec_name, "helptext"); } goods_type_iterate_end; +section_list_destroy(sec); } /* secfile_check_unused() is not here, but only after also settings section ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35475 - /trunk/server/ruleset.c
Author: sveinung Date: Wed May 10 10:14:56 2017 New Revision: 35475 URL: http://svn.gna.org/viewcvs/freeciv?rev=35475=rev Log: Destroy the rs section list of achievements. Destroy the section list used to load achievements from the ruleset. Reported by Valgrind. See hrm Bug #658472 Modified: trunk/server/ruleset.c Modified: trunk/server/ruleset.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=35475=35474=35475=diff == --- trunk/server/ruleset.c (original) +++ trunk/server/ruleset.c Wed May 10 10:14:56 2017 @@ -6639,6 +6639,7 @@ break; } } achievements_iterate_end; +section_list_destroy(sec); } if (ok) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35471 - /trunk/data/webperimental/game.ruleset
Author: sveinung Date: Wed May 10 10:14:22 2017 New Revision: 35471 URL: http://svn.gna.org/viewcvs/freeciv?rev=35471=rev Log: webperimental: allow allied build wonder help. See hrm Feature #658361 Modified: trunk/data/webperimental/game.ruleset Modified: trunk/data/webperimental/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/webperimental/game.ruleset?rev=35471=35470=35471=diff == --- trunk/data/webperimental/game.ruleset (original) +++ trunk/data/webperimental/game.ruleset Wed May 10 10:14:22 2017 @@ -91,6 +91,7 @@ - Railroads can't be used by enemy units by default. Regular roads can be \ used by the enemy even if the restrictinfra server setting is enabled. \ (The restrictinfra server setting is enabled by default.)\n\ +- Caravan and Freight can help allies to complete wonders.\n\ \n\ This ruleset is still in development. If playing it makes you think that \ a rule should change go to the Freeciv-web board at \ @@ -645,9 +646,12 @@ [actionenabler_help_build_wonder] action = "Help Wonder" actor_reqs= -{ "type", "name", "range", "present" +{ "type", "name", "range", "present" "UnitFlag", "HelpWonder", "Local", TRUE - "DiplRel", "Foreign", "Local", FALSE + "DiplRel", "Armistice", "Local", FALSE + "DiplRel", "War","Local", FALSE + "DiplRel", "Cease-fire", "Local", FALSE + "DiplRel", "Peace", "Local", FALSE } target_reqs= { "type", "name", "range" @@ -657,9 +661,12 @@ [actionenabler_help_build_small_wonder] action = "Help Wonder" actor_reqs= -{ "type", "name", "range", "present" +{ "type", "name", "range", "present" "UnitFlag", "HelpWonder", "Local", TRUE - "DiplRel", "Foreign", "Local", FALSE + "DiplRel", "Armistice", "Local", FALSE + "DiplRel", "War","Local", FALSE + "DiplRel", "Cease-fire", "Local", FALSE + "DiplRel", "Peace", "Local", FALSE } target_reqs= { "type", "name", "range" ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35473 - /trunk/common/networking/dataio_json.c
Author: sveinung Date: Wed May 10 10:14:40 2017 New Revision: 35473 URL: http://svn.gna.org/viewcvs/freeciv?rev=35473=rev Log: JSON protocol: fix sub field sending memory leak. Steal the references to values created inline when put inside an object by using json_object_set_new() rather than json_object_set(). Found with Valgrind. Reported by Andreas Røsdal See hrm Bug #658386 Modified: trunk/common/networking/dataio_json.c Modified: trunk/common/networking/dataio_json.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/networking/dataio_json.c?rev=35473=35472=35473=diff == --- trunk/common/networking/dataio_json.c (original) +++ trunk/common/networking/dataio_json.c Wed May 10 10:14:40 2017 @@ -239,9 +239,9 @@ location->sub_location->number = i; -json_object_set(universal, "kind", json_integer(pcp->kind)); -json_object_set(universal, "value", -json_integer(universal_number(pcp))); +json_object_set_new(universal, "kind", json_integer(pcp->kind)); +json_object_set_new(universal, "value", +json_integer(universal_number(pcp))); plocation_write_data(dout->json, location, universal); } @@ -708,14 +708,14 @@ /* Write the requirement values to the fields of the requirement * object. */ - json_object_set(requirement, "kind", json_integer(kind)); - json_object_set(requirement, "value", json_integer(value)); - - json_object_set(requirement, "range", json_integer(range)); - - json_object_set(requirement, "survives", json_boolean(survives)); - json_object_set(requirement, "present", json_boolean(present)); - json_object_set(requirement, "quiet", json_boolean(quiet)); + json_object_set_new(requirement, "kind", json_integer(kind)); + json_object_set_new(requirement, "value", json_integer(value)); + + json_object_set_new(requirement, "range", json_integer(range)); + + json_object_set_new(requirement, "survives", json_boolean(survives)); + json_object_set_new(requirement, "present", json_boolean(present)); + json_object_set_new(requirement, "quiet", json_boolean(quiet)); /* Put the requirement object in the packet. */ plocation_write_data(dout->json, location, requirement); @@ -733,8 +733,8 @@ /* Write the action probability values to the fields of the action * probability object. */ - json_object_set(action_probability, "min", json_integer(prob->min)); - json_object_set(action_probability, "max", json_integer(prob->max)); + json_object_set_new(action_probability, "min", json_integer(prob->min)); + json_object_set_new(action_probability, "max", json_integer(prob->max)); /* Put the action probability object in the packet. */ plocation_write_data(dout->json, location, action_probability); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35474 - /trunk/common/networking/dataio_json.c
Author: sveinung Date: Wed May 10 10:14:48 2017 New Revision: 35474 URL: http://svn.gna.org/viewcvs/freeciv?rev=35474=rev Log: JSON protocol: make estring reading more careful. The copying of extra bytes was found with Valgrind. See hrm Feature #658458 Modified: trunk/common/networking/dataio_json.c Modified: trunk/common/networking/dataio_json.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/networking/dataio_json.c?rev=35474=35473=35474=diff == --- trunk/common/networking/dataio_json.c (original) +++ trunk/common/networking/dataio_json.c Wed May 10 10:14:48 2017 @@ -946,11 +946,16 @@ FC_FREE(escaped_value); /* Copy the unescaped value so CURL can free its own copy. */ - memcpy(dest, unescaped_value, max_dest_size); + memcpy(dest, unescaped_value, + /* Don't copy the memory following unescaped_value. */ + MIN(max_dest_size, strlen(unescaped_value) + 1)); /* CURL's memory management wants to free this it self. */ curl_free(unescaped_value); + /* Make sure that the string is terminated. */ + dest[max_dest_size - 1] = '\0'; + return TRUE; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r35470 - /trunk/client/helpdata.c
Author: sveinung Date: Wed May 10 09:52:44 2017 New Revision: 35470 URL: http://svn.gna.org/viewcvs/freeciv?rev=35470=rev Log: Auto help: say what the unit upgrades to. See hrm Feature #658346 Modified: trunk/client/helpdata.c Modified: trunk/client/helpdata.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=35470=35469=35470=diff == --- trunk/client/helpdata.c (original) +++ trunk/client/helpdata.c Wed May 10 09:52:44 2017 @@ -2382,6 +2382,13 @@ " defenders on a tile, and have no risk for the" " attacker.\n")); break; + case ACTION_UPGRADE_UNIT: +cat_snprintf(buf, bufsz, + /* TRANS: %s is a unit type. */ + _(" * upgraded to %s or, when possible, to the unit " + "type it upgrades to.\n"), + utype_name_translation(utype->obsoleted_by)); +break; default: /* No action specific details. */ break; ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits