X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/764835a5d5b72c635527bfbb350d190c89381b44..bf354396f61a2e1bd5544b67ecde341b6ff9bf35:/demos/life/game.h diff --git a/demos/life/game.h b/demos/life/game.h index 1366c18fec..323fd2b06f 100644 --- a/demos/life/game.h +++ b/demos/life/game.h @@ -12,7 +12,7 @@ #ifndef _LIFE_GAME_H_ #define _LIFE_GAME_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "game.h" #endif @@ -47,8 +47,8 @@ public: m_rules = rules; m_shape = shape; }; - - // A more convenient ctor for the built-in samples + + // A more convenient ctor for the built-in samples LifePattern(wxString name, wxString description, int width, @@ -57,10 +57,19 @@ public: { m_name = name; m_description = description; - m_rules = _(""); - m_shape.Add( wxString::Format("%i %i", -width/2, -height/2) ); + m_rules = wxEmptyString; + m_shape.Add( wxString::Format(_T("%i %i"), -width/2, -height/2) ); for(int j = 0; j < height; j++) - m_shape.Add( wxString(shape + (j * width), (size_t) width) ); + { + wxString tmp; + + for(int i = 0; i < width; i++) + { + tmp += wxChar(shape[j * width + i]); + } + + m_shape.Add( tmp ); + } }; wxString m_name; @@ -79,7 +88,7 @@ struct LifeCell { wxInt32 i; wxInt32 j; -}; +}; // A private class that contains data about a block of cells class LifeCellBox; @@ -97,7 +106,7 @@ public: inline wxString GetRules() const { return m_rules; }; inline wxString GetDescription() const { return m_description; }; bool IsAlive(wxInt32 x, wxInt32 y); - void SetCell(wxInt32 x, wxInt32 y, bool alive = TRUE); + void SetCell(wxInt32 x, wxInt32 y, bool alive = true); void SetPattern(const LifePattern &pattern); // game control @@ -114,7 +123,7 @@ public: // The following functions find cells within a given viewport; either // all alive cells, or only those cells which have changed since last // generation. You first call BeginFind() to specify the viewport, - // then keep calling FindMore() until it returns TRUE. + // then keep calling FindMore() until it returns true. // // BeginFind: // Specify the viewport and whether to look for alive cells or for @@ -126,7 +135,7 @@ public: // Fills an array with cells that match the specification given with // BeginFind(). The array itself belongs to the Life object and must // not be modified or freed by the caller. If this function returns - // FALSE, then the operation is not complete: just process all cells + // false, then the operation is not complete: just process all cells // and call FillMore() again. // void BeginFind(wxInt32 x0, wxInt32 y0, @@ -137,7 +146,7 @@ public: private: // cellbox-related LifeCellBox *CreateBox(wxInt32 x, wxInt32 y, wxUint32 hv); - LifeCellBox *LinkBox(wxInt32 x, wxInt32 y, bool create = TRUE); + LifeCellBox *LinkBox(wxInt32 x, wxInt32 y, bool create = true); void KillBox(LifeCellBox *c); // helper for BeginFind & FindMore