MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / RedrawToClient

Method RedrawToClient

core/MenuVoting.cpp:261–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261bool VoteMenuHandler::RedrawToClient(int client, bool revotes)
262{
263 unsigned int time_limit;
264
265 if (!IsClientInVotePool(client))
266 {
267 return false;
268 }
269
270 if (m_ClientVotes[client] >= 0)
271 {
272 if ((m_VoteFlags & VOTEFLAG_NO_REVOTES) == VOTEFLAG_NO_REVOTES || !revotes)
273 {
274 return false;
275 }
276 assert((unsigned)m_ClientVotes[client] < m_Items);
277 assert(m_Votes[m_ClientVotes[client]] > 0);
278 m_Votes[m_ClientVotes[client]]--;
279 m_ClientVotes[client] = VOTE_PENDING;
280 m_Revoting[client] = true;
281 m_NumVotes--;
282
283 if (sm_vote_hintbox.GetBool())
284 {
285 BuildVoteLeaders();
286 DrawHintProgress();
287 }
288 }
289
290 if (m_nMenuTime == MENU_TIME_FOREVER)
291 {
292 time_limit = m_nMenuTime;
293 }
294 else
295 {
296 time_limit = (int)((float)m_nMenuTime - (gpGlobals->curtime - m_fStartTime));
297
298 /* Make sure this doesn't round to zero */
299 if (time_limit == MENU_TIME_FOREVER)
300 {
301 time_limit = 1;
302 }
303 }
304
305 return m_pCurMenu->Display(client, time_limit, this);
306}
307
308bool VoteMenuHandler::InitializeVoting(IBaseMenu *menu,
309 IMenuHandler *handler,

Callers 1

RedrawClientVoteMenu2Method · 0.80

Calls 3

IsClientInVotePoolFunction · 0.85
GetBoolMethod · 0.80
DisplayMethod · 0.45

Tested by

no test coverage detected