Author: sveinung Date: Thu Sep 4 14:34:55 2014 New Revision: 26214 URL: http://svn.gna.org/viewcvs/freeciv?rev=26214&view=rev Log: Qt client: Remove get_current_unit() and set_current_unit().
Make their only remaining user, the selection of what tech to steal, pass the action information forward via Qt in stead. See patch #5159 Modified: trunk/client/gui-qt/dialogs.cpp trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h Modified: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=26214&r1=26213&r2=26214&view=diff ============================================================================== --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Thu Sep 4 14:34:55 2014 @@ -1110,7 +1110,6 @@ if (pcity) { /* Spy/Diplomat acting against a city */ - gui()->set_current_unit(diplomat_id, pcity->id, ATK_CITY); qv2 = pcity->id; action_entry(cd, @@ -1157,7 +1156,6 @@ if ((ptunit = unit_list_get(dest_tile->units, 0))) { /* Spy/Diplomat acting against a unit */ - gui()->set_current_unit(diplomat_id, ptunit->id, ATK_UNIT); qv2 = ptunit->id; action_entry(cd, @@ -1285,6 +1283,7 @@ struct player *pvictim = NULL; choice_dialog *cd; int nr = 0; + QList<QVariant> actor_and_target; /* Wait for the player's reply before moving on to the next queued diplomat. */ is_more_user_input_needed = TRUE; @@ -1300,7 +1299,12 @@ cd = new choice_dialog(_("Steal"), _("Steal Technology"), gui()->game_tab_widget, diplomat_queue_handle_secondary); - qv1 = data1; + + /* Put both actor and target city in qv1 since qv2 is taken */ + actor_and_target.append(diplomat_id); + actor_and_target.append(diplomat_target_id); + qv1 = QVariant::fromValue(actor_and_target); + struct player *pplayer = client.conn.playing; if (pvictim) { const struct research *presearch = research_get(pplayer); @@ -1333,10 +1337,9 @@ ***************************************************************************/ static void spy_steal_something(QVariant data1, QVariant data2) { - int diplomat_id; - int diplomat_target_id; - - gui()->get_current_unit(&diplomat_id, &diplomat_target_id, ATK_CITY); + int diplomat_id = data1.toList().at(0).toInt(); + int diplomat_target_id = data1.toList().at(1).toInt(); + if (NULL != game_unit_by_number(diplomat_id) && NULL != game_city_by_number(diplomat_target_id)) { request_diplomat_action(DIPLOMAT_STEAL_TARGET, diplomat_id, @@ -1839,8 +1842,6 @@ if (cd != NULL){ cd->close(); } - gui()->set_current_unit(-1, -1, ATK_UNIT); - gui()->set_current_unit(-1, -1, ATK_CITY); } /**************************************************************** @@ -2250,26 +2251,6 @@ } /*************************************************************************** - Set current unit handled in diplo dialog -***************************************************************************/ -void fc_client::set_current_unit(int curr, int target, - action_target_kind tgt) -{ - current_unit_id = curr; - current_unit_target_id[tgt] = target; -} - -/*************************************************************************** - Get current unit handled in diplo dialog -***************************************************************************/ -void fc_client::get_current_unit(int *curr, int *target, - action_target_kind tgt) -{ - *curr = current_unit_id; - *target = current_unit_target_id[tgt]; -} - -/*************************************************************************** Set current diplo dialog ***************************************************************************/ void fc_client::set_diplo_dialog(choice_dialog *widget) Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26214&r1=26213&r2=26214&view=diff ============================================================================== --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Thu Sep 4 14:34:55 2014 @@ -86,11 +86,8 @@ unit_sel = NULL; info_tile_wdg = NULL; opened_dialog = NULL; - current_unit_id = -1; current_file = ""; status_bar_queue.clear(); - current_unit_target_id[ATK_CITY] = -1; - current_unit_target_id[ATK_UNIT] = -1; quitting = false; for (int i = 0; i <= PAGE_GGZ; i++) { Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=26214&r1=26213&r2=26214&view=diff ============================================================================== --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Thu Sep 4 14:34:55 2014 @@ -147,8 +147,6 @@ unit_select *unit_sel; info_tile *info_tile_wdg; choice_dialog *opened_dialog; - int current_unit_id; - int current_unit_target_id[ATK_COUNT]; public: fc_client(); @@ -172,8 +170,6 @@ void update_unit_sel(); void popup_tile_info(struct tile *ptile); void popdown_tile_info(); - void set_current_unit(int curr, int target, action_target_kind tgt); - void get_current_unit(int *curr, int *target, action_target_kind tgt); void set_diplo_dialog(choice_dialog *widget); choice_dialog *get_diplo_dialog(); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits