Raised This Month: $51 Target: $400
 12% 

[bug] mapchooser.amxx - checkVotes() routine


  
 
 
Thread Tools Display Modes
Author Message
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 12-02-2006 , 13:41   [bug] mapchooser.amxx - checkVotes() routine
#1

While modifying the stock mapchooser plugin, I noticed some code that didn't seem quite right. In the public checkVotes() routine, if more players choose NONE (or basically 'nextmap') than EXTEND, the routine will still end up performing an EXTEND. This is because the routine returns after checking the EXTEND vote and never bothers to check to see if perhaps NONE had more votes then EXTEND.

For example, if the map voting went like this...
mapname1 got 2 votes
mapname2 got 0 votes
mapname3 got 1 vote
mapname4 got 1 vote
mapname5 got 1 vote

Extend got 3 votes
None got 4 votes
...the routing will still extend the map even though NONE got more votes.

Please note that I haven't tested it, and forgive for wasting your time if I'm wrong, but that's sure the way it looks to me.

Code:
public checkVotes()
{
new b = 0
 
for (new a = 0; a < g_mapVoteNum; ++a)
  if (g_voteCount[b] < g_voteCount[a])
    b = a
 
if (g_voteCount[SELECTMAPS] > g_voteCount[b])
{
  new mapname[32]
  get_mapname(mapname, 31)
  new Float:steptime = get_cvar_float("amx_extendmap_step")
  set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime)
  client_print(0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_EXT", steptime)
  log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes", mapname, steptime)
 
  return
}
 
if (g_voteCount[b] && g_voteCount[SELECTMAPS + 1] <= g_voteCount[b])
  set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]])
 
new smap[32]
 
get_cvar_string("amx_nextmap", smap, 31)
client_print(0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_NEXT", smap)
log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
}
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
BAILOPAN
Join Date: Jan 2004
Old 12-19-2006 , 05:36   Re: [bug] mapchooser.amxx - checkVotes() routine
#2

Thanks for the report. This is fixed in revision 3179.
__________________
egg
BAILOPAN is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode