core/MenuVoting.cpp
changeset 2737 eb7713d87fa1
parent 2400 76b7b4575e21
child 2801 f70c4df158b3
     1.1 --- a/core/MenuVoting.cpp	Mon May 25 18:12:26 2009 -0700
     1.2 +++ b/core/MenuVoting.cpp	Sat May 30 19:59:55 2009 -0400
     1.3 @@ -1,8 +1,8 @@
     1.4  /**
     1.5 - * vim: set ts=4 :
     1.6 + * vim: set ts=4 sw=4 :
     1.7   * =============================================================================
     1.8   * SourceMod
     1.9 - * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
    1.10 + * Copyright (C) 2004-2009 AlliedModders LLC.  All rights reserved.
    1.11   * =============================================================================
    1.12   *
    1.13   * This program is free software; you can redistribute it and/or modify it under
    1.14 @@ -205,7 +205,7 @@
    1.15  	return true;
    1.16  }
    1.17  
    1.18 -bool VoteMenuHandler::RedrawToClient(int client)
    1.19 +bool VoteMenuHandler::RedrawToClient(int client, bool revotes)
    1.20  {
    1.21  	unsigned int time_limit;
    1.22  
    1.23 @@ -214,6 +214,18 @@
    1.24  		return false;
    1.25  	}
    1.26  
    1.27 +	if (m_ClientVotes[client] >= 0)
    1.28 +	{
    1.29 +		if ((m_VoteFlags & VOTEFLAG_NO_REVOTES) == VOTEFLAG_NO_REVOTES || !revotes)
    1.30 +		{
    1.31 +			return false;
    1.32 +		}
    1.33 +		assert((unsigned)m_ClientVotes[client] < m_Items);
    1.34 +		assert(m_Votes[m_ClientVotes[client]] > 0);
    1.35 +		m_Votes[m_ClientVotes[client]]--;
    1.36 +		m_ClientVotes[client] = -1;
    1.37 +	}
    1.38 +
    1.39  	if (m_nMenuTime == MENU_TIME_FOREVER)
    1.40  	{
    1.41  		time_limit = m_nMenuTime;
    1.42 @@ -489,3 +501,4 @@
    1.43  {
    1.44  	return m_bCancelled;
    1.45  }
    1.46 +