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

Method InitializeVoting

core/MenuVoting.cpp:308–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308bool VoteMenuHandler::InitializeVoting(IBaseMenu *menu,
309 IMenuHandler *handler,
310 unsigned int time,
311 unsigned int flags)
312{
313 if (IsVoteInProgress())
314 {
315 return false;
316 }
317
318 InternalReset();
319
320 /* Mark all clients as not voting */
321 for (int i=1; i<=gpGlobals->maxClients; i++)
322 {
323 m_ClientVotes[i] = VOTE_NOT_VOTING;
324 m_Revoting[i] = false;
325 }
326
327 m_Items = menu->GetItemCount();
328
329 if (m_Votes.size() < (size_t)m_Items)
330 {
331 /* Only clear the items we need to... */
332 size_t size = m_Votes.size();
333 for (size_t i=0; i<size; i++)
334 {
335 m_Votes[i] = 0;
336 }
337 m_Votes.resize(m_Items, 0);
338 }
339 else
340 {
341 for (unsigned int i=0; i<m_Items; i++)
342 {
343 m_Votes[i] = 0;
344 }
345 }
346
347 m_pCurMenu = menu;
348 m_VoteTime = time;
349 m_VoteFlags = flags;
350 m_pHandler = handler;
351
352 m_pHandler->OnMenuStart(m_pCurMenu);
353
354 return true;
355}
356
357void VoteMenuHandler::StartVoting()
358{

Callers

nothing calls this directly

Calls 5

IsVoteInProgressFunction · 0.85
GetItemCountMethod · 0.80
resizeMethod · 0.80
sizeMethod · 0.45
OnMenuStartMethod · 0.45

Tested by

no test coverage detected