]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/forty/scoredg.cpp
1. Empty() now doesn't free memory - Clear() does
[wxWidgets.git] / samples / forty / scoredg.cpp
index bd4d9b93b655081d5ff58f44c0113c001625455d..773b51361692094e4b5ef1c4cf7cd3a471c939a2 100644 (file)
 #include "wx/wx.h"
 #endif
 
+#if wxUSE_IOSTREAMH
 #if defined(__WXMSW__) && !defined(GNUWIN32)
 #include <strstrea.h>
 #else
 #include <strstream.h>
 #endif
+#else
+#include <strstream>
+using namespace std;
+#endif
 #include "scorefil.h"
 #include "scoredg.h"
 
@@ -58,14 +63,13 @@ ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile) :
        m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
 #endif
 
-       wxString* players = 0;
-       int length = 0;
-       scoreFile->GetPlayerList(&players, length);
+        wxArrayString players;
+       scoreFile->GetPlayerList( players);
 
        ostrstream os;
 
        os << "Player\tWins\tGames\tScore\n";
-       for (int i = 0; i < length; i++)
+       for (unsigned int i = 0; i < players.Count(); i++)
        {
                int wins, games, score;
                scoreFile->ReadPlayersScore(players[i], wins, games, score);
@@ -84,7 +88,6 @@ ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile) :
        char* str = os.str();
        m_text = str;
        delete str;
-       delete players;
 }
 
 ScoreCanvas::~ScoreCanvas()