<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39368 >

There is a strange thing:
In pregame, you can create votes, but you cannot use /vote. And more, if you 
do '/aifill 8', you have:
/cmdlevel: Niveau d'accès aux commandes à "info" pour la connexion pepeto.
AI4 a été ajouté en tant que joueur contrôlé par une IA de niveau novice.
AI5 a été ajouté en tant que joueur contrôlé par une IA de niveau novice.
AI6 a été ajouté en tant que joueur contrôlé par une IA de niveau novice.
Nouveau vote (numéro 0) par pepeto: set aifill 8.

The vote passes before it exists :)
I don't know if the main problem is you can ask vote in pregame, or is, 
aifill can pass when with the check argument. So, this is a patch for both:

--- 12954/server/stdinhand.c    2007-05-14 10:32:22.000000000 +0200
+++ test/server/stdinhand.c     2007-05-14 11:14:23.000000000 +0200
@@ -2540,14 +2540,14 @@
                _("Value out of range (minimum: %d, maximum: %d)."),
                op->int_min_value, op->int_max_value);
       return FALSE;
-    } else {
+    } else if (!check) {
       const char *reject_message = NULL;

       if (settings[cmd].int_validate
          && !settings[cmd].int_validate(val, &reject_message)) {
        cmd_reply(CMD_SET, caller, C_SYNTAX, reject_message);
         return FALSE;
-      } else if (!check) {
+      } else {
        *(op->int_value) = val;
        my_snprintf(buffer, sizeof(buffer),
                    _("Option: %s has been set to %d."), op->name,
@@ -3457,8 +3457,11 @@
     return FALSE;
   }

-  if (caller
+  if ((server_state == RUN_GAME_STATE
+       || server_state == GAME_OVER_STATE)
+      && caller
       && caller->player
+      && !caller->observer /* don't allow observers to ask votes */
       && !check
       && caller->access_level == ALLOW_INFO
       && commands[cmd].level == ALLOW_CTRL) {

Notes:
* /set maxconnections won't be checked correctly first, but the number of 
connections could be modified between the ask time and the pass time.
* i am not sure allow votes in GAME_OVER_STATE is very usefull.

_________________________________________________________________
Personnalisez votre Messenger avec Live.com 
http://www.windowslive.fr/livecom/

--- 12954/server/stdinhand.c	2007-05-14 10:32:22.000000000 +0200
+++ test/server/stdinhand.c	2007-05-14 11:21:51.000000000 +0200
@@ -2540,14 +2540,14 @@
 		_("Value out of range (minimum: %d, maximum: %d)."),
 		op->int_min_value, op->int_max_value);
       return FALSE;
-    } else {
+    } else if (!check) {
       const char *reject_message = NULL;
 
       if (settings[cmd].int_validate
 	  && !settings[cmd].int_validate(val, &reject_message)) {
 	cmd_reply(CMD_SET, caller, C_SYNTAX, reject_message);
         return FALSE;
-      } else if (!check) {
+      } else {
 	*(op->int_value) = val;
 	my_snprintf(buffer, sizeof(buffer),
 		    _("Option: %s has been set to %d."), op->name,
@@ -3457,8 +3457,11 @@
     return FALSE;
   }
 
-  if (caller 
+  if ((server_state == RUN_GAME_STATE
+       || server_state == GAME_OVER_STATE)
+      && caller
       && caller->player
+      && !caller->observer /* don't allow observers to ask votes */
       && !check
       && caller->access_level == ALLOW_INFO
       && commands[cmd].level == ALLOW_CTRL) {

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to