Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#12604) Vote change
Home

[Freeciv-Dev] (PR#12604) Vote change

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12604) Vote change
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Wed, 23 Mar 2005 09:44:18 -0800
Reply-to: bugs@xxxxxxxxxxx

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

CHANGES:
 - a vote needs plurality (>50% of votes) to pass. it does not
   matter how many turns it takes. this removes the problem of
   surprise votes.
 - player observers cannot vote or suggest new votes; right now they can
   pretend to be the controlling connection; i see no reason to grant
   observer suffrage

  - Per

Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.390
diff -u -r1.390 stdinhand.c
--- server/stdinhand.c  22 Mar 2005 04:03:35 -0000      1.390
+++ server/stdinhand.c  23 Mar 2005 17:41:56 -0000
@@ -101,7 +101,6 @@
   char command[MAX_LEN_CONSOLE_LINE]; /* [0] == \0 if none in action */
   enum vote_type votes_cast[MAX_NUM_PLAYERS]; /* see enum above */
   int vote_no; /* place in the queue */
-  bool full_turn; /* has a full turn begun for this vote yet? */
   int yes, no;
 };
 static struct voting votes[MAX_NUM_PLAYERS];
@@ -184,7 +183,6 @@
     votes[i].command[0] = '\0';
     memset(votes[i].votes_cast, 0, sizeof(votes[i].votes_cast));
     votes[i].vote_no = -1;
-    votes[i].full_turn = FALSE;
   }
   last_vote = -1;
 }
@@ -197,8 +195,6 @@
   Criteria:
     Accepted immediately if: > 50% of votes for
     Rejected immediately if: >= 50% of votes against
-    Accepted on conclusion iff: More than half eligible voters voted for,
-                                or none against.
 **************************************************************************/
 static void check_vote(struct voting *vote)
 {
@@ -224,16 +220,14 @@
   /* Check if we should resolve the vote */
   if (vote->command[0] != '\0'
       && num_voters > 0
-      && (vote->full_turn == TRUE
-          || (vote->yes > num_voters / 2)
-          || (vote->no >= (num_voters + 1) / 2))) {
+      && (vote->yes > num_voters / 2
+          || vote->no >= (num_voters + 1) / 2)) {
     /* Yep, resolve this one */
     vote->vote_no = -1;
-    vote->full_turn = FALSE;
     if (last_vote == vote->vote_no) {
       last_vote = -1;
     }
-    if (vote->yes > num_voters / 2 || vote->no == 0) {
+    if (vote->yes > num_voters / 2) {
       /* Do it! */
       notify_player(NULL, _("Vote \"%s\" is passed %d to %d with %d "
                     "abstentions."), vote->command, vote->yes, vote->no,
@@ -260,11 +254,6 @@
   for (i = 0; i < MAX_NUM_PLAYERS; i++) {
     check_vote(&votes[i]);
   }
-
-  /* Update full turn info */
-  for (i = 0; i < MAX_NUM_PLAYERS; i++) {
-    votes[i].full_turn = TRUE;
-  }
 }
 
 /**************************************************************************
@@ -2128,7 +2117,7 @@
   if (caller == NULL || caller->player == NULL) {
     cmd_reply(CMD_VOTE, caller, C_FAIL, _("This command is client only."));
     return FALSE;
-  } else if (caller->player->is_observer) {
+  } else if (caller->player->is_observer || caller->observer) {
     cmd_reply(CMD_VOTE, caller, C_FAIL, _("Observers cannot vote."));
     return FALSE;
   } else if (!str || strlen(str) == 0) {
@@ -3390,7 +3379,6 @@
                     caller->player->name, full_command);
       sz_strlcpy(votes[idx].command, full_command);
       votes[idx].vote_no = last_vote;
-      votes[idx].full_turn = FALSE; /* just to be sure */
       memset(votes[idx].votes_cast, VOTE_NONE, sizeof(votes[idx].votes_cast));
       votes[idx].votes_cast[idx] = VOTE_YES; /* vote on your own suggestion */
       check_vote(&votes[idx]); /* update vote numbers, maybe auto-accept */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12604) Vote change, Per I. Mathisen <=