fixed a compilation error for VC++ 6

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5240 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-01-04 17:53:52 +00:00
parent 04165bec2c
commit ecbdd409e1

View File

@@ -40,7 +40,7 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
// for all others, include the necessary headers // for all others, include the necessary headers
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
@@ -250,13 +250,13 @@ BEGIN_EVENT_TABLE(LifeFrame, wxFrame)
EVT_MENU (ID_ABOUT, LifeFrame::OnMenu) EVT_MENU (ID_ABOUT, LifeFrame::OnMenu)
EVT_MENU (ID_EXIT, LifeFrame::OnMenu) EVT_MENU (ID_EXIT, LifeFrame::OnMenu)
EVT_COMMAND_SCROLL (ID_SLIDER, LifeFrame::OnSlider) EVT_COMMAND_SCROLL (ID_SLIDER, LifeFrame::OnSlider)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(LifeCanvas, wxScrolledWindow) BEGIN_EVENT_TABLE(LifeCanvas, wxScrolledWindow)
EVT_PAINT ( LifeCanvas::OnPaint) EVT_PAINT ( LifeCanvas::OnPaint)
EVT_SIZE ( LifeCanvas::OnSize) EVT_SIZE ( LifeCanvas::OnSize)
EVT_MOUSE_EVENTS ( LifeCanvas::OnMouse) EVT_MOUSE_EVENTS ( LifeCanvas::OnMouse)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(LifeNewGameDialog, wxDialog) BEGIN_EVENT_TABLE(LifeNewGameDialog, wxDialog)
EVT_BUTTON (wxID_OK, LifeNewGameDialog::OnOK) EVT_BUTTON (wxID_OK, LifeNewGameDialog::OnOK)
@@ -613,7 +613,7 @@ void LifeCanvas::DrawCell(int i, int j, wxDC &dc)
m_cellsize - 1); m_cellsize - 1);
} }
} }
// event handlers // event handlers
void LifeCanvas::OnPaint(wxPaintEvent& event) void LifeCanvas::OnPaint(wxPaintEvent& event)
{ {
@@ -634,7 +634,7 @@ void LifeCanvas::OnPaint(wxPaintEvent& event)
h = upd.GetH(); h = upd.GetH();
CalcUnscrolledPosition(x, y, &xx, &yy); CalcUnscrolledPosition(x, y, &xx, &yy);
dc.Blit(x, y, w, h, &memdc, xx - m_xoffset, yy - m_yoffset); dc.Blit(x, y, w, h, &memdc, xx - m_xoffset, yy - m_yoffset);
upd++; upd++;
} }
@@ -770,7 +770,7 @@ void LifeNewGameDialog::OnOK(wxCommandEvent& WXUNUSED(event))
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
Life::Life(int width, int height) Life::Life(int width, int height)
{ {
Create(width, height); Create(width, height);
} }
@@ -824,6 +824,7 @@ void Life::SetCell(int x, int y, bool alive)
bool Life::NextTic() bool Life::NextTic()
{ {
long changed = 0; long changed = 0;
int i, j;
/* 1st pass. Find and mark deaths and births for this generation. /* 1st pass. Find and mark deaths and births for this generation.
* *
@@ -832,8 +833,8 @@ bool Life::NextTic()
* An organism with >= 4 neighbors will die due to starvation. * An organism with >= 4 neighbors will die due to starvation.
* New organisms are born in cells with exactly 3 neighbors. * New organisms are born in cells with exactly 3 neighbors.
*/ */
for (int j = 0; j < m_height; j++) for (j = 0; j < m_height; j++)
for (int i = 0; i < m_width; i++) for (i = 0; i < m_width; i++)
{ {
int neighbors = GetNeighbors(i, j); int neighbors = GetNeighbors(i, j);
bool alive = IsAlive(i, j); bool alive = IsAlive(i, j);
@@ -847,13 +848,13 @@ bool Life::NextTic()
(alive && (neighbors <= 1 || neighbors >= 4))) (alive && (neighbors <= 1 || neighbors >= 4)))
m_cells[j * m_width + i] |= CELL_MARK; m_cells[j * m_width + i] |= CELL_MARK;
else else
m_cells[j * m_width + i] &= ~CELL_MARK; m_cells[j * m_width + i] &= ~CELL_MARK;
} }
/* 2nd pass. Stabilize. /* 2nd pass. Stabilize.
*/ */
for (int j = 0; j < m_height; j++) for (j = 0; j < m_height; j++)
for (int i = 0; i < m_width; i++) for (i = 0; i < m_width; i++)
{ {
/* Toggle CELL_ALIVE for those cells marked in the /* Toggle CELL_ALIVE for those cells marked in the
* previous pass. Do not clear the CELL_MARK bit yet; * previous pass. Do not clear the CELL_MARK bit yet;
@@ -888,7 +889,7 @@ int Life::GetNeighbors(int x, int y) const
if (IsAlive(x, y)) neighbors--; if (IsAlive(x, y)) neighbors--;
return neighbors; return neighbors;
} }
void Life::SetCell(int x, int y, Cell status) void Life::SetCell(int x, int y, Cell status)
{ {