Author: mir3x Date: Sun Feb 14 09:50:34 2016 New Revision: 31915 URL: http://svn.gna.org/viewcvs/freeciv?rev=31915&view=rev Log: Renamed Auto Settler to Auto Worker - for non settlers units. Fixed "go and build city" enabled for workers. Fixed "revolution" enabled for observers. Fixed "tax rates" enabled for observers.
See bug #24396 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=31915&r1=31914&r2=31915&view=diff ============================================================================== --- branches/S2_6/client/gui-qt/menu.cpp (original) +++ branches/S2_6/client/gui-qt/menu.cpp Sun Feb 14 09:50:34 2016 @@ -225,15 +225,16 @@ gov_mapper->deleteLater(); gov_mapper = new QSignalMapper(); + gov_count = government_count(); + actions.reserve(gov_count + 1); action = addAction(_("Revolution...")); connect(action, &QAction::triggered, this, &gov_menu::revolution); + actions.append(action); addSeparator(); // Add an action for each government. There is no icon yet. - gov_count = government_count(); revol_gov = game.government_during_revolution; - actions.reserve(gov_count); for (i = 0; i < gov_count; ++i) { gov = government_by_number(i); if (gov != revol_gov) { // Skip revolution goverment @@ -264,11 +265,13 @@ if (gov != revol_gov) { // Skip revolution goverment sprite = get_government_sprite(tileset, gov); if (sprite != NULL) { - actions[j]->setIcon(QIcon(*(sprite->pm))); + actions[j + 1]->setIcon(QIcon(*(sprite->pm))); } - actions[j]->setEnabled( - can_change_to_government(client.conn.playing, gov)); + actions[j + 1]->setEnabled( + can_change_to_government(client.conn.playing, gov)); ++j; + } else { + actions[0]->setEnabled(!client_is_observer()); } } } @@ -797,7 +800,7 @@ menu_list.insertMulti(BUILD, act); connect(act, SIGNAL(triggered()), this, SLOT(slot_build_city())); act = menu->addAction(_("Go And Build City")); - menu_list.insertMulti(AUTOSETTLER, act); + menu_list.insertMulti(GO_AND_BUILD_CITY, act); act->setShortcut(QKeySequence(tr("shift+b"))); connect(act, SIGNAL(triggered()), this, SLOT(slot_go_build_city())); act = menu->addAction(_("Auto Settler")); @@ -866,6 +869,7 @@ /* Civilization menu */ menu = this->addMenu(_("Civilization")); act = menu->addAction(_("Tax Rates...")); + menu_list.insertMulti(NOT_4_OBS, act); connect(act, SIGNAL(triggered()), this, SLOT(slot_popup_tax_rates())); menu->addSeparator(); @@ -1086,6 +1090,10 @@ i.value()->setEnabled(true); } break; + case NOT_4_OBS: + if (client_is_observer() == false) { + i.value()->setEnabled(true); + } default: break; } @@ -1346,8 +1354,17 @@ if (can_units_do(punits, can_unit_do_autosettlers)) { i.value()->setEnabled(true); } - break; - + if (units_have_type_flag(punits, UTYF_CITIES, true)) { + i.value()->setText(_("Auto Settler")); + } else { + i.value()->setText(_("Auto Worker")); + } + break; + case GO_AND_BUILD_CITY: + if (units_have_type_flag(punits, UTYF_CITIES, TRUE)) { + i.value()->setEnabled(true); + } + break; case CONNECT_ROAD: proad = road_by_compat_special(ROCO_ROAD); if (proad != NULL) { 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=31915&r1=31914&r2=31915&view=diff ============================================================================== --- branches/S2_6/client/gui-qt/menu.h (original) +++ branches/S2_6/client/gui-qt/menu.h Sun Feb 14 09:50:34 2016 @@ -34,8 +34,8 @@ class QSignalMapper; class QScrollArea; -/** used for indicating menu about current option - for renaming - * and enabling disbaling */ +/** used for indicating menu about current option - for renaming + * and enabling, disabling */ enum munit { STANDARD, EXPLORE, @@ -69,6 +69,8 @@ ORDER_DIPLOMAT_DLG, NUKE, UPGRADE, + GO_AND_BUILD_CITY, + NOT_4_OBS, SAVE }; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits