X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/010216e3bc0fc54595d59b6fa4ceec220aff3632..1680c3561bc4f44c63a026e0d1a5324a39336156:/demos/forty/game.cpp diff --git a/demos/forty/game.cpp b/demos/forty/game.cpp index e03c98373e..24941f015d 100644 --- a/demos/forty/game.cpp +++ b/demos/forty/game.cpp @@ -11,11 +11,6 @@ // Last modified: 22nd July 1998 - ported to wxWidgets 2.0 ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#endif - // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -163,7 +158,7 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest) { if (src == dest) { - wxMessageBox(_T("Game::DoMove() src == dest"), _T("Debug message"), + wxMessageBox(wxT("Game::DoMove() src == dest"), wxT("Debug message"), wxOK | wxICON_EXCLAMATION); } m_moves[m_moveIndex].src = src; @@ -175,7 +170,7 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest) } else { - wxMessageBox(_T("Game::DoMove() Undo buffer full"), _T("Debug message"), + wxMessageBox(wxT("Game::DoMove() Undo buffer full"), wxT("Debug message"), wxOK | wxICON_EXCLAMATION); } @@ -193,7 +188,7 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest) if (frame) { - wxNode *node = (wxNode *)frame->GetChildren().GetFirst(); + wxWindowList::compatibility_iterator node = frame->GetChildren().GetFirst(); if (node) canvas = (wxWindow*)node->GetData(); } @@ -203,8 +198,8 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest) // Redraw the score box to update games won DisplayScore(dc); - if (wxMessageBox(_T("Do you wish to play again?"), - _T("Well Done, You have won!"), wxYES_NO | wxICON_QUESTION) == wxYES) + if (wxMessageBox(wxT("Do you wish to play again?"), + wxT("Well Done, You have won!"), wxYES_NO | wxICON_QUESTION) == wxYES) { Deal(); canvas->Refresh(); @@ -238,28 +233,28 @@ void Game::DisplayScore(wxDC& dc) m_pack->GetTopCardPos(x, y); x += 12 * CardWidth - 105; - int w, h; + wxCoord w, h; { - long width, height; - dc.GetTextExtent(_T("Average score:m_x"), &width, &height); + wxCoord width, height; + dc.GetTextExtent(wxT("Average score:m_x"), &width, &height); w = width; h = height; } dc.DrawRectangle(x + w, y, 20, 4 * h); wxString str; - str.Printf(_T("%d"), m_currentScore); - dc.DrawText(_T("Score:"), x, y); + str.Printf(wxT("%d"), m_currentScore); + dc.DrawText(wxT("Score:"), x, y); dc.DrawText(str, x + w, y); y += h; - str.Printf(_T("%d"), m_numGames); - dc.DrawText(_T("Games played:"), x, y); + str.Printf(wxT("%d"), m_numGames); + dc.DrawText(wxT("Games played:"), x, y); dc.DrawText(str, x + w, y); y += h; - str.Printf(_T("%d"), m_numWins); - dc.DrawText(_T("Games won:"), x, y); + str.Printf(wxT("%d"), m_numWins); + dc.DrawText(wxT("Games won:"), x, y); dc.DrawText(str, x + w, y); y += h; @@ -268,8 +263,8 @@ void Game::DisplayScore(wxDC& dc) { average = (2 * (m_currentScore + m_totalScore) + m_numGames ) / (2 * m_numGames); } - str.Printf(_T("%d"), average); - dc.DrawText(_T("Average score:"), x, y); + str.Printf(wxT("%d"), average); + dc.DrawText(wxT("Average score:"), x, y); dc.DrawText(str, x + w, y); } @@ -799,7 +794,7 @@ void Pack::Redraw(wxDC& dc) Pile::Redraw(dc); wxString str; - str.Printf(_T("%d "), m_topCard + 1); + str.Printf(wxT("%d "), m_topCard + 1); dc.SetBackgroundMode( wxSOLID ); dc.SetTextBackground(FortyApp::BackgroundColour()); @@ -816,7 +811,7 @@ void Pack::AddCard(Card* card) } else { - wxMessageBox(_T("Pack::AddCard() Undo error"), _T("Forty Thieves: Warning"), + wxMessageBox(wxT("Pack::AddCard() Undo error"), wxT("Forty Thieves: Warning"), wxOK | wxICON_EXCLAMATION); } card->TurnCard(facedown); @@ -829,7 +824,7 @@ Pack::~Pack() { delete m_cards[m_topCard]; } -}; +} //------------------------------------------------------// @@ -861,11 +856,6 @@ bool Base::AcceptCard(Card* card) return retval; } -Base::~Base() -{ -// nothing special at the moment -}; - //----------------------------------------------------------------// // The Foundation class: holds the cards built up from the ace... // @@ -895,11 +885,6 @@ bool Foundation::AcceptCard(Card* card) return retval; } -Foundation::~Foundation() -{ -// nothing special at the moment -}; - //----------------------------------------------------// // The Discard class: holds cards dealt from the m_pack // @@ -981,7 +966,7 @@ Card* Discard::RemoveTopCard(wxDC& dc, int m_xOffset, int m_yOffset) for (int i = m_topCard - 31; i <= m_topCard - 31 + CardWidth / m_dx; i++) { - m_cards[i]->Draw(dc, m_x - m_xOffset + i * m_dx, m_y - m_yOffset); + m_cards[i]->Draw(dc, m_x - m_xOffset + i * m_dx, m_y - m_yOffset); } if (m_topCard > 31) { @@ -992,9 +977,3 @@ Card* Discard::RemoveTopCard(wxDC& dc, int m_xOffset, int m_yOffset) return card; } - - -Discard::~Discard() -{ -// nothing special at the moment -};