From f26aed4a9dadc06d46568f36c7c0ea2c3695c6eb Mon Sep 17 00:00:00 2001 From: sireus Date: Sat, 22 Sep 2012 11:24:55 +0000 Subject: [PATCH] simplified voting system - votes succeed if yes > no, or immediately if yes > 50% git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6884 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/server.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/src/server.cpp b/source/src/server.cpp index 0759cc3d..1ac8a8b3 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -2107,10 +2107,8 @@ struct voteinfo }; bool admin = clients[owner]->role==CR_ADMIN || (!isdedicated && clients[owner]->type==ST_LOCAL); - int total = stats[VOTE_NO]+stats[VOTE_YES]+stats[VOTE_NEUTRAL]; - const float requiredcount = 0.51f; bool min_time = servmillis - callmillis > 10*1000; -#define yes_condition ((min_time && stats[VOTE_YES] - stats[VOTE_NO] > 0.34f*total && totalclients > 4) || stats[VOTE_YES] > requiredcount*total) +#define yes_condition ((min_time && stats[VOTE_YES] > stats[VOTE_NO]) || stats[VOTE_YES] > stats[VOTE_NO]+stats[VOTE_NEUTRAL]) #define no_condition (forceend || !valid_client(owner) || stats[VOTE_NO] >= stats[VOTE_YES]+stats[VOTE_NEUTRAL] || adminvote == VOTE_NO) #define boot_condition (!boot || (boot && valid_client(num1) && clients[num1]->peer->address.host == host)) if( (yes_condition || admin || adminvote == VOTE_YES) && boot_condition ) end(VOTE_YES);