[Freeciv-commits] r30333 - /branches/S2_6/common/nation.c
Author: cazfi Date: Sun Nov 1 13:16:33 2015 New Revision: 30333 URL: http://svn.gna.org/viewcvs/freeciv?rev=30333=rev Log: Do not include nation_check() function to a release build where it's not being used. Reported by Louis Moureaux See bug #23993 Modified: branches/S2_6/common/nation.c Modified: branches/S2_6/common/nation.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/nation.c?rev=30333=30332=30333=diff == --- branches/S2_6/common/nation.c (original) +++ branches/S2_6/common/nation.c Sun Nov 1 13:16:33 2015 @@ -58,9 +58,6 @@ log_do_output_for_level(LOG_ERROR), \ __FILE__, __FUNCTION__, __FC_LINE__), \ action) -#else -#define NATION_CHECK(pnation, action) /* Do Nothing. */ -#endif /* DEBUG */ / Returns TRUE if the nation is valid, else, print an error message and @@ -97,6 +94,10 @@ return TRUE; } +#else /* DEBUG */ +#define NATION_CHECK(pnation, action) /* Do Nothing. */ +#endif /* DEBUG */ + / Returns the nation that has the given (translated) plural noun. Returns NO_NATION_SELECTED if none match. ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30334 - /branches/S2_5/common/nation.c
Author: cazfi Date: Sun Nov 1 13:16:39 2015 New Revision: 30334 URL: http://svn.gna.org/viewcvs/freeciv?rev=30334=rev Log: Do not include nation_check() function to a release build where it's not being used. Reported by Louis Moureaux See bug #23993 Modified: branches/S2_5/common/nation.c Modified: branches/S2_5/common/nation.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/nation.c?rev=30334=30333=30334=diff == --- branches/S2_5/common/nation.c (original) +++ branches/S2_5/common/nation.c Sun Nov 1 13:16:39 2015 @@ -77,9 +77,6 @@ log_do_output_for_level(LOG_ERROR), \ __FILE__, __FUNCTION__, __FC_LINE__), \ action) -#else -#define NATION_CHECK(pnation, action) /* Do Nothing. */ -#endif /* DEBUG */ / Returns TRUE if the nation is valid, else, print an error message and @@ -116,6 +113,10 @@ return TRUE; } +#else /* DEBUG */ +#define NATION_CHECK(pnation, action) /* Do Nothing. */ +#endif /* DEBUG */ + / Returns the nation that has the given (translated) plural noun. Returns NO_NATION_SELECTED if none match. ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30332 - /trunk/common/nation.c
Author: cazfi Date: Sun Nov 1 13:16:27 2015 New Revision: 30332 URL: http://svn.gna.org/viewcvs/freeciv?rev=30332=rev Log: Do not include nation_check() function to a release build where it's not being used. Reported by Louis Moureaux See bug #23993 Modified: trunk/common/nation.c Modified: trunk/common/nation.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/nation.c?rev=30332=30331=30332=diff == --- trunk/common/nation.c (original) +++ trunk/common/nation.c Sun Nov 1 13:16:27 2015 @@ -58,9 +58,6 @@ log_do_output_for_level(LOG_ERROR), \ __FILE__, __FUNCTION__, __FC_LINE__), \ action) -#else -#define NATION_CHECK(pnation, action) /* Do Nothing. */ -#endif /* DEBUG */ / Returns TRUE if the nation is valid, else, print an error message and @@ -97,6 +94,10 @@ return TRUE; } +#else /* DEBUG */ +#define NATION_CHECK(pnation, action) /* Do Nothing. */ +#endif /* DEBUG */ + / Returns the nation that has the given (translated) plural noun. Returns NO_NATION_SELECTED if none match. ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30355 - /branches/S2_5/ai/default/advmilitary.c
Author: cazfi Date: Sun Nov 1 18:55:23 2015 New Revision: 30355 URL: http://svn.gna.org/viewcvs/freeciv?rev=30355=rev Log: Work around a problem of defense bonus originating from a source not counting as 'wall', in the default AI terminology, reducing defender want. See bug #23997 Modified: branches/S2_5/ai/default/advmilitary.c Modified: branches/S2_5/ai/default/advmilitary.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/ai/default/advmilitary.c?rev=30355=30354=30355=diff == --- branches/S2_5/ai/default/advmilitary.c (original) +++ branches/S2_5/ai/default/advmilitary.c Sun Nov 1 18:55:23 2015 @@ -789,9 +789,15 @@ int limit_cost = pcity->shield_stock + 40; if (walls && !utype_has_flag(punittype, UTYF_BADCITYDEFENDER)) { - desire *= city_data->wallvalue; - /* TODO: More use of POWER_FACTOR ! */ - desire /= POWER_FACTOR; +/* FIXME: Below if() is just workaround to make sure desire + *is not made zero when 'walls' above is not actually + *walls that increase wallvalue, but misdiagnosed + *because of some other defense bonus the city gets. */ +if (city_data->wallvalue > POWER_FACTOR) { + desire *= city_data->wallvalue; + /* TODO: More use of POWER_FACTOR ! */ + desire /= POWER_FACTOR; +} } if ((best_unit_cost > limit_cost ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30353 - /trunk/ai/default/advmilitary.c
Author: cazfi Date: Sun Nov 1 18:55:12 2015 New Revision: 30353 URL: http://svn.gna.org/viewcvs/freeciv?rev=30353=rev Log: Work around a problem of defense bonus originating from a source not counting as 'wall', in the default AI terminology, reducing defender want. See bug #23997 Modified: trunk/ai/default/advmilitary.c Modified: trunk/ai/default/advmilitary.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/advmilitary.c?rev=30353=30352=30353=diff == --- trunk/ai/default/advmilitary.c (original) +++ trunk/ai/default/advmilitary.c Sun Nov 1 18:55:12 2015 @@ -795,9 +795,15 @@ int limit_cost = pcity->shield_stock + 40; if (walls && !utype_has_flag(punittype, UTYF_BADCITYDEFENDER)) { - desire *= city_data->wallvalue; - /* TODO: More use of POWER_FACTOR ! */ - desire /= POWER_FACTOR; +/* FIXME: Below if() is just workaround to make sure desire + *is not made zero when 'walls' above is not actually + *walls that increase wallvalue, but misdiagnosed + *because of some other defense bonus the city gets. */ +if (city_data->wallvalue > POWER_FACTOR) { + desire *= city_data->wallvalue; + /* TODO: More use of POWER_FACTOR ! */ + desire /= POWER_FACTOR; +} } if ((best_unit_cost > limit_cost ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30350 - /branches/S2_5/client/gui-qt/citydlg.cpp
Author: mir3x Date: Sun Nov 1 18:52:52 2015 New Revision: 30350 URL: http://svn.gna.org/viewcvs/freeciv?rev=30350=rev Log: Shows scrollbars in city production, and only when needed - in Qt-client. See patch #6504 Modified: branches/S2_5/client/gui-qt/citydlg.cpp Modified: branches/S2_5/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=30350=30349=30350=diff == --- branches/S2_5/client/gui-qt/citydlg.cpp (original) +++ branches/S2_5/client/gui-qt/citydlg.cpp Sun Nov 1 18:52:52 2015 @@ -2921,8 +2921,20 @@ const QItemSelection &))); resizeRowsToContents(); resizeColumnsToContents(); - setFixedWidth(3 * sh.x() + 5); - setFixedHeight(list_model->rowCount()*sh.y() + 5); + setFixedWidth(3 * sh.x() + 6); + setFixedHeight(list_model->rowCount()*sh.y() + 6); + if (width() > desk_width) { +setFixedWidth(desk_width); +setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + } else { +setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + } + if (height() > desk_height) { +setFixedHeight(desk_height); +setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + } else { +setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + } pos = QCursor::pos(); if (pos.x() + width() > desk_width) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30352 - /trunk/client/gui-qt/citydlg.cpp
Author: mir3x Date: Sun Nov 1 18:53:07 2015 New Revision: 30352 URL: http://svn.gna.org/viewcvs/freeciv?rev=30352=rev Log: Shows scrollbars in city production, and only when needed - in Qt-client. See patch #6504 Modified: trunk/client/gui-qt/citydlg.cpp Modified: trunk/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=30352=30351=30352=diff == --- trunk/client/gui-qt/citydlg.cpp (original) +++ trunk/client/gui-qt/citydlg.cpp Sun Nov 1 18:53:07 2015 @@ -2926,8 +2926,20 @@ const QItemSelection &))); resizeRowsToContents(); resizeColumnsToContents(); - setFixedWidth(3 * sh.x() + 5); - setFixedHeight(list_model->rowCount()*sh.y() + 5); + setFixedWidth(3 * sh.x() + 6); + setFixedHeight(list_model->rowCount()*sh.y() + 6); + if (width() > desk_width) { +setFixedWidth(desk_width); +setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + } else { +setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + } + if (height() > desk_height) { +setFixedHeight(desk_height); +setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + } else { +setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + } pos = QCursor::pos(); if (pos.x() + width() > desk_width) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30336 - in /branches/S2_6/client/gui-qt: menu.cpp menu.h
Author: mir3x Date: Sun Nov 1 18:00:28 2015 New Revision: 30336 URL: http://svn.gna.org/viewcvs/freeciv?rev=30336=rev Log: Added menu entries: "Save Options Now" and checkable "Save Options on Exit" for Qt client. See bug #23950 Modified: branches/S2_6/client/gui-qt/menu.cpp branches/S2_6/client/gui-qt/menu.h Modified: branches/S2_6/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/menu.cpp?rev=30336=30335=30336=diff == --- branches/S2_6/client/gui-qt/menu.cpp(original) +++ branches/S2_6/client/gui-qt/menu.cppSun Nov 1 18:00:28 2015 @@ -412,6 +412,12 @@ connect(act, SIGNAL(triggered()), this, SLOT(server_options())); act = menu->addAction(_("Messages")); connect(act, SIGNAL(triggered()), this, SLOT(messages_options())); + act = menu->addAction(_("Save Options Now")); + act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton)); + connect(act, SIGNAL(triggered()), this, SLOT(save_options_now())); + act = menu->addAction(_("Save Options on Exit")); + act->setCheckable(true); + act->setChecked(gui_options.save_options_on_exit); menu = pr; menu->addSeparator(); act = menu->addAction(_("Save Game")); @@ -2035,6 +2041,14 @@ popup_messageopt_dialog(); } +/ + Menu Save Options Now +*/ +void mr_menu::save_options_now() +{ + options_save(); +} + /*** Invoke popup for quiting game ***/ Modified: branches/S2_6/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/menu.h?rev=30336=30335=30336=diff == --- branches/S2_6/client/gui-qt/menu.h (original) +++ branches/S2_6/client/gui-qt/menu.h Sun Nov 1 18:00:28 2015 @@ -156,6 +156,7 @@ void local_options(); void server_options(); void messages_options(); + void save_options_now(); void save_game(); void save_game_as(); void back_to_menu(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30344 - in /branches/S2_5/client/gui-qt: fc_client.cpp fc_client.h menu.cpp optiondlg.cpp pages.cpp
Author: mir3x Date: Sun Nov 1 18:45:35 2015 New Revision: 30344 URL: http://svn.gna.org/viewcvs/freeciv?rev=30344=rev Log: Added option to choose ai level, ai_fill, ruleset and rearranged button for more server options in PAGE_START in Qt-client. See patch #6444 Modified: branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/menu.cpp branches/S2_5/client/gui-qt/optiondlg.cpp branches/S2_5/client/gui-qt/pages.cpp Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=30344=30343=30344=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Sun Nov 1 18:45:35 2015 @@ -620,13 +620,6 @@ option_dialog_popup(_("Set local options"), client_optset); } -/ - Popups client options -/ -void fc_client::popup_server_options() -{ - option_dialog_popup(_("Set server options"), server_optset); -} void fc_client::create_cursors(void) { @@ -782,3 +775,91 @@ { tabBar()->setTabTextColor(index, col); } + +/ + Init's layout and default values for options in START_PAGE +/ +void pregame_options::init() +{ + QGridLayout *layout; + QLabel *l1, *l2, *l3; + QPushButton *but; + int level; + + l1 = new QLabel(_("Number of Players\n(including AI):")); + l2 = new QLabel(_("AI Skill Level:")); + l3 = new QLabel(_("Ruleset Version:")); + layout = new QGridLayout(this); + max_players = new QSpinBox(this); + ailevel = new QComboBox(this); + cruleset = new QComboBox(this); + max_players->setRange(1, MAX_NUM_PLAYERS); + + for (level = AI_LEVEL_AWAY; level < AI_LEVEL_LAST; level++) { +if (is_settable_ai_level(static_cast(level))) { + const char *level_name = ai_level_name(static_cast(level)); + ailevel->addItem(level_name, level); +} + } + ailevel->setCurrentIndex(-1); + + connect(max_players, SIGNAL(valueChanged(int)), + SLOT(max_players_change(int))); + connect(ailevel, SIGNAL(currentIndexChanged(int)), + SLOT(ailevel_change(int))); + connect(cruleset, SIGNAL(currentIndexChanged(int)), + SLOT(ruleset_change(int))); + + but = new QPushButton; + but->setText(_("More Game Options")); + but->setIcon(fc_icons::instance()->get_icon("preferences-other")); + QObject::connect(but, SIGNAL(clicked()), this, + SLOT(popup_server_options())); + layout->addWidget(l1, 0, 1); + layout->addWidget(l2, 1, 1); + layout->addWidget(l3, 2, 1); + layout->addWidget(max_players, 0, 2); + layout->addWidget(ailevel, 1, 2); + layout->addWidget(cruleset, 2, 2); + layout->addWidget(but, 3, 1); + setLayout(layout); +} + +/ + Slot for changing aifill value +/ +void pregame_options::max_players_change(int i) +{ + option_int_set(optset_option_by_name(server_optset, "aifill"), i); +} + +/ + Slot for changing level of AI +/ +void pregame_options::ailevel_change(int i) +{ + int k; + const char *name; + + k = ailevel->currentData().toInt(); + name = ai_level_cmd(static_cast(k)); + send_chat_printf("/%s", name); + +} + +/ + Slot for changing ruleset +/ +void pregame_options::ruleset_change(int i) +{ + set_ruleset(cruleset->currentText().toLocal8Bit().data()); +} + +/ + Popups client options +/ +void pregame_options::popup_server_options() +{ + option_dialog_popup(_("Set server options"), server_optset); +} + Modified: branches/S2_5/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=30344=30343=30344=diff == --- branches/S2_5/client/gui-qt/fc_client.h (original) +++ branches/S2_5/client/gui-qt/fc_client.h Sun Nov 1 18:45:35 2015 @@ -23,9 +23,11 @@ #endif // Qt -#include +#include #include #include +#include +#include // client #include "chatline_common.h" @@ -80,6 +82,7 @@ class QTreeWidget; class QStatusBar;
[Freeciv-commits] r30346 - in /trunk/client/gui-qt: fc_client.cpp fc_client.h menu.cpp optiondlg.cpp pages.cpp
Author: mir3x Date: Sun Nov 1 18:46:12 2015 New Revision: 30346 URL: http://svn.gna.org/viewcvs/freeciv?rev=30346=rev Log: Added option to choose ai level, ai_fill, ruleset and rearranged button for more server options in PAGE_START in Qt-client. See patch #6444 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/optiondlg.cpp trunk/client/gui-qt/pages.cpp Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=30346=30345=30346=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Sun Nov 1 18:46:12 2015 @@ -616,13 +616,6 @@ option_dialog_popup(_("Set local options"), client_optset); } -/ - Popups client options -/ -void fc_client::popup_server_options() -{ - option_dialog_popup(_("Set server options"), server_optset); -} void fc_client::create_cursors(void) { @@ -777,3 +770,91 @@ { tabBar()->setTabTextColor(index, col); } + +/ + Init's layout and default values for options in START_PAGE +/ +void pregame_options::init() +{ + QGridLayout *layout; + QLabel *l1, *l2, *l3; + QPushButton *but; + int level; + + l1 = new QLabel(_("Number of Players\n(including AI):")); + l2 = new QLabel(_("AI Skill Level:")); + l3 = new QLabel(_("Ruleset Version:")); + layout = new QGridLayout(this); + max_players = new QSpinBox(this); + ailevel = new QComboBox(this); + cruleset = new QComboBox(this); + max_players->setRange(1, MAX_NUM_PLAYERS); + + for (level = 0; level < AI_LEVEL_COUNT; level++) { +if (is_settable_ai_level(static_cast(level))) { + const char *level_name = ai_level_translated_name( +static_cast(level)); + ailevel->addItem(level_name, level); +} + } + ailevel->setCurrentIndex(-1); + + connect(max_players, SIGNAL(valueChanged(int)), + SLOT(max_players_change(int))); + connect(ailevel, SIGNAL(currentIndexChanged(int)), + SLOT(ailevel_change(int))); + connect(cruleset, SIGNAL(currentIndexChanged(int)), + SLOT(ruleset_change(int))); + + but = new QPushButton; + but->setText(_("More Game Options")); + but->setIcon(fc_icons::instance()->get_icon("preferences-other")); + QObject::connect(but, SIGNAL(clicked()), this, + SLOT(popup_server_options())); + layout->addWidget(l1, 0, 1); + layout->addWidget(l2, 1, 1); + layout->addWidget(l3, 2, 1); + layout->addWidget(max_players, 0, 2); + layout->addWidget(ailevel, 1, 2); + layout->addWidget(cruleset, 2, 2); + layout->addWidget(but, 3, 1); + setLayout(layout); +} + +/ + Slot for changing aifill value +/ +void pregame_options::max_players_change(int i) +{ + option_int_set(optset_option_by_name(server_optset, "aifill"), i); +} + +/ + Slot for changing level of AI +/ +void pregame_options::ailevel_change(int i) +{ + int k; + const char *name; + + k = ailevel->currentData().toInt(); + name = ai_level_cmd(static_cast(k)); + send_chat_printf("/%s", name); +} + +/ + Slot for changing ruleset +/ +void pregame_options::ruleset_change(int i) +{ + set_ruleset(cruleset->currentText().toLocal8Bit().data()); +} + +/ + Popups client options +/ +void pregame_options::popup_server_options() +{ + option_dialog_popup(_("Set server options"), server_optset); +} + Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=30346=30345=30346=diff == --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Sun Nov 1 18:46:12 2015 @@ -23,9 +23,11 @@ #endif // Qt -#include +#include #include #include +#include +#include // client #include "chatline_common.h" @@ -80,6 +82,7 @@ class QTreeWidget; class QStatusBar; class QMainWindow; +class pregame_options; class fc_icons {
[Freeciv-commits] r30345 - in /branches/S2_6/client/gui-qt: fc_client.cpp fc_client.h menu.cpp optiondlg.cpp pages.cpp
Author: mir3x Date: Sun Nov 1 18:46:01 2015 New Revision: 30345 URL: http://svn.gna.org/viewcvs/freeciv?rev=30345=rev Log: Added option to choose ai level, ai_fill, ruleset and rearranged button for more server options in PAGE_START in Qt-client. See patch #6444 Modified: branches/S2_6/client/gui-qt/fc_client.cpp branches/S2_6/client/gui-qt/fc_client.h branches/S2_6/client/gui-qt/menu.cpp branches/S2_6/client/gui-qt/optiondlg.cpp branches/S2_6/client/gui-qt/pages.cpp Modified: branches/S2_6/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/fc_client.cpp?rev=30345=30344=30345=diff == --- branches/S2_6/client/gui-qt/fc_client.cpp (original) +++ branches/S2_6/client/gui-qt/fc_client.cpp Sun Nov 1 18:46:01 2015 @@ -616,13 +616,6 @@ option_dialog_popup(_("Set local options"), client_optset); } -/ - Popups client options -/ -void fc_client::popup_server_options() -{ - option_dialog_popup(_("Set server options"), server_optset); -} void fc_client::create_cursors(void) { @@ -777,3 +770,91 @@ { tabBar()->setTabTextColor(index, col); } + +/ + Init's layout and default values for options in START_PAGE +/ +void pregame_options::init() +{ + QGridLayout *layout; + QLabel *l1, *l2, *l3; + QPushButton *but; + int level; + + l1 = new QLabel(_("Number of Players\n(including AI):")); + l2 = new QLabel(_("AI Skill Level:")); + l3 = new QLabel(_("Ruleset Version:")); + layout = new QGridLayout(this); + max_players = new QSpinBox(this); + ailevel = new QComboBox(this); + cruleset = new QComboBox(this); + max_players->setRange(1, MAX_NUM_PLAYERS); + + for (level = 0; level < AI_LEVEL_COUNT; level++) { +if (is_settable_ai_level(static_cast(level))) { + const char *level_name = ai_level_translated_name( +static_cast(level)); + ailevel->addItem(level_name, level); +} + } + ailevel->setCurrentIndex(-1); + + connect(max_players, SIGNAL(valueChanged(int)), + SLOT(max_players_change(int))); + connect(ailevel, SIGNAL(currentIndexChanged(int)), + SLOT(ailevel_change(int))); + connect(cruleset, SIGNAL(currentIndexChanged(int)), + SLOT(ruleset_change(int))); + + but = new QPushButton; + but->setText(_("More Game Options")); + but->setIcon(fc_icons::instance()->get_icon("preferences-other")); + QObject::connect(but, SIGNAL(clicked()), this, + SLOT(popup_server_options())); + layout->addWidget(l1, 0, 1); + layout->addWidget(l2, 1, 1); + layout->addWidget(l3, 2, 1); + layout->addWidget(max_players, 0, 2); + layout->addWidget(ailevel, 1, 2); + layout->addWidget(cruleset, 2, 2); + layout->addWidget(but, 3, 1); + setLayout(layout); +} + +/ + Slot for changing aifill value +/ +void pregame_options::max_players_change(int i) +{ + option_int_set(optset_option_by_name(server_optset, "aifill"), i); +} + +/ + Slot for changing level of AI +/ +void pregame_options::ailevel_change(int i) +{ + int k; + const char *name; + + k = ailevel->currentData().toInt(); + name = ai_level_cmd(static_cast(k)); + send_chat_printf("/%s", name); +} + +/ + Slot for changing ruleset +/ +void pregame_options::ruleset_change(int i) +{ + set_ruleset(cruleset->currentText().toLocal8Bit().data()); +} + +/ + Popups client options +/ +void pregame_options::popup_server_options() +{ + option_dialog_popup(_("Set server options"), server_optset); +} + Modified: branches/S2_6/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/fc_client.h?rev=30345=30344=30345=diff == --- branches/S2_6/client/gui-qt/fc_client.h (original) +++ branches/S2_6/client/gui-qt/fc_client.h Sun Nov 1 18:46:01 2015 @@ -23,9 +23,11 @@ #endif // Qt -#include +#include #include #include +#include +#include // client #include "chatline_common.h" @@ -80,6 +82,7 @@
[Freeciv-commits] r30347 - /branches/S2_5/client/gui-qt/pages.cpp
Author: mir3x Date: Sun Nov 1 18:49:49 2015 New Revision: 30347 URL: http://svn.gna.org/viewcvs/freeciv?rev=30347=rev Log: Added showing information about selected server in network page in Qt-client. See patch #6497 Modified: branches/S2_5/client/gui-qt/pages.cpp Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=30347=30346=30347=diff == --- branches/S2_5/client/gui-qt/pages.cpp (original) +++ branches/S2_5/client/gui-qt/pages.cpp Sun Nov 1 18:49:49 2015 @@ -299,10 +299,6 @@ lan_widget->setProperty("selectionBehavior", "SelectRows"); lan_widget->setEditTriggers(QAbstractItemView::NoEditTriggers); - connect(lan_widget->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, - SLOT(slot_selection_changed(const QItemSelection &, const QItemSelection &))); - wan_widget->setHorizontalHeaderLabels(servers_list); wan_widget->setProperty("showGrid", "false"); wan_widget->setProperty("selectionBehavior", "SelectRows"); @@ -316,6 +312,8 @@ info_widget->setProperty("selectionBehavior", "SelectRows"); info_widget->setEditTriggers(QAbstractItemView::NoEditTriggers); info_widget->setSelectionMode(QAbstractItemView::SingleSelection); + info_widget->setProperty("showGrid", "false"); + info_widget->setAlternatingRowColors(true); header = lan_widget->horizontalHeader(); header->setSectionResizeMode(0, QHeaderView::Stretch); @@ -958,20 +956,64 @@ QModelIndexList indexes = selected.indexes(); QStringList sl; QModelIndex index; + QTableWidgetItem *item; QVariant qvar; + int k, col, n; client_pages i = current_page(); + const struct server *pserver = NULL; + struct srv_list *srvrs; if (indexes.isEmpty()) { return; } - + k = 0; switch (i) { case PAGE_NETWORK: index = indexes.at(0); connect_host_edit->setText(index.data().toString()); index = indexes.at(1); connect_port_edit->setText(index.data().toString()); -break; + +srvrs = server_scan_get_list(meta_scan); +if (!holding_srv_list_mutex) { + fc_allocate_mutex(>mutex); +} +if (srvrs->servers) { + pserver = server_list_get(srvrs->servers, index.row()); +} +if (!holding_srv_list_mutex) { + fc_release_mutex(>mutex); +} +if (!pserver || !pserver->players) { + return; +} +n = pserver->nplayers; +info_widget->clearContents(); +info_widget->setRowCount(0); +for (k = 0; k < n; k++) { + info_widget->insertRow(k); + for (col = 0; col < 4; col++) { +item = new QTableWidgetItem(); +switch (col) { +case 0: + item->setText(pserver->players[k].name); + break; +case 1: + item->setText(pserver->players[k].type); + break; +case 2: + item->setText(pserver->players[k].host); + break; +case 3: + item->setText(pserver->players[k].nation); + break; +default: + break; +} +info_widget->setItem(k, col, item); + } +} + break; case PAGE_SCENARIO: index = indexes.at(0); qvar = index.data(Qt::UserRole); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30349 - /trunk/client/gui-qt/pages.cpp
Author: mir3x Date: Sun Nov 1 18:50:02 2015 New Revision: 30349 URL: http://svn.gna.org/viewcvs/freeciv?rev=30349=rev Log: Added showing information about selected server in network page in Qt-client. See patch #6497 Modified: trunk/client/gui-qt/pages.cpp Modified: trunk/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=30349=30348=30349=diff == --- trunk/client/gui-qt/pages.cpp (original) +++ trunk/client/gui-qt/pages.cpp Sun Nov 1 18:50:02 2015 @@ -298,10 +298,6 @@ lan_widget->setProperty("selectionBehavior", "SelectRows"); lan_widget->setEditTriggers(QAbstractItemView::NoEditTriggers); - connect(lan_widget->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, - SLOT(slot_selection_changed(const QItemSelection &, const QItemSelection &))); - wan_widget->setHorizontalHeaderLabels(servers_list); wan_widget->setProperty("showGrid", "false"); wan_widget->setProperty("selectionBehavior", "SelectRows"); @@ -315,6 +311,8 @@ info_widget->setProperty("selectionBehavior", "SelectRows"); info_widget->setEditTriggers(QAbstractItemView::NoEditTriggers); info_widget->setSelectionMode(QAbstractItemView::SingleSelection); + info_widget->setProperty("showGrid", "false"); + info_widget->setAlternatingRowColors(true); header = lan_widget->horizontalHeader(); header->setSectionResizeMode(0, QHeaderView::Stretch); @@ -957,20 +955,64 @@ QModelIndexList indexes = selected.indexes(); QStringList sl; QModelIndex index; + QTableWidgetItem *item; QVariant qvar; + int k, col, n; client_pages i = current_page(); + const struct server *pserver = NULL; + struct srv_list *srvrs; if (indexes.isEmpty()) { return; } - + k = 0; switch (i) { case PAGE_NETWORK: index = indexes.at(0); connect_host_edit->setText(index.data().toString()); index = indexes.at(1); connect_port_edit->setText(index.data().toString()); -break; + +srvrs = server_scan_get_list(meta_scan); +if (!holding_srv_list_mutex) { + fc_allocate_mutex(>mutex); +} +if (srvrs->servers) { + pserver = server_list_get(srvrs->servers, index.row()); +} +if (!holding_srv_list_mutex) { + fc_release_mutex(>mutex); +} +if (!pserver || !pserver->players) { + return; +} +n = pserver->nplayers; +info_widget->clearContents(); +info_widget->setRowCount(0); +for (k = 0; k < n; k++) { + info_widget->insertRow(k); + for (col = 0; col < 4; col++) { +item = new QTableWidgetItem(); +switch (col) { +case 0: + item->setText(pserver->players[k].name); + break; +case 1: + item->setText(pserver->players[k].type); + break; +case 2: + item->setText(pserver->players[k].host); + break; +case 3: + item->setText(pserver->players[k].nation); + break; +default: + break; +} +info_widget->setItem(k, col, item); + } +} + break; case PAGE_SCENARIO: index = indexes.at(0); qvar = index.data(Qt::UserRole); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30348 - /branches/S2_6/client/gui-qt/pages.cpp
Author: mir3x Date: Sun Nov 1 18:49:56 2015 New Revision: 30348 URL: http://svn.gna.org/viewcvs/freeciv?rev=30348=rev Log: Added showing information about selected server in network page in Qt-client. See patch #6497 Modified: branches/S2_6/client/gui-qt/pages.cpp Modified: branches/S2_6/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/pages.cpp?rev=30348=30347=30348=diff == --- branches/S2_6/client/gui-qt/pages.cpp (original) +++ branches/S2_6/client/gui-qt/pages.cpp Sun Nov 1 18:49:56 2015 @@ -298,10 +298,6 @@ lan_widget->setProperty("selectionBehavior", "SelectRows"); lan_widget->setEditTriggers(QAbstractItemView::NoEditTriggers); - connect(lan_widget->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, - SLOT(slot_selection_changed(const QItemSelection &, const QItemSelection &))); - wan_widget->setHorizontalHeaderLabels(servers_list); wan_widget->setProperty("showGrid", "false"); wan_widget->setProperty("selectionBehavior", "SelectRows"); @@ -315,6 +311,8 @@ info_widget->setProperty("selectionBehavior", "SelectRows"); info_widget->setEditTriggers(QAbstractItemView::NoEditTriggers); info_widget->setSelectionMode(QAbstractItemView::SingleSelection); + info_widget->setProperty("showGrid", "false"); + info_widget->setAlternatingRowColors(true); header = lan_widget->horizontalHeader(); header->setSectionResizeMode(0, QHeaderView::Stretch); @@ -957,20 +955,64 @@ QModelIndexList indexes = selected.indexes(); QStringList sl; QModelIndex index; + QTableWidgetItem *item; QVariant qvar; + int k, col, n; client_pages i = current_page(); + const struct server *pserver = NULL; + struct srv_list *srvrs; if (indexes.isEmpty()) { return; } - + k = 0; switch (i) { case PAGE_NETWORK: index = indexes.at(0); connect_host_edit->setText(index.data().toString()); index = indexes.at(1); connect_port_edit->setText(index.data().toString()); -break; + +srvrs = server_scan_get_list(meta_scan); +if (!holding_srv_list_mutex) { + fc_allocate_mutex(>mutex); +} +if (srvrs->servers) { + pserver = server_list_get(srvrs->servers, index.row()); +} +if (!holding_srv_list_mutex) { + fc_release_mutex(>mutex); +} +if (!pserver || !pserver->players) { + return; +} +n = pserver->nplayers; +info_widget->clearContents(); +info_widget->setRowCount(0); +for (k = 0; k < n; k++) { + info_widget->insertRow(k); + for (col = 0; col < 4; col++) { +item = new QTableWidgetItem(); +switch (col) { +case 0: + item->setText(pserver->players[k].name); + break; +case 1: + item->setText(pserver->players[k].type); + break; +case 2: + item->setText(pserver->players[k].host); + break; +case 3: + item->setText(pserver->players[k].nation); + break; +default: + break; +} +info_widget->setItem(k, col, item); + } +} + break; case PAGE_SCENARIO: index = indexes.at(0); qvar = index.data(Qt::UserRole); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30360 - in /branches/S2_6: client/ client/gui-sdl/ client/gui-sdl2/ common/ server/ utility/
Author: cazfi Date: Sun Nov 1 19:55:00 2015 New Revision: 30360 URL: http://svn.gna.org/viewcvs/freeciv?rev=30360=rev Log: Make sure that ws2tcpip.h is never included after windows.h by including it before when ever it might be needed. See bug #24000 Modified: branches/S2_6/client/client_main.c branches/S2_6/client/clinet.c branches/S2_6/client/connectdlg_common.c branches/S2_6/client/gui-sdl/gui_main.c branches/S2_6/client/gui-sdl2/gui_main.c branches/S2_6/client/servers.c branches/S2_6/common/connection.c branches/S2_6/common/dataio.c branches/S2_6/common/packets.c branches/S2_6/server/civserver.c branches/S2_6/server/meta.c branches/S2_6/server/sernet.c branches/S2_6/server/srv_main.c branches/S2_6/utility/fcthread.h branches/S2_6/utility/ioz.c branches/S2_6/utility/netintf.c branches/S2_6/utility/netintf.h branches/S2_6/utility/shared.c branches/S2_6/utility/support.c Modified: branches/S2_6/client/client_main.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/client_main.c?rev=30360=30359=30360=diff == --- branches/S2_6/client/client_main.c (original) +++ branches/S2_6/client/client_main.c Sun Nov 1 19:55:00 2015 @@ -15,6 +15,9 @@ #include #endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif #ifdef WIN32_NATIVE #include/* LoadLibrary() */ #endif Modified: branches/S2_6/client/clinet.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/clinet.c?rev=30360=30359=30360=diff == --- branches/S2_6/client/clinet.c (original) +++ branches/S2_6/client/clinet.c Sun Nov 1 19:55:00 2015 @@ -52,6 +52,9 @@ #endif #ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#include #endif #ifdef HAVE_WINSOCK #include Modified: branches/S2_6/client/connectdlg_common.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/connectdlg_common.c?rev=30360=30359=30360=diff == --- branches/S2_6/client/connectdlg_common.c(original) +++ branches/S2_6/client/connectdlg_common.cSun Nov 1 19:55:00 2015 @@ -20,6 +20,9 @@ #include #include +#ifdef HAVE_WS2TCPIP_H +#include +#endif #ifdef WIN32_NATIVE #include #endif Modified: branches/S2_6/client/gui-sdl/gui_main.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl/gui_main.c?rev=30360=30359=30360=diff == --- branches/S2_6/client/gui-sdl/gui_main.c (original) +++ branches/S2_6/client/gui-sdl/gui_main.c Sun Nov 1 19:55:00 2015 @@ -33,6 +33,9 @@ #include #endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif #ifdef HAVE_WINSOCK #include #endif Modified: branches/S2_6/client/gui-sdl2/gui_main.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/gui_main.c?rev=30360=30359=30360=diff == --- branches/S2_6/client/gui-sdl2/gui_main.c(original) +++ branches/S2_6/client/gui-sdl2/gui_main.cSun Nov 1 19:55:00 2015 @@ -33,6 +33,9 @@ #include #endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif #ifdef HAVE_WINSOCK #include #endif Modified: branches/S2_6/client/servers.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/servers.c?rev=30360=30359=30360=diff == --- branches/S2_6/client/servers.c (original) +++ branches/S2_6/client/servers.c Sun Nov 1 19:55:00 2015 @@ -47,6 +47,9 @@ #endif #ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#include #endif #ifdef HAVE_WINSOCK #include Modified: branches/S2_6/common/connection.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/connection.c?rev=30360=30359=30360=diff == --- branches/S2_6/common/connection.c (original) +++ branches/S2_6/common/connection.c Sun Nov 1 19:55:00 2015 @@ -28,6 +28,9 @@ #endif #ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#include #endif #ifdef HAVE_WINSOCK #include Modified: branches/S2_6/common/dataio.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/dataio.c?rev=30360=30359=30360=diff == --- branches/S2_6/common/dataio.c (original) +++ branches/S2_6/common/dataio.c Sun Nov 1 19:55:00 2015 @@ -41,6 +41,9 @@ #endif #ifdef HAVE_ARPA_INET_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#include #endif #ifdef HAVE_WINSOCK #include Modified: branches/S2_6/common/packets.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/packets.c?rev=30360=30359=30360=diff
[Freeciv-commits] r30362 - /trunk/server/citytools.c
Author: cazfi Date: Sun Nov 1 20:00:50 2015 New Revision: 30362 URL: http://svn.gna.org/viewcvs/freeciv?rev=30362=rev Log: Use '_safe' iteration when iterating through city traderoutes to remove. See bug #24004 Modified: trunk/server/citytools.c Modified: trunk/server/citytools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=30362=30361=30362=diff == --- trunk/server/citytools.c(original) +++ trunk/server/citytools.cSun Nov 1 20:00:50 2015 @@ -1714,9 +1714,9 @@ return; } - trade_routes_iterate(pcity, pother_city) { -remove_trade_route(pcity, pother_city, TRUE, TRUE); - } trade_routes_iterate_end; + trade_routes_iterate_safe(pcity, proute) { +remove_trade_route(pcity, proute, TRUE, TRUE); + } trade_routes_iterate_safe_end; map_clear_border(pcenter); city_workers_queue_remove(pcity); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30351 - /branches/S2_6/client/gui-qt/citydlg.cpp
Author: mir3x Date: Sun Nov 1 18:53:01 2015 New Revision: 30351 URL: http://svn.gna.org/viewcvs/freeciv?rev=30351=rev Log: Shows scrollbars in city production, and only when needed - in Qt-client. See patch #6504 Modified: branches/S2_6/client/gui-qt/citydlg.cpp Modified: branches/S2_6/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/citydlg.cpp?rev=30351=30350=30351=diff == --- branches/S2_6/client/gui-qt/citydlg.cpp (original) +++ branches/S2_6/client/gui-qt/citydlg.cpp Sun Nov 1 18:53:01 2015 @@ -2926,8 +2926,20 @@ const QItemSelection &))); resizeRowsToContents(); resizeColumnsToContents(); - setFixedWidth(3 * sh.x() + 5); - setFixedHeight(list_model->rowCount()*sh.y() + 5); + setFixedWidth(3 * sh.x() + 6); + setFixedHeight(list_model->rowCount()*sh.y() + 6); + if (width() > desk_width) { +setFixedWidth(desk_width); +setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + } else { +setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + } + if (height() > desk_height) { +setFixedHeight(desk_height); +setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + } else { +setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + } pos = QCursor::pos(); if (pos.x() + width() > desk_width) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30340 - /trunk/client/gui-qt/optiondlg.cpp
Author: mir3x Date: Sun Nov 1 18:24:10 2015 New Revision: 30340 URL: http://svn.gna.org/viewcvs/freeciv?rev=30340=rev Log: Added splitting of tooltips into max 80 characters in Qt-client. See bug #23972 Modified: trunk/client/gui-qt/optiondlg.cpp Modified: trunk/client/gui-qt/optiondlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/optiondlg.cpp?rev=30340=30339=30340=diff == --- trunk/client/gui-qt/optiondlg.cpp (original) +++ trunk/client/gui-qt/optiondlg.cpp Sun Nov 1 18:24:10 2015 @@ -48,6 +48,39 @@ /* global value to store pointers to opened config dialogs */ QMap dialog_list; +/ + Splits long text to 80 characters +/ +static QString split_text(QString text) +{ + QStringList sl; + QString st, str, result; + int i; + + sl = text.split("\n"); + foreach (const QString , sl) { +st = s; +while (st.count() >= 80) { + str = st.left(80); + i = str.lastIndexOf(' '); + if (i == -1) { +i = 80; + } + result = result + str.left(i) + '\n'; + /* Skip last space - at (i + 1) + unless there there was no space */ + if (i != 80) { +st.remove(0, i + 1); + } else { +st.remove(0, i); + } +} +str = st; +result = result + str.left(str.count()) + '\n'; + } + result.remove(result.lastIndexOf('\n'), 1); + return result; +} / Constructor for options dialog. @@ -671,7 +704,7 @@ hbox_layout = new QHBoxLayout(); hbox_layout->setAlignment(Qt::AlignRight); label = new QLabel(description); -label->setToolTip(option_help_text(poption)); +label->setToolTip(split_text(option_help_text(poption))); hbox_layout->addWidget(label, 1, Qt::AlignLeft); hbox_layout->addStretch(); hbox_layout->addWidget(widget, 1, Qt::AlignRight); @@ -682,7 +715,7 @@ } widget->setEnabled(option_is_changeable(poption)); - widget->setToolTip(option_help_text(poption)); + widget->setToolTip(split_text(option_help_text(poption))); option_set_gui_data(poption, widget); option_dialog_refresh(poption); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30339 - /branches/S2_6/client/gui-qt/optiondlg.cpp
Author: mir3x Date: Sun Nov 1 18:24:04 2015 New Revision: 30339 URL: http://svn.gna.org/viewcvs/freeciv?rev=30339=rev Log: Added splitting of tooltips into max 80 characters in Qt-client. See bug #23972 Modified: branches/S2_6/client/gui-qt/optiondlg.cpp Modified: branches/S2_6/client/gui-qt/optiondlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/optiondlg.cpp?rev=30339=30338=30339=diff == --- branches/S2_6/client/gui-qt/optiondlg.cpp (original) +++ branches/S2_6/client/gui-qt/optiondlg.cpp Sun Nov 1 18:24:04 2015 @@ -48,6 +48,39 @@ /* global value to store pointers to opened config dialogs */ QMap dialog_list; +/ + Splits long text to 80 characters +/ +static QString split_text(QString text) +{ + QStringList sl; + QString st, str, result; + int i; + + sl = text.split("\n"); + foreach (const QString , sl) { +st = s; +while (st.count() >= 80) { + str = st.left(80); + i = str.lastIndexOf(' '); + if (i == -1) { +i = 80; + } + result = result + str.left(i) + '\n'; + /* Skip last space - at (i + 1) + unless there there was no space */ + if (i != 80) { +st.remove(0, i + 1); + } else { +st.remove(0, i); + } +} +str = st; +result = result + str.left(str.count()) + '\n'; + } + result.remove(result.lastIndexOf('\n'), 1); + return result; +} / Constructor for options dialog. @@ -671,7 +704,7 @@ hbox_layout = new QHBoxLayout(); hbox_layout->setAlignment(Qt::AlignRight); label = new QLabel(description); -label->setToolTip(option_help_text(poption)); +label->setToolTip(split_text(option_help_text(poption))); hbox_layout->addWidget(label, 1, Qt::AlignLeft); hbox_layout->addStretch(); hbox_layout->addWidget(widget, 1, Qt::AlignRight); @@ -682,7 +715,7 @@ } widget->setEnabled(option_is_changeable(poption)); - widget->setToolTip(option_help_text(poption)); + widget->setToolTip(split_text(option_help_text(poption))); option_set_gui_data(poption, widget); option_dialog_refresh(poption); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30343 - /trunk/client/gui-qt/messagewin.cpp
Author: mir3x Date: Sun Nov 1 18:29:42 2015 New Revision: 30343 URL: http://svn.gna.org/viewcvs/freeciv?rev=30343=rev Log: When resizing messages view or chat, holding left click could trigger keyabordless goto. Fixed. See bug #23994 Modified: trunk/client/gui-qt/messagewin.cpp Modified: trunk/client/gui-qt/messagewin.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/messagewin.cpp?rev=30343=30342=30343=diff == --- trunk/client/gui-qt/messagewin.cpp (original) +++ trunk/client/gui-qt/messagewin.cpp Sun Nov 1 18:29:42 2015 @@ -112,7 +112,7 @@ resx = true; } } - event->setAccepted(false); + event->setAccepted(true); } /*** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30337 - in /trunk/client/gui-qt: menu.cpp menu.h
Author: mir3x Date: Sun Nov 1 18:00:36 2015 New Revision: 30337 URL: http://svn.gna.org/viewcvs/freeciv?rev=30337=rev Log: Added menu entries: "Save Options Now" and checkable "Save Options on Exit" for Qt client. See bug #23950 Modified: trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/menu.h Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=30337=30336=30337=diff == --- trunk/client/gui-qt/menu.cpp(original) +++ trunk/client/gui-qt/menu.cppSun Nov 1 18:00:36 2015 @@ -571,6 +571,12 @@ connect(act, SIGNAL(triggered()), this, SLOT(server_options())); act = menu->addAction(_("Messages")); connect(act, SIGNAL(triggered()), this, SLOT(messages_options())); + act = menu->addAction(_("Save Options Now")); + act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton)); + connect(act, SIGNAL(triggered()), this, SLOT(save_options_now())); + act = menu->addAction(_("Save Options on Exit")); + act->setCheckable(true); + act->setChecked(gui_options.save_options_on_exit); menu = pr; menu->addSeparator(); act = menu->addAction(_("Save Game")); @@ -2227,6 +2233,14 @@ popup_messageopt_dialog(); } +/ + Menu Save Options Now +*/ +void mr_menu::save_options_now() +{ + options_save(); +} + /*** Invoke popup for quiting game ***/ Modified: trunk/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.h?rev=30337=30336=30337=diff == --- trunk/client/gui-qt/menu.h (original) +++ trunk/client/gui-qt/menu.h Sun Nov 1 18:00:36 2015 @@ -183,6 +183,7 @@ void local_options(); void server_options(); void messages_options(); + void save_options_now(); void save_game(); void save_game_as(); void back_to_menu(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30335 - in /branches/S2_5/client/gui-qt: menu.cpp menu.h
Author: mir3x Date: Sun Nov 1 18:00:13 2015 New Revision: 30335 URL: http://svn.gna.org/viewcvs/freeciv?rev=30335=rev Log: Added menu entries: "Save Options Now" and checkable "Save Options on Exit" for Qt client. See bug #23950 Modified: branches/S2_5/client/gui-qt/menu.cpp branches/S2_5/client/gui-qt/menu.h Modified: branches/S2_5/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=30335=30334=30335=diff == --- branches/S2_5/client/gui-qt/menu.cpp(original) +++ branches/S2_5/client/gui-qt/menu.cppSun Nov 1 18:00:13 2015 @@ -415,6 +415,12 @@ connect(act, SIGNAL(triggered()), this, SLOT(server_options())); act = menu->addAction(_("Messages")); connect(act, SIGNAL(triggered()), this, SLOT(messages_options())); + act = menu->addAction(_("Save Options Now")); + act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton)); + connect(act, SIGNAL(triggered()), this, SLOT(save_options_now())); + act = menu->addAction(_("Save Options on Exit")); + act->setCheckable(true); + act->setChecked(save_options_on_exit); menu = pr; menu->addSeparator(); act = menu->addAction(_("Save Game")); @@ -1955,6 +1961,14 @@ popup_messageopt_dialog(); } +/ + Menu Save Options Now +*/ +void mr_menu::save_options_now() +{ + options_save(); +} + /*** Invoke popup for quiting game ***/ Modified: branches/S2_5/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.h?rev=30335=30334=30335=diff == --- branches/S2_5/client/gui-qt/menu.h (original) +++ branches/S2_5/client/gui-qt/menu.h Sun Nov 1 18:00:13 2015 @@ -155,6 +155,7 @@ void local_options(); void server_options(); void messages_options(); + void save_options_now(); void save_game(); void save_game_as(); void back_to_menu(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30338 - /branches/S2_5/client/gui-qt/optiondlg.cpp
Author: mir3x Date: Sun Nov 1 18:23:54 2015 New Revision: 30338 URL: http://svn.gna.org/viewcvs/freeciv?rev=30338=rev Log: Added splitting of tooltips into max 80 characters in Qt-client. See bug #23972 Modified: branches/S2_5/client/gui-qt/optiondlg.cpp Modified: branches/S2_5/client/gui-qt/optiondlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/optiondlg.cpp?rev=30338=30337=30338=diff == --- branches/S2_5/client/gui-qt/optiondlg.cpp (original) +++ branches/S2_5/client/gui-qt/optiondlg.cpp Sun Nov 1 18:23:54 2015 @@ -48,6 +48,39 @@ /* global value to store pointers to opened config dialogs */ QMap dialog_list; +/ + Splits long text to 80 characters +/ +static QString split_text(QString text) +{ + QStringList sl; + QString st, str, result; + int i; + + sl = text.split("\n"); + foreach (const QString , sl) { +st = s; +while (st.count() >= 80) { + str = st.left(80); + i = str.lastIndexOf(' '); + if (i == -1) { +i = 80; + } + result = result + str.left(i) + '\n'; + /* Skip last space - at (i + 1) + unless there there was no space */ + if (i != 80) { +st.remove(0, i + 1); + } else { +st.remove(0, i); + } +} +str = st; +result = result + str.left(str.count()) + '\n'; + } + result.remove(result.lastIndexOf('\n'), 1); + return result; +} / Constructor for options dialog. @@ -671,7 +704,7 @@ hbox_layout = new QHBoxLayout(); hbox_layout->setAlignment(Qt::AlignRight); label = new QLabel(description); -label->setToolTip(option_help_text(poption)); +label->setToolTip(split_text(option_help_text(poption))); hbox_layout->addWidget(label, 1, Qt::AlignLeft); hbox_layout->addStretch(); hbox_layout->addWidget(widget, 1, Qt::AlignRight); @@ -682,7 +715,7 @@ } widget->setEnabled(option_is_changeable(poption)); - widget->setToolTip(option_help_text(poption)); + widget->setToolTip(split_text(option_help_text(poption))); option_set_gui_data(poption, widget); option_dialog_refresh(poption); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30354 - /branches/S2_6/ai/default/advmilitary.c
Author: cazfi Date: Sun Nov 1 18:55:18 2015 New Revision: 30354 URL: http://svn.gna.org/viewcvs/freeciv?rev=30354=rev Log: Work around a problem of defense bonus originating from a source not counting as 'wall', in the default AI terminology, reducing defender want. See bug #23997 Modified: branches/S2_6/ai/default/advmilitary.c Modified: branches/S2_6/ai/default/advmilitary.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/advmilitary.c?rev=30354=30353=30354=diff == --- branches/S2_6/ai/default/advmilitary.c (original) +++ branches/S2_6/ai/default/advmilitary.c Sun Nov 1 18:55:18 2015 @@ -795,9 +795,15 @@ int limit_cost = pcity->shield_stock + 40; if (walls && !utype_has_flag(punittype, UTYF_BADCITYDEFENDER)) { - desire *= city_data->wallvalue; - /* TODO: More use of POWER_FACTOR ! */ - desire /= POWER_FACTOR; +/* FIXME: Below if() is just workaround to make sure desire + *is not made zero when 'walls' above is not actually + *walls that increase wallvalue, but misdiagnosed + *because of some other defense bonus the city gets. */ +if (city_data->wallvalue > POWER_FACTOR) { + desire *= city_data->wallvalue; + /* TODO: More use of POWER_FACTOR ! */ + desire /= POWER_FACTOR; +} } if ((best_unit_cost > limit_cost ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30357 - /branches/S2_6/client/gui-qt/chatline.cpp
Author: mir3x Date: Sun Nov 1 18:56:01 2015 New Revision: 30357 URL: http://svn.gna.org/viewcvs/freeciv?rev=30357=rev Log: Changed all html tags in chat output (usually player nicknames were treated as html) to non-html tags [Yxx] if Y is uppercase letter in Qt-client. See patch #6505 Modified: branches/S2_6/client/gui-qt/chatline.cpp Modified: branches/S2_6/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/chatline.cpp?rev=30357=30356=30357=diff == --- branches/S2_6/client/gui-qt/chatline.cpp(original) +++ branches/S2_6/client/gui-qt/chatline.cppSun Nov 1 18:56:01 2015 @@ -390,6 +390,7 @@ static QString replace_html(QString str) { QString s, s2; + int i, j; conn_list_iterate(game.all_connections, pconn){ s = pconn->username; s = "<(" + s + ")>"; @@ -420,6 +421,24 @@ str = str.replace(s, s2); } } players_iterate_end; + /* replace all where X is uppercase letter + * with [X ], its definitely message from server + * not html tag */ + j = 0; + while (1) { +QChar c; +i = str.indexOf('<', j); +j = str.indexOf('>', i); +if (i + 1 >= str.length() || i == -1 || j == -1) { + break; +} +c = str.at(i + 1); +if (c.isUpper()) { + str.replace(i, 1 , '['); + str.replace(j, 1 , ']'); +} +j++; + } return str; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30358 - /trunk/client/gui-qt/chatline.cpp
Author: mir3x Date: Sun Nov 1 18:56:10 2015 New Revision: 30358 URL: http://svn.gna.org/viewcvs/freeciv?rev=30358=rev Log: Changed all html tags in chat output (usually player nicknames were treated as html) to non-html tags [Yxx] if Y is uppercase letter in Qt-client. See patch #6505 Modified: trunk/client/gui-qt/chatline.cpp Modified: trunk/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/chatline.cpp?rev=30358=30357=30358=diff == --- trunk/client/gui-qt/chatline.cpp(original) +++ trunk/client/gui-qt/chatline.cppSun Nov 1 18:56:10 2015 @@ -390,6 +390,7 @@ static QString replace_html(QString str) { QString s, s2; + int i, j; conn_list_iterate(game.all_connections, pconn){ s = pconn->username; s = "<(" + s + ")>"; @@ -420,6 +421,24 @@ str = str.replace(s, s2); } } players_iterate_end; + /* replace all where X is uppercase letter + * with [X ], its definitely message from server + * not html tag */ + j = 0; + while (1) { +QChar c; +i = str.indexOf('<', j); +j = str.indexOf('>', i); +if (i + 1 >= str.length() || i == -1 || j == -1) { + break; +} +c = str.at(i + 1); +if (c.isUpper()) { + str.replace(i, 1 , '['); + str.replace(j, 1 , ']'); +} +j++; + } return str; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30356 - /branches/S2_5/client/gui-qt/chatline.cpp
Author: mir3x Date: Sun Nov 1 18:55:45 2015 New Revision: 30356 URL: http://svn.gna.org/viewcvs/freeciv?rev=30356=rev Log: Changed all html tags in chat output (usually player nicknames were treated as html) to non-html tags [Yxx] if Y is uppercase letter in Qt-client. See patch #6505 Modified: branches/S2_5/client/gui-qt/chatline.cpp Modified: branches/S2_5/client/gui-qt/chatline.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/chatline.cpp?rev=30356=30355=30356=diff == --- branches/S2_5/client/gui-qt/chatline.cpp(original) +++ branches/S2_5/client/gui-qt/chatline.cppSun Nov 1 18:55:45 2015 @@ -389,6 +389,7 @@ static QString replace_html(QString str) { QString s, s2; + int i, j; conn_list_iterate(game.all_connections, pconn){ s = pconn->username; s = "<(" + s + ")>"; @@ -419,6 +420,24 @@ str = str.replace(s, s2); } } players_iterate_end; + /* replace all where X is uppercase letter + * with [X ], its definitely message from server + * not html tag */ + j = 0; + while (1) { +QChar c; +i = str.indexOf('<', j); +j = str.indexOf('>', i); +if (i + 1 >= str.length() || i == -1 || j == -1) { + break; +} +c = str.at(i + 1); +if (c.isUpper()) { + str.replace(i, 1 , '['); + str.replace(j, 1 , ']'); +} +j++; + } return str; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30342 - /branches/S2_6/client/gui-qt/messagewin.cpp
Author: mir3x Date: Sun Nov 1 18:29:36 2015 New Revision: 30342 URL: http://svn.gna.org/viewcvs/freeciv?rev=30342=rev Log: When resizing messages view or chat, holding left click could trigger keyabordless goto. Fixed. See bug #23994 Modified: branches/S2_6/client/gui-qt/messagewin.cpp Modified: branches/S2_6/client/gui-qt/messagewin.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/messagewin.cpp?rev=30342=30341=30342=diff == --- branches/S2_6/client/gui-qt/messagewin.cpp (original) +++ branches/S2_6/client/gui-qt/messagewin.cpp Sun Nov 1 18:29:36 2015 @@ -112,7 +112,7 @@ resx = true; } } - event->setAccepted(false); + event->setAccepted(true); } /*** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30341 - /branches/S2_5/client/gui-qt/messagewin.cpp
Author: mir3x Date: Sun Nov 1 18:29:29 2015 New Revision: 30341 URL: http://svn.gna.org/viewcvs/freeciv?rev=30341=rev Log: When resizing messages view or chat, holding left click could trigger keyabordless goto. Fixed. See bug #23994 Modified: branches/S2_5/client/gui-qt/messagewin.cpp Modified: branches/S2_5/client/gui-qt/messagewin.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/messagewin.cpp?rev=30341=30340=30341=diff == --- branches/S2_5/client/gui-qt/messagewin.cpp (original) +++ branches/S2_5/client/gui-qt/messagewin.cpp Sun Nov 1 18:29:29 2015 @@ -112,7 +112,7 @@ resx = true; } } - event->setAccepted(false); + event->setAccepted(true); } /*** ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30371 - in /branches/S2_5/data: alien/ civ1/ civ2/ civ2civ3/ classic/ experimental/ multiplayer/
Author: cazfi Date: Mon Nov 2 01:25:15 2015 New Revision: 30371 URL: http://svn.gna.org/viewcvs/freeciv?rev=30371=rev Log: Added ruleset comments related to trait values. See bug #23976 Modified: branches/S2_5/data/alien/nations.ruleset branches/S2_5/data/civ1/nations.ruleset branches/S2_5/data/civ2/nations.ruleset branches/S2_5/data/civ2civ3/nations.ruleset branches/S2_5/data/classic/nations.ruleset branches/S2_5/data/experimental/nations.ruleset branches/S2_5/data/multiplayer/nations.ruleset Modified: branches/S2_5/data/alien/nations.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/alien/nations.ruleset?rev=30371=30370=30371=diff == --- branches/S2_5/data/alien/nations.ruleset(original) +++ branches/S2_5/data/alien/nations.rulesetMon Nov 2 01:25:15 2015 @@ -16,9 +16,19 @@ default_government = "Despotism" [default_traits] +; Default values for the AI traits. These are used if nation specific +; value for some trait has not been used. If these default too are +; not defined, the ultimate default is 50. + +; Value of trait "expansionist" defines how much AI wants to settle new territory. ;expansionist = 50 + +; Value of trait "trader" defines how much AI wants to establish trade routes. ;trader = 50 + +; Value of trait "aggressive" defines how easily AI declares war. ;aggressive = 50 + ; Descriptions of nation sets ; These are self-contained subsets of the available nations; one of these Modified: branches/S2_5/data/civ1/nations.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ1/nations.ruleset?rev=30371=30370=30371=diff == --- branches/S2_5/data/civ1/nations.ruleset (original) +++ branches/S2_5/data/civ1/nations.ruleset Mon Nov 2 01:25:15 2015 @@ -20,9 +20,19 @@ default_government = "Despotism" [default_traits] +; Default values for the AI traits. These are used if nation specific +; value for some trait has not been used. If these default too are +; not defined, the ultimate default is 50. + +; Value of trait "expansionist" defines how much AI wants to settle new territory. ;expansionist = 50 + +; Value of trait "trader" defines how much AI wants to establish trade routes. ;trader = 50 + +; Value of trait "aggressive" defines how easily AI declares war. ;aggressive = 50 + ; Descriptions of nation sets ; These are self-contained subsets of the available nations; one of these Modified: branches/S2_5/data/civ2/nations.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ2/nations.ruleset?rev=30371=30370=30371=diff == --- branches/S2_5/data/civ2/nations.ruleset (original) +++ branches/S2_5/data/civ2/nations.ruleset Mon Nov 2 01:25:15 2015 @@ -22,9 +22,19 @@ default_government = "Despotism" [default_traits] +; Default values for the AI traits. These are used if nation specific +; value for some trait has not been used. If these default too are +; not defined, the ultimate default is 50. + +; Value of trait "expansionist" defines how much AI wants to settle new territory. ;expansionist = 50 + +; Value of trait "trader" defines how much AI wants to establish trade routes. ;trader = 50 + +; Value of trait "aggressive" defines how easily AI declares war. ;aggressive = 50 + ; Descriptions of nation sets ; These are self-contained subsets of the available nations; one of these Modified: branches/S2_5/data/civ2civ3/nations.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ2civ3/nations.ruleset?rev=30371=30370=30371=diff == --- branches/S2_5/data/civ2civ3/nations.ruleset (original) +++ branches/S2_5/data/civ2civ3/nations.ruleset Mon Nov 2 01:25:15 2015 @@ -17,8 +17,18 @@ default_government = "Despotism" [default_traits] +; Default values for the AI traits. These are used if nation specific +; value for some trait has not been used. If these default too are +; not defined, the ultimate default is 50. + +; Value of trait "expansionist" defines how much AI wants to settle new territory. ;expansionist = 50 + +; Value of trait "trader" defines how much AI wants to establish trade routes. ;trader = 50 + +; Value of trait "aggressive" defines how easily AI declares war. ;aggressive = 50 + *include "default/nationlist.ruleset" Modified: branches/S2_5/data/classic/nations.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/classic/nations.ruleset?rev=30371=30370=30371=diff == --- branches/S2_5/data/classic/nations.ruleset (original) +++ branches/S2_5/data/classic/nations.ruleset Mon Nov 2 01:25:15 2015 @@ -17,8 +17,18 @@ default_government =
[Freeciv-commits] r30359 - in /trunk: client/ client/gui-sdl2/ common/ server/ utility/
Author: cazfi Date: Sun Nov 1 19:54:52 2015 New Revision: 30359 URL: http://svn.gna.org/viewcvs/freeciv?rev=30359=rev Log: Make sure that ws2tcpip.h is never included after windows.h by including it before when ever it might be needed. See bug #24000 Modified: trunk/client/client_main.c trunk/client/clinet.c trunk/client/connectdlg_common.c trunk/client/gui-sdl2/gui_main.c trunk/client/servers.c trunk/common/connection.c trunk/common/dataio.c trunk/common/packets.c trunk/server/civserver.c trunk/server/meta.c trunk/server/sernet.c trunk/server/srv_main.c trunk/utility/fcthread.h trunk/utility/ioz.c trunk/utility/netintf.c trunk/utility/netintf.h trunk/utility/shared.c trunk/utility/support.c Modified: trunk/client/client_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/client_main.c?rev=30359=30358=30359=diff == --- trunk/client/client_main.c (original) +++ trunk/client/client_main.c Sun Nov 1 19:54:52 2015 @@ -15,6 +15,9 @@ #include #endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif #ifdef WIN32_NATIVE #include/* LoadLibrary() */ #endif Modified: trunk/client/clinet.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/clinet.c?rev=30359=30358=30359=diff == --- trunk/client/clinet.c (original) +++ trunk/client/clinet.c Sun Nov 1 19:54:52 2015 @@ -52,6 +52,9 @@ #endif #ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#include #endif #ifdef HAVE_WINSOCK #include Modified: trunk/client/connectdlg_common.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/connectdlg_common.c?rev=30359=30358=30359=diff == --- trunk/client/connectdlg_common.c(original) +++ trunk/client/connectdlg_common.cSun Nov 1 19:54:52 2015 @@ -20,6 +20,9 @@ #include #include +#ifdef HAVE_WS2TCPIP_H +#include +#endif #ifdef WIN32_NATIVE #include #endif Modified: trunk/client/gui-sdl2/gui_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/gui_main.c?rev=30359=30358=30359=diff == --- trunk/client/gui-sdl2/gui_main.c(original) +++ trunk/client/gui-sdl2/gui_main.cSun Nov 1 19:54:52 2015 @@ -33,6 +33,9 @@ #include #endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif #ifdef HAVE_WINSOCK #include #endif Modified: trunk/client/servers.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/servers.c?rev=30359=30358=30359=diff == --- trunk/client/servers.c (original) +++ trunk/client/servers.c Sun Nov 1 19:54:52 2015 @@ -47,6 +47,9 @@ #endif #ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#include #endif #ifdef HAVE_WINSOCK #include Modified: trunk/common/connection.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/connection.c?rev=30359=30358=30359=diff == --- trunk/common/connection.c (original) +++ trunk/common/connection.c Sun Nov 1 19:54:52 2015 @@ -28,6 +28,9 @@ #endif #ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#include #endif #ifdef HAVE_WINSOCK #include Modified: trunk/common/dataio.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/dataio.c?rev=30359=30358=30359=diff == --- trunk/common/dataio.c (original) +++ trunk/common/dataio.c Sun Nov 1 19:54:52 2015 @@ -41,6 +41,9 @@ #endif #ifdef HAVE_ARPA_INET_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#include #endif #ifdef HAVE_WINSOCK #include Modified: trunk/common/packets.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/packets.c?rev=30359=30358=30359=diff == --- trunk/common/packets.c (original) +++ trunk/common/packets.c Sun Nov 1 19:54:52 2015 @@ -25,6 +25,9 @@ #endif #ifdef HAVE_NETINET_IN_H #include +#endif +#ifdef HAVE_WS2TCPIP_H +#include #endif #ifdef HAVE_WINSOCK #include Modified: trunk/server/civserver.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/civserver.c?rev=30359=30358=30359=diff == --- trunk/server/civserver.c(original) +++ trunk/server/civserver.cSun Nov 1 19:54:52 2015 @@ -32,6 +32,9 @@ #include #endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif #ifdef WIN32_NATIVE #include #endif Modified: trunk/server/meta.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/meta.c?rev=30359=30358=30359=diff
[Freeciv-commits] r30361 - in /branches/S2_5: configure.ac utility/netintf.h
Author: cazfi Date: Sun Nov 1 19:56:47 2015 New Revision: 30361 URL: http://svn.gna.org/viewcvs/freeciv?rev=30361=rev Log: Do not include , mostly reverting patch #6496 See bug #24000 Modified: branches/S2_5/configure.ac branches/S2_5/utility/netintf.h Modified: branches/S2_5/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/configure.ac?rev=30361=30360=30361=diff == --- branches/S2_5/configure.ac (original) +++ branches/S2_5/configure.ac Sun Nov 1 19:56:47 2015 @@ -1138,16 +1138,12 @@ AC_C_CONST AC_HEADER_TIME AC_STRUCT_TM -AC_CHECK_HEADERS([ws2tcpip.h]) AC_CHECK_TYPES([socklen_t], [], [], [#ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include -#endif -#ifdef HAVE_WS2TCPIP_H -#include #endif ]) AC_TYPE_INTPTR_T Modified: branches/S2_5/utility/netintf.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/netintf.h?rev=30361=30360=30361=diff == --- branches/S2_5/utility/netintf.h (original) +++ branches/S2_5/utility/netintf.h Sun Nov 1 19:56:47 2015 @@ -43,10 +43,8 @@ #ifdef HAVE_WINSOCK #include #endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif +/* utility */ #include "ioz.h" #include "support.h"/* bool type */ ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30363 - /trunk/client/gui-sdl2/wldlg.c
Author: cazfi Date: Sun Nov 1 21:47:55 2015 New Revision: 30363 URL: http://svn.gna.org/viewcvs/freeciv?rev=30363=rev Log: Do not show nonsensical progress percentage for IF_GOLD build targets in sdl-clients' worklist editor. See patch #6510 Modified: trunk/client/gui-sdl2/wldlg.c Modified: trunk/client/gui-sdl2/wldlg.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/wldlg.c?rev=30363=30362=30363=diff == --- trunk/client/gui-sdl2/wldlg.c (original) +++ trunk/client/gui-sdl2/wldlg.c Sun Nov 1 21:47:55 2015 @@ -872,9 +872,9 @@ /** Return progress icon (bar) of current production state - stock - current shielsd stocks + stock - current shields stocks cost - unit/imprv. cost - function return in "proggres" pointer (0 - 100 %) progress in numbers + function return in "progress" pointer (0 - 100 %) progress in numbers **/ static SDL_Surface *get_progress_icon(int stock, int cost, int *progress) { @@ -918,11 +918,11 @@ int cost, turns; char cBuf[64]; SDL_Rect area; + bool gold_prod = improvement_has_flag(pEditor->currently_building.value.building, IF_GOLD); const char *name = get_production_name(pEditor->pCity, pEditor->currently_building, ); - if (VUT_IMPROVEMENT == pEditor->currently_building.kind - && improvement_has_flag(pEditor->currently_building.value.building, IF_GOLD)) { + if (VUT_IMPROVEMENT == pEditor->currently_building.kind && gold_prod) { int gold = MAX(0, pEditor->pCity->surplus[O_SHIELD]); fc_snprintf(cBuf, sizeof(cBuf), @@ -967,7 +967,11 @@ pEditor->pProduction_Progres->theme = get_progress_icon(stock, cost, ); - fc_snprintf(cBuf, sizeof(cBuf), "%d%%" , cost); + if (!gold_prod) { +fc_snprintf(cBuf, sizeof(cBuf), "%d%%" , cost); + } else { +fc_snprintf(cBuf, sizeof(cBuf), "-"); + } copy_chars_to_utf8_str(pEditor->pProduction_Progres->string_utf8, cBuf); widget_redraw(pEditor->pProduction_Progres); widget_mark_dirty(pEditor->pProduction_Progres); @@ -1117,10 +1121,11 @@ /* count == cost */ /* turns == progress */ const char *name = city_production_name_translation(pCity); +bool gold_prod = city_production_has_flag(pCity, IF_GOLD); count = city_production_build_shield_cost(pCity); -if (city_production_has_flag(pCity, IF_GOLD)) { +if (gold_prod) { int gold = MAX(0, pCity->surplus[O_SHIELD]); fc_snprintf(cbuf, sizeof(cbuf), @@ -1149,7 +1154,11 @@ pIcon = get_progress_icon(pCity->shield_stock, count, ); -fc_snprintf(cbuf, sizeof(cbuf), "%d%%" , turns); +if (!gold_prod) { + fc_snprintf(cbuf, sizeof(cbuf), "%d%%" , turns); +} else { + fc_snprintf(cbuf, sizeof(cbuf), "-"); +} pstr = create_utf8_from_char(cbuf, adj_font(12)); pstr->style |= (TTF_STYLE_BOLD|SF_CENTER); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30364 - in /branches/S2_6/client: gui-sdl/wldlg.c gui-sdl2/wldlg.c
Author: cazfi Date: Sun Nov 1 21:48:03 2015 New Revision: 30364 URL: http://svn.gna.org/viewcvs/freeciv?rev=30364=rev Log: Do not show nonsensical progress percentage for IF_GOLD build targets in sdl-clients' worklist editor. See patch #6510 Modified: branches/S2_6/client/gui-sdl/wldlg.c branches/S2_6/client/gui-sdl2/wldlg.c Modified: branches/S2_6/client/gui-sdl/wldlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl/wldlg.c?rev=30364=30363=30364=diff == --- branches/S2_6/client/gui-sdl/wldlg.c(original) +++ branches/S2_6/client/gui-sdl/wldlg.cSun Nov 1 21:48:03 2015 @@ -860,19 +860,20 @@ } } -/* - * return progress icon (bar) of current production state - * stock - current shielsd stocks - * cost - unit/imprv. cost - * function return in "proggres" pointer (0 - 100 %) progress in numbers -*/ +/** + Return progress icon (bar) of current production state + stock - current shields stocks + cost - unit/imprv. cost + function return in "progress" pointer (0 - 100 %) progress in numbers +**/ static SDL_Surface * get_progress_icon(int stock, int cost, int *progress) { SDL_Surface *pIcon = NULL; int width; + fc_assert_ret_val(progress != NULL, NULL); - - if(stock < cost) { + + if (stock < cost) { width = ((float)stock / cost) * adj_size(116.0); *progress = ((float)stock / cost) * 100.0; if(!width && stock) { @@ -907,27 +908,26 @@ int cost, turns; char cBuf[64]; SDL_Rect area; + bool gold_prod = improvement_has_flag(pEditor->currently_building.value.building, IF_GOLD); const char *name = get_production_name(pEditor->pCity, - pEditor->currently_building, ); - - if (VUT_IMPROVEMENT == pEditor->currently_building.kind - && improvement_has_flag(pEditor->currently_building.value.building, IF_GOLD)) - { + pEditor->currently_building, ); + + if (VUT_IMPROVEMENT == pEditor->currently_building.kind && gold_prod) { int gold = MAX(0, pEditor->pCity->surplus[O_SHIELD]); + fc_snprintf(cBuf, sizeof(cBuf), PL_("%s\n%d gold per turn", "%s\n%d gold per turn", gold), name, gold); } else { -if(stock < cost) { +if (stock < cost) { turns = city_turns_to_build(pEditor->pCity, - pEditor->currently_building, TRUE); - if(turns == 999) - { + pEditor->currently_building, TRUE); + if (turns == 999) { fc_snprintf(cBuf, sizeof(cBuf), _("%s\nblocked!"), name); } else { fc_snprintf(cBuf, sizeof(cBuf), _("%s\n%d %s"), - name, turns, PL_("turn", "turns", turns)); +name, turns, PL_("turn", "turns", turns)); } } else { fc_snprintf(cBuf, sizeof(cBuf), _("%s\nfinished!"), name); @@ -939,8 +939,8 @@ remake_label_size(pEditor->pProduction_Name); pEditor->pProduction_Name->size.x = pEditor->pEndWidgetList->area.x + -(adj_size(130) - pEditor->pProduction_Name->size.w)/2; - +(adj_size(130) - pEditor->pProduction_Name->size.w) / 2; + area.x = pEditor->pEndWidgetList->area.x; area.y = pEditor->pProduction_Name->size.y; area.w = adj_size(130); @@ -949,15 +949,19 @@ if (get_wflags(pEditor->pProduction_Name) & WF_RESTORE_BACKGROUND) { refresh_widget_background(pEditor->pProduction_Name); } - + widget_redraw(pEditor->pProduction_Name); sdl_dirty_rect(area); - + FREESURFACE(pEditor->pProduction_Progres->theme); pEditor->pProduction_Progres->theme = - get_progress_icon(stock, cost, ); - - fc_snprintf(cBuf, sizeof(cBuf), "%d%%" , cost); +get_progress_icon(stock, cost, ); + + if (!gold_prod) { +fc_snprintf(cBuf, sizeof(cBuf), "%d%%" , cost); + } else { +fc_snprintf(cBuf, sizeof(cBuf), "-" ); + } copy_chars_to_string16(pEditor->pProduction_Progres->string16, cBuf); widget_redraw(pEditor->pProduction_Progres); widget_mark_dirty(pEditor->pProduction_Progres); @@ -1109,24 +1113,25 @@ /* count == cost */ /* turns == progress */ const char *name = city_production_name_translation(pCity); +bool gold_prod = city_production_has_flag(pCity, IF_GOLD); + count = city_production_build_shield_cost(pCity); - -if (city_production_has_flag(pCity, IF_GOLD)) -{ + +if (gold_prod) { int gold = MAX(0, pCity->surplus[O_SHIELD]); + fc_snprintf(cBuf, sizeof(cBuf), PL_("%s\n%d gold per turn", "%s\n%d gold per turn", gold), name, gold); } else { - if(pCity->shield_stock < count) { + if (pCity->shield_stock < count) {
[Freeciv-commits] r30365 - /branches/S2_5/client/gui-sdl/wldlg.c
Author: cazfi Date: Sun Nov 1 21:48:10 2015 New Revision: 30365 URL: http://svn.gna.org/viewcvs/freeciv?rev=30365=rev Log: Do not show nonsensical progress percentage for IF_GOLD build targets in sdl-clients' worklist editor. See patch #6510 Modified: branches/S2_5/client/gui-sdl/wldlg.c Modified: branches/S2_5/client/gui-sdl/wldlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/wldlg.c?rev=30365=30364=30365=diff == --- branches/S2_5/client/gui-sdl/wldlg.c(original) +++ branches/S2_5/client/gui-sdl/wldlg.cSun Nov 1 21:48:10 2015 @@ -859,19 +859,20 @@ } } -/* - * return progress icon (bar) of current production state - * stock - current shielsd stocks - * cost - unit/imprv. cost - * function return in "proggres" pointer (0 - 100 %) progress in numbers -*/ +/** + Return progress icon (bar) of current production state + stock - current shields stocks + cost - unit/imprv. cost + function return in "progress" pointer (0 - 100 %) progress in numbers +**/ static SDL_Surface * get_progress_icon(int stock, int cost, int *progress) { SDL_Surface *pIcon = NULL; int width; + fc_assert_ret_val(progress != NULL, NULL); - - if(stock < cost) { + + if (stock < cost) { width = ((float)stock / cost) * adj_size(116.0); *progress = ((float)stock / cost) * 100.0; if(!width && stock) { @@ -904,27 +905,26 @@ int cost, turns; char cBuf[64]; SDL_Rect area; + bool gold_prod = improvement_has_flag(pEditor->currently_building.value.building, IF_GOLD); const char *name = get_production_name(pEditor->pCity, - pEditor->currently_building, ); - - if (VUT_IMPROVEMENT == pEditor->currently_building.kind - && improvement_has_flag(pEditor->currently_building.value.building, IF_GOLD)) - { + pEditor->currently_building, ); + + if (VUT_IMPROVEMENT == pEditor->currently_building.kind && gold_prod) { int gold = MAX(0, pEditor->pCity->surplus[O_SHIELD]); + fc_snprintf(cBuf, sizeof(cBuf), PL_("%s\n%d gold per turn", "%s\n%d gold per turn", gold), name, gold); } else { -if(stock < cost) { +if (stock < cost) { turns = city_turns_to_build(pEditor->pCity, - pEditor->currently_building, TRUE); - if(turns == 999) - { + pEditor->currently_building, TRUE); + if (turns == 999) { fc_snprintf(cBuf, sizeof(cBuf), _("%s\nblocked!"), name); } else { fc_snprintf(cBuf, sizeof(cBuf), _("%s\n%d %s"), - name, turns, PL_("turn", "turns", turns)); +name, turns, PL_("turn", "turns", turns)); } } else { fc_snprintf(cBuf, sizeof(cBuf), _("%s\nfinished!"), name); @@ -936,8 +936,8 @@ remake_label_size(pEditor->pProduction_Name); pEditor->pProduction_Name->size.x = pEditor->pEndWidgetList->area.x + -(adj_size(130) - pEditor->pProduction_Name->size.w)/2; - +(adj_size(130) - pEditor->pProduction_Name->size.w) / 2; + area.x = pEditor->pEndWidgetList->area.x; area.y = pEditor->pProduction_Name->size.y; area.w = adj_size(130); @@ -946,15 +946,19 @@ if (get_wflags(pEditor->pProduction_Name) & WF_RESTORE_BACKGROUND) { refresh_widget_background(pEditor->pProduction_Name); } - + widget_redraw(pEditor->pProduction_Name); sdl_dirty_rect(area); - + FREESURFACE(pEditor->pProduction_Progres->theme); pEditor->pProduction_Progres->theme = - get_progress_icon(stock, cost, ); - - fc_snprintf(cBuf, sizeof(cBuf), "%d%%" , cost); +get_progress_icon(stock, cost, ); + + if (!gold_prod) { +fc_snprintf(cBuf, sizeof(cBuf), "%d%%" , cost); + } else { +fc_snprintf(cBuf, sizeof(cBuf), "-" ); + } copy_chars_to_string16(pEditor->pProduction_Progres->string16, cBuf); widget_redraw(pEditor->pProduction_Progres); widget_mark_dirty(pEditor->pProduction_Progres); @@ -1106,24 +1110,25 @@ /* count == cost */ /* turns == progress */ const char *name = city_production_name_translation(pCity); +bool gold_prod = city_production_has_flag(pCity, IF_GOLD); + count = city_production_build_shield_cost(pCity); - -if (city_production_has_flag(pCity, IF_GOLD)) -{ + +if (gold_prod) { int gold = MAX(0, pCity->surplus[O_SHIELD]); + fc_snprintf(cBuf, sizeof(cBuf), PL_("%s\n%d gold per turn", "%s\n%d gold per turn", gold), name, gold); } else { - if(pCity->shield_stock < count) { + if (pCity->shield_stock < count) { turns =
[Freeciv-commits] r30366 - in /trunk/server: savegame2.c savegame3.c
Author: cazfi Date: Sun Nov 1 22:12:05 2015 New Revision: 30366 URL: http://svn.gna.org/viewcvs/freeciv?rev=30366=rev Log: Load beginning-of-the-turn score information saved to the savegame instead of calculating current score at the current point of the turn. See bug #22710 Modified: trunk/server/savegame2.c trunk/server/savegame3.c Modified: trunk/server/savegame2.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=30366=30365=30366=diff == --- trunk/server/savegame2.c(original) +++ trunk/server/savegame2.cSun Nov 1 22:12:05 2015 @@ -2959,7 +2959,71 @@ } } - /* Unit statistics. */ + /* Player score. */ + plr->score.happy = +secfile_lookup_int_default(loading->file, 0, + "score%d.happy", plrno); + plr->score.content = +secfile_lookup_int_default(loading->file, 0, + "score%d.content", plrno); + plr->score.unhappy = +secfile_lookup_int_default(loading->file, 0, + "score%d.unhappy", plrno); + plr->score.angry = +secfile_lookup_int_default(loading->file, 0, + "score%d.angry", plrno); + + /* Make sure that the score about specialists in current ruleset that + * were not present at saving time are set to zero. */ + specialist_type_iterate(sp) { +plr->score.specialists[sp] = 0; + } specialist_type_iterate_end; + + for (i = 0; i < loading->specialist.size; i++) { +plr->score.specialists[specialist_index(loading->specialist.order[i])] + = secfile_lookup_int_default(loading->file, 0, + "score%d.specialist%d", plrno, i); + } + + plr->score.wonders = +secfile_lookup_int_default(loading->file, 0, + "score%d.wonders", plrno); + plr->score.techs = +secfile_lookup_int_default(loading->file, 0, + "score%d.techs", plrno); + plr->score.techout = +secfile_lookup_int_default(loading->file, 0, + "score%d.techout", plrno); + plr->score.landarea = +secfile_lookup_int_default(loading->file, 0, + "score%d.landarea", plrno); + plr->score.settledarea = +secfile_lookup_int_default(loading->file, 0, + "score%d.settledarea", plrno); + plr->score.population = +secfile_lookup_int_default(loading->file, 0, + "score%d.population", plrno); + plr->score.cities = +secfile_lookup_int_default(loading->file, 0, + "score%d.cities", plrno); + plr->score.units = +secfile_lookup_int_default(loading->file, 0, + "score%d.units", plrno); + plr->score.pollution = +secfile_lookup_int_default(loading->file, 0, + "score%d.pollution", plrno); + plr->score.literacy = +secfile_lookup_int_default(loading->file, 0, + "score%d.literacy", plrno); + plr->score.bnp = +secfile_lookup_int_default(loading->file, 0, + "score%d.bnp", plrno); + plr->score.mfg = +secfile_lookup_int_default(loading->file, 0, + "score%d.mfg", plrno); + plr->score.spaceship = +secfile_lookup_int_default(loading->file, 0, + "score%d.spaceship", plrno); plr->score.units_built = secfile_lookup_int_default(loading->file, 0, "score%d.units_built", plrno); @@ -2969,6 +3033,12 @@ plr->score.units_lost = secfile_lookup_int_default(loading->file, 0, "score%d.units_lost", plrno); + plr->score.culture = +secfile_lookup_int_default(loading->file, 0, + "score%d.culture", plrno); + plr->score.game = +secfile_lookup_int_default(loading->file, 0, + "score%d.total", plrno); /* Load space ship data. */ { @@ -4937,10 +5007,13 @@ if (!game.info.is_new_game) { fc_rand_set_state(loading->rstate); -/* Recalculate scores. */ -players_iterate(pplayer) { - calc_civ_score(pplayer); -} players_iterate_end; +if (loading->version < 30) { + /* For older savegames we have to recalculate the score with current data, + * instead of using beginning-of-turn saved scores. */ + players_iterate(pplayer) { +calc_civ_score(pplayer); + } players_iterate_end; +} } /* At the end do the default sanity checks. */ Modified: trunk/server/savegame3.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=30366=30365=30366=diff == --- trunk/server/savegame3.c(original) +++ trunk/server/savegame3.cSun Nov 1 22:12:05 2015 @@ -3780,7 +3780,71
[Freeciv-commits] r30367 - /branches/S2_6/server/savegame2.c
Author: cazfi Date: Sun Nov 1 22:12:12 2015 New Revision: 30367 URL: http://svn.gna.org/viewcvs/freeciv?rev=30367=rev Log: Load beginning-of-the-turn score information saved to the savegame instead of calculating current score at the current point of the turn. See bug #22710 Modified: branches/S2_6/server/savegame2.c Modified: branches/S2_6/server/savegame2.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame2.c?rev=30367=30366=30367=diff == --- branches/S2_6/server/savegame2.c(original) +++ branches/S2_6/server/savegame2.cSun Nov 1 22:12:12 2015 @@ -4241,7 +4241,71 @@ } } - /* Unit statistics. */ + /* Player score. */ + plr->score.happy = +secfile_lookup_int_default(loading->file, 0, + "score%d.happy", plrno); + plr->score.content = +secfile_lookup_int_default(loading->file, 0, + "score%d.content", plrno); + plr->score.unhappy = +secfile_lookup_int_default(loading->file, 0, + "score%d.unhappy", plrno); + plr->score.angry = +secfile_lookup_int_default(loading->file, 0, + "score%d.angry", plrno); + + /* Make sure that the score about specialists in current ruleset that + * were not present at saving time are set to zero. */ + specialist_type_iterate(sp) { +plr->score.specialists[sp] = 0; + } specialist_type_iterate_end; + + for (i = 0; i < loading->specialist.size; i++) { +plr->score.specialists[specialist_index(loading->specialist.order[i])] + = secfile_lookup_int_default(loading->file, 0, + "score%d.specialist%d", plrno, i); + } + + plr->score.wonders = +secfile_lookup_int_default(loading->file, 0, + "score%d.wonders", plrno); + plr->score.techs = +secfile_lookup_int_default(loading->file, 0, + "score%d.techs", plrno); + plr->score.techout = +secfile_lookup_int_default(loading->file, 0, + "score%d.techout", plrno); + plr->score.landarea = +secfile_lookup_int_default(loading->file, 0, + "score%d.landarea", plrno); + plr->score.settledarea = +secfile_lookup_int_default(loading->file, 0, + "score%d.settledarea", plrno); + plr->score.population = +secfile_lookup_int_default(loading->file, 0, + "score%d.population", plrno); + plr->score.cities = +secfile_lookup_int_default(loading->file, 0, + "score%d.cities", plrno); + plr->score.units = +secfile_lookup_int_default(loading->file, 0, + "score%d.units", plrno); + plr->score.pollution = +secfile_lookup_int_default(loading->file, 0, + "score%d.pollution", plrno); + plr->score.literacy = +secfile_lookup_int_default(loading->file, 0, + "score%d.literacy", plrno); + plr->score.bnp = +secfile_lookup_int_default(loading->file, 0, + "score%d.bnp", plrno); + plr->score.mfg = +secfile_lookup_int_default(loading->file, 0, + "score%d.mfg", plrno); + plr->score.spaceship = +secfile_lookup_int_default(loading->file, 0, + "score%d.spaceship", plrno); plr->score.units_built = secfile_lookup_int_default(loading->file, 0, "score%d.units_built", plrno); @@ -4251,6 +4315,12 @@ plr->score.units_lost = secfile_lookup_int_default(loading->file, 0, "score%d.units_lost", plrno); + plr->score.culture = +secfile_lookup_int_default(loading->file, 0, + "score%d.culture", plrno); + plr->score.game = +secfile_lookup_int_default(loading->file, 0, + "score%d.total", plrno); /* Load space ship data. */ { @@ -7212,10 +7282,13 @@ if (!game.info.is_new_game) { fc_rand_set_state(loading->rstate); -/* Recalculate scores. */ -players_iterate(pplayer) { - calc_civ_score(pplayer); -} players_iterate_end; +if (loading->version < 30) { + /* For older savegames we have to recalculate the score with current data, + * instead of using beginning-of-turn saved scores. */ + players_iterate(pplayer) { +calc_civ_score(pplayer); + } players_iterate_end; +} } /* At the end do the default sanity checks. */ ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r30370 - in /branches/S2_5/client: ./ gui-gtk-2.0/ gui-gtk-3.0/
Author: cazfi Date: Sun Nov 1 23:26:04 2015 New Revision: 30370 URL: http://svn.gna.org/viewcvs/freeciv?rev=30370=rev Log: Fixed the size of "unit with upkeep" -icon canvases, affecting especially overhead tilesets, in gtk-clients. Reported by mir3x See bug #23954 Modified: branches/S2_5/client/gui-gtk-2.0/citydlg.c branches/S2_5/client/gui-gtk-2.0/mapview.c branches/S2_5/client/gui-gtk-3.0/citydlg.c branches/S2_5/client/gui-gtk-3.0/mapview.c branches/S2_5/client/mapview_common.c branches/S2_5/client/tilespec.c branches/S2_5/client/tilespec.h Modified: branches/S2_5/client/gui-gtk-2.0/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-2.0/citydlg.c?rev=30370=30369=30370=diff == --- branches/S2_5/client/gui-gtk-2.0/citydlg.c (original) +++ branches/S2_5/client/gui-gtk-2.0/citydlg.c Sun Nov 1 23:26:04 2015 @@ -758,7 +758,7 @@ GtkListStore *production_store; /* TRANS: Overview tab in city dialog */ const char *tab_title = _("_Overview"); - int unit_height = tileset_tile_height(tileset) * 3 / 2; + int unit_height = tileset_unit_with_upkeep_height(tileset); /* main page */ page = gtk_vbox_new(FALSE, 0); @@ -1844,7 +1844,7 @@ for (i = m; i < n; i++) { GtkWidget *cmd, *pix; struct unit_node node; - int unit_height = tileset_tile_height(tileset) * 3 / 2; + int unit_height = tileset_unit_with_upkeep_height(tileset); cmd = gtk_button_new(); node.cmd = cmd; Modified: branches/S2_5/client/gui-gtk-2.0/mapview.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-2.0/mapview.c?rev=30370=30369=30370=diff == --- branches/S2_5/client/gui-gtk-2.0/mapview.c (original) +++ branches/S2_5/client/gui-gtk-2.0/mapview.c Sun Nov 1 23:26:04 2015 @@ -541,7 +541,8 @@ gtk_pixcomm_freeze(p); - put_unit_city_overlays(punit, , 0, tileset_tile_height(tileset), + put_unit_city_overlays(punit, , 0, + tileset_unit_layout_offset_y(tileset), upkeep_cost, happy_cost); gtk_pixcomm_thaw(p); Modified: branches/S2_5/client/gui-gtk-3.0/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/citydlg.c?rev=30370=30369=30370=diff == --- branches/S2_5/client/gui-gtk-3.0/citydlg.c (original) +++ branches/S2_5/client/gui-gtk-3.0/citydlg.c Sun Nov 1 23:26:04 2015 @@ -866,7 +866,7 @@ GtkListStore *production_store; /* TRANS: Overview tab in city dialog */ const char *tab_title = _("_Overview"); - int unit_height = tileset_unit_height(tileset); + int unit_height = tileset_unit_with_upkeep_height(tileset); /* main page */ page = gtk_grid_new(); @@ -2007,7 +2007,7 @@ for (i = m; i < n; i++) { GtkWidget *cmd, *pix; struct unit_node node; - int unit_height = tileset_tile_height(tileset) * 3 / 2; + int unit_height = tileset_unit_with_upkeep_height(tileset); cmd = gtk_button_new(); node.cmd = cmd; Modified: branches/S2_5/client/gui-gtk-3.0/mapview.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/mapview.c?rev=30370=30369=30370=diff == --- branches/S2_5/client/gui-gtk-3.0/mapview.c (original) +++ branches/S2_5/client/gui-gtk-3.0/mapview.c Sun Nov 1 23:26:04 2015 @@ -481,7 +481,7 @@ store.surface = gtk_pixcomm_get_surface(p); - put_unit_city_overlays(punit, , 0, tileset_tile_height(tileset), + put_unit_city_overlays(punit, , 0, tileset_unit_layout_offset_y(tileset), upkeep_cost, happy_cost); } Modified: branches/S2_5/client/mapview_common.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/mapview_common.c?rev=30370=30369=30370=diff == --- branches/S2_5/client/mapview_common.c (original) +++ branches/S2_5/client/mapview_common.c Sun Nov 1 23:26:04 2015 @@ -1040,8 +1040,8 @@ sprites (limiting the number of combinations). / void put_unit_city_overlays(struct unit *punit, - struct canvas *pcanvas, - int canvas_x, int canvas_y, int *upkeep_cost, +struct canvas *pcanvas, +int canvas_x, int canvas_y, int *upkeep_cost, int happy_cost) { struct sprite *sprite; Modified: branches/S2_5/client/tilespec.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/tilespec.c?rev=30370=30369=30370=diff ==
[Freeciv-commits] r30368 - in /trunk/client: ./ gui-gtk-2.0/ gui-gtk-3.0/
Author: cazfi Date: Sun Nov 1 23:25:49 2015 New Revision: 30368 URL: http://svn.gna.org/viewcvs/freeciv?rev=30368=rev Log: Fixed the size of "unit with upkeep" -icon canvases, affecting especially overhead tilesets, in gtk-clients. Reported by mir3x See bug #23954 Modified: trunk/client/gui-gtk-2.0/citydlg.c trunk/client/gui-gtk-2.0/mapview.c trunk/client/gui-gtk-3.0/citydlg.c trunk/client/gui-gtk-3.0/mapview.c trunk/client/mapview_common.c trunk/client/tilespec.c trunk/client/tilespec.h Modified: trunk/client/gui-gtk-2.0/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/citydlg.c?rev=30368=30367=30368=diff == --- trunk/client/gui-gtk-2.0/citydlg.c (original) +++ trunk/client/gui-gtk-2.0/citydlg.c Sun Nov 1 23:25:49 2015 @@ -762,7 +762,7 @@ GtkListStore *production_store; /* TRANS: Overview tab in city dialog */ const char *tab_title = _("_Overview"); - int unit_height = tileset_tile_height(tileset) * 3 / 2; + int unit_height = tileset_unit_with_upkeep_height(tileset); /* main page */ page = gtk_vbox_new(FALSE, 0); @@ -1852,7 +1852,7 @@ for (i = m; i < n; i++) { GtkWidget *cmd, *pix; struct unit_node node; - int unit_height = tileset_tile_height(tileset) * 3 / 2; + int unit_height = tileset_unit_with_upkeep_height(tileset); cmd = gtk_button_new(); node.cmd = cmd; Modified: trunk/client/gui-gtk-2.0/mapview.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/mapview.c?rev=30368=30367=30368=diff == --- trunk/client/gui-gtk-2.0/mapview.c (original) +++ trunk/client/gui-gtk-2.0/mapview.c Sun Nov 1 23:25:49 2015 @@ -546,7 +546,8 @@ gtk_pixcomm_freeze(p); - put_unit_city_overlays(punit, , 0, tileset_tile_height(tileset), + put_unit_city_overlays(punit, , 0, + tileset_unit_layout_offset_y(tileset), upkeep_cost, happy_cost); gtk_pixcomm_thaw(p); Modified: trunk/client/gui-gtk-3.0/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/citydlg.c?rev=30368=30367=30368=diff == --- trunk/client/gui-gtk-3.0/citydlg.c (original) +++ trunk/client/gui-gtk-3.0/citydlg.c Sun Nov 1 23:25:49 2015 @@ -880,7 +880,7 @@ GtkListStore *production_store; /* TRANS: Overview tab in city dialog */ const char *tab_title = _("_Overview"); - int unit_height = tileset_unit_height(tileset); + int unit_height = tileset_unit_with_upkeep_height(tileset); /* main page */ page = gtk_grid_new(); @@ -2025,7 +2025,7 @@ for (i = m; i < n; i++) { GtkWidget *cmd, *pix; struct unit_node node; - int unit_height = tileset_tile_height(tileset) * 3 / 2; + int unit_height = tileset_unit_with_upkeep_height(tileset); cmd = gtk_button_new(); node.cmd = cmd; Modified: trunk/client/gui-gtk-3.0/mapview.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/mapview.c?rev=30368=30367=30368=diff == --- trunk/client/gui-gtk-3.0/mapview.c (original) +++ trunk/client/gui-gtk-3.0/mapview.c Sun Nov 1 23:25:49 2015 @@ -488,7 +488,7 @@ store.surface = gtk_pixcomm_get_surface(p); - put_unit_city_overlays(punit, , 0, tileset_tile_height(tileset), + put_unit_city_overlays(punit, , 0, tileset_unit_layout_offset_y(tileset), upkeep_cost, happy_cost); } Modified: trunk/client/mapview_common.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/mapview_common.c?rev=30368=30367=30368=diff == --- trunk/client/mapview_common.c (original) +++ trunk/client/mapview_common.c Sun Nov 1 23:25:49 2015 @@ -1070,8 +1070,8 @@ sprites (limiting the number of combinations). / void put_unit_city_overlays(struct unit *punit, - struct canvas *pcanvas, - int canvas_x, int canvas_y, int *upkeep_cost, +struct canvas *pcanvas, +int canvas_x, int canvas_y, int *upkeep_cost, int happy_cost) { struct sprite *sprite; Modified: trunk/client/tilespec.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=30368=30367=30368=diff == --- trunk/client/tilespec.c (original) +++ trunk/client/tilespec.c Sun Nov 1 23:25:49 2015 @@ -470,6 +470,8 @@ int unit_tile_width, unit_tile_height; int small_sprite_width, small_sprite_height; + int
[Freeciv-commits] r30369 - in /branches/S2_6/client: ./ gui-gtk-2.0/ gui-gtk-3.0/
Author: cazfi Date: Sun Nov 1 23:25:57 2015 New Revision: 30369 URL: http://svn.gna.org/viewcvs/freeciv?rev=30369=rev Log: Fixed the size of "unit with upkeep" -icon canvases, affecting especially overhead tilesets, in gtk-clients. Reported by mir3x See bug #23954 Modified: branches/S2_6/client/gui-gtk-2.0/citydlg.c branches/S2_6/client/gui-gtk-2.0/mapview.c branches/S2_6/client/gui-gtk-3.0/citydlg.c branches/S2_6/client/gui-gtk-3.0/mapview.c branches/S2_6/client/mapview_common.c branches/S2_6/client/tilespec.c branches/S2_6/client/tilespec.h Modified: branches/S2_6/client/gui-gtk-2.0/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/citydlg.c?rev=30369=30368=30369=diff == --- branches/S2_6/client/gui-gtk-2.0/citydlg.c (original) +++ branches/S2_6/client/gui-gtk-2.0/citydlg.c Sun Nov 1 23:25:57 2015 @@ -762,7 +762,7 @@ GtkListStore *production_store; /* TRANS: Overview tab in city dialog */ const char *tab_title = _("_Overview"); - int unit_height = tileset_tile_height(tileset) * 3 / 2; + int unit_height = tileset_unit_with_upkeep_height(tileset); /* main page */ page = gtk_vbox_new(FALSE, 0); @@ -1852,7 +1852,7 @@ for (i = m; i < n; i++) { GtkWidget *cmd, *pix; struct unit_node node; - int unit_height = tileset_tile_height(tileset) * 3 / 2; + int unit_height = tileset_unit_with_upkeep_height(tileset); cmd = gtk_button_new(); node.cmd = cmd; Modified: branches/S2_6/client/gui-gtk-2.0/mapview.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/mapview.c?rev=30369=30368=30369=diff == --- branches/S2_6/client/gui-gtk-2.0/mapview.c (original) +++ branches/S2_6/client/gui-gtk-2.0/mapview.c Sun Nov 1 23:25:57 2015 @@ -546,7 +546,8 @@ gtk_pixcomm_freeze(p); - put_unit_city_overlays(punit, , 0, tileset_tile_height(tileset), + put_unit_city_overlays(punit, , 0, + tileset_unit_layout_offset_y(tileset), upkeep_cost, happy_cost); gtk_pixcomm_thaw(p); Modified: branches/S2_6/client/gui-gtk-3.0/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/citydlg.c?rev=30369=30368=30369=diff == --- branches/S2_6/client/gui-gtk-3.0/citydlg.c (original) +++ branches/S2_6/client/gui-gtk-3.0/citydlg.c Sun Nov 1 23:25:57 2015 @@ -880,7 +880,7 @@ GtkListStore *production_store; /* TRANS: Overview tab in city dialog */ const char *tab_title = _("_Overview"); - int unit_height = tileset_unit_height(tileset); + int unit_height = tileset_unit_with_upkeep_height(tileset); /* main page */ page = gtk_grid_new(); @@ -2025,7 +2025,7 @@ for (i = m; i < n; i++) { GtkWidget *cmd, *pix; struct unit_node node; - int unit_height = tileset_tile_height(tileset) * 3 / 2; + int unit_height = tileset_unit_with_upkeep_height(tileset); cmd = gtk_button_new(); node.cmd = cmd; Modified: branches/S2_6/client/gui-gtk-3.0/mapview.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/mapview.c?rev=30369=30368=30369=diff == --- branches/S2_6/client/gui-gtk-3.0/mapview.c (original) +++ branches/S2_6/client/gui-gtk-3.0/mapview.c Sun Nov 1 23:25:57 2015 @@ -488,7 +488,7 @@ store.surface = gtk_pixcomm_get_surface(p); - put_unit_city_overlays(punit, , 0, tileset_tile_height(tileset), + put_unit_city_overlays(punit, , 0, tileset_unit_layout_offset_y(tileset), upkeep_cost, happy_cost); } Modified: branches/S2_6/client/mapview_common.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/mapview_common.c?rev=30369=30368=30369=diff == --- branches/S2_6/client/mapview_common.c (original) +++ branches/S2_6/client/mapview_common.c Sun Nov 1 23:25:57 2015 @@ -1071,8 +1071,8 @@ sprites (limiting the number of combinations). / void put_unit_city_overlays(struct unit *punit, - struct canvas *pcanvas, - int canvas_x, int canvas_y, int *upkeep_cost, +struct canvas *pcanvas, +int canvas_x, int canvas_y, int *upkeep_cost, int happy_cost) { struct sprite *sprite; Modified: branches/S2_6/client/tilespec.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/tilespec.c?rev=30369=30368=30369=diff ==