1.1 --- a/core/MenuManager.cpp Wed Jun 06 06:04:16 2007 +0000
1.2 +++ b/core/MenuManager.cpp Wed Jun 06 06:27:47 2007 +0000
1.3 @@ -95,6 +95,19 @@
1.4
1.5 void VoteMenuHandler::EndVoting()
1.6 {
1.7 + if (m_bCancelled)
1.8 + {
1.9 + /* If we were cancelled, don't bother tabulating anything.
1.10 + * Reset just in case someone tries to redraw, which means
1.11 + * we need to save our states.
1.12 + */
1.13 + IBaseMenu *menu = m_pCurMenu;
1.14 + InternalReset();
1.15 + m_pHandler->OnMenuVoteCancel(menu);
1.16 + m_pHandler->OnMenuEnd(menu);
1.17 + return;
1.18 + }
1.19 +
1.20 unsigned int chosen = 0;
1.21 unsigned int highest = 0;
1.22 unsigned int dup_count = 0;
1.23 @@ -104,7 +117,7 @@
1.24 {
1.25 /* Pick a random item and then jump far, far away. */
1.26 srand((unsigned int)(time(NULL)));
1.27 - chosen = (unsigned int)rand() % static_cast<unsigned int>(m_Votes.size());
1.28 + chosen = (unsigned int)rand() % m_Items;
1.29 goto picked_item;
1.30 }
1.31
1.32 @@ -207,6 +220,12 @@
1.33 m_bStarted = false;
1.34 m_pCurMenu = NULL;
1.35 m_NumVotes = 0;
1.36 + m_bCancelled = false;
1.37 +}
1.38 +
1.39 +void VoteMenuHandler::CancelVoting()
1.40 +{
1.41 + m_bCancelled = true;
1.42 }
1.43
1.44 /*******************************