Author: jtn Date: Fri Nov 4 00:51:26 2016 New Revision: 34373 URL: http://svn.gna.org/viewcvs/freeciv?rev=34373&view=rev Log: Prevent untargeted revolution for the RANDQUICK revolentype, the same as QUICKENING.
See gna bug #25256. Modified: branches/S2_6/client/gui-gtk-2.0/menu.c branches/S2_6/client/gui-gtk-3.0/menu.c branches/S2_6/client/gui-gtk-3.22/menu.c branches/S2_6/common/government.c branches/S2_6/common/government.h branches/S2_6/server/plrhand.c Modified: branches/S2_6/client/gui-gtk-2.0/menu.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/menu.c?rev=34373&r1=34372&r2=34373&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-2.0/menu.c (original) +++ branches/S2_6/client/gui-gtk-2.0/menu.c Fri Nov 4 00:51:26 2016 @@ -2155,7 +2155,7 @@ } else { /* Revolution without target government */ gtk_widget_set_sensitive(GTK_WIDGET(iter->data), - game.info.revolentype != REVOLEN_QUICKENING); + untargeted_revolution_allowed()); } } g_list_free(list); Modified: branches/S2_6/client/gui-gtk-3.0/menu.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/menu.c?rev=34373&r1=34372&r2=34373&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/menu.c (original) +++ branches/S2_6/client/gui-gtk-3.0/menu.c Fri Nov 4 00:51:26 2016 @@ -2143,7 +2143,7 @@ } else { /* Revolution without target government */ gtk_widget_set_sensitive(GTK_WIDGET(iter->data), - game.info.revolentype != REVOLEN_QUICKENING); + untargeted_revolution_allowed()); } } g_list_free(list); Modified: branches/S2_6/client/gui-gtk-3.22/menu.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.22/menu.c?rev=34373&r1=34372&r2=34373&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.22/menu.c (original) +++ branches/S2_6/client/gui-gtk-3.22/menu.c Fri Nov 4 00:51:26 2016 @@ -2150,7 +2150,7 @@ } else { /* Revolution without target government */ gtk_widget_set_sensitive(GTK_WIDGET(iter->data), - game.info.revolentype != REVOLEN_QUICKENING); + untargeted_revolution_allowed()); } } g_list_free(list); Modified: branches/S2_6/common/government.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/government.c?rev=34373&r1=34372&r2=34373&view=diff ============================================================================== --- branches/S2_6/common/government.c (original) +++ branches/S2_6/common/government.c Fri Nov 4 00:51:26 2016 @@ -546,3 +546,18 @@ governments = NULL; game.control.government_count = 0; } + +/**************************************************************************** + Is it possible to start a revolution without specifying the target + government in the current game? +****************************************************************************/ +bool untargeted_revolution_allowed(void) +{ + if (game.info.revolentype == REVOLEN_QUICKENING + || game.info.revolentype == REVOLEN_RANDQUICK) { + /* We need to know the target government at the onset of the revolution + * in order to know how long anarchy will last. */ + return FALSE; + } + return TRUE; +} Modified: branches/S2_6/common/government.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/government.h?rev=34373&r1=34372&r2=34373&view=diff ============================================================================== --- branches/S2_6/common/government.h (original) +++ branches/S2_6/common/government.h Fri Nov 4 00:51:26 2016 @@ -123,4 +123,6 @@ } #endif /* __cplusplus */ +bool untargeted_revolution_allowed(void); + #endif /* FC__GOVERNMENT_H */ Modified: branches/S2_6/server/plrhand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/plrhand.c?rev=34373&r1=34372&r2=34373&view=diff ============================================================================== --- branches/S2_6/server/plrhand.c (original) +++ branches/S2_6/server/plrhand.c Fri Nov 4 00:51:26 2016 @@ -393,6 +393,14 @@ { int turns; + if (!untargeted_revolution_allowed() + && gov == game.government_during_revolution) { + /* Targetless revolution not acceptable */ + notify_player(plr, NULL, E_REVOLT_DONE, ftc_server, + _("You can't revolt without selecting target government.")); + return -1; + } + turns = GAME_DEFAULT_REVOLUTION_LENGTH; /* To avoid compiler warning */ switch (game.info.revolentype) { case REVOLEN_FIXED: @@ -403,12 +411,6 @@ break; case REVOLEN_QUICKENING: case REVOLEN_RANDQUICK: - if (gov == game.government_during_revolution) { - /* Targetless revolution not acceptable */ - notify_player(plr, NULL, E_REVOLT_DONE, ftc_server, - _("You can't revolt without selecting target government.")); - return -1; - } turns = game.server.revolution_length - gov->changed_to_times; turns = MAX(1, turns); if (game.info.revolentype == REVOLEN_RANDQUICK) { _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits