Module: wine
Branch: master
Commit: beccf3758692cb48b7ac8bc30265ae36d0e50771
URL: http://source.winehq.org/git/wine.git/?a=commit;h=beccf3758692cb48b7ac8bc30…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com>
Date: Tue Jun 24 14:09:50 2008 -0400
winemine: The number of mines should be visible before first choice.
There were a few lines of code that I removed that explicitly kept the
number of mines and the timer unlit before the game started. This isn't
consistent with Windows, so I don't know what the purpose was for doing
this. In fact, it prevents the number of mines from being shown ahead
of time, which is useful information.
---
programs/winemine/main.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/programs/winemine/main.c b/programs/winemine/main.c
index 6c90519..13311c7 100644
--- a/programs/winemine/main.c
+++ b/programs/winemine/main.c
@@ -704,11 +704,6 @@ void DrawLeds( HDC hdc, HDC hMemDC, BOARD *p_board, int number, int x, int y )
led[i] = 10;
}
- /* use unlit led if not playing */
- if( p_board->status == WAITING )
- for( i = 0; i < 3; i++ )
- led[i] = 11;
-
hOldObj = SelectObject (hMemDC, p_board->hLedsBMP);
for( i = 0; i < 3; i++ ) {
Module: wine
Branch: master
Commit: 04f925e72ce4c87dbdf503072dd58e4e444d3760
URL: http://source.winehq.org/git/wine.git/?a=commit;h=04f925e72ce4c87dbdf503072…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com>
Date: Tue Jun 24 14:09:42 2008 -0400
winemine: Set mines after first choice.
The first choice never is on a mine in Windows. This can be tested by
making a custom game with as many mines as possible, and then playing
the start of many games, and the first choice will never be on a mine.
This is done to make the game reasonable, since after the first choice
there will at least be some information given to make the next choice.
---
programs/winemine/main.c | 46 +++++++++++++++++++++++++++-------------------
programs/winemine/main.h | 2 +-
2 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/programs/winemine/main.c b/programs/winemine/main.c
index f4a48d0..2d17536 100644
--- a/programs/winemine/main.c
+++ b/programs/winemine/main.c
@@ -452,13 +452,24 @@ static void MoveOnScreen(RECT* rect)
void CreateBoard( BOARD *p_board )
{
int left, top, bottom, right;
+ unsigned col, row;
RECT wnd_rect;
p_board->mb = MB_NONE;
p_board->boxes_left = p_board->cols * p_board->rows - p_board->mines;
p_board->num_flags = 0;
- CreateBoxes( p_board );
+ /* Create the boxes...
+ * We actually create them with an empty border,
+ * so special care doesn't have to be taken on the edges
+ */
+ for( col = 0; col <= p_board->cols + 1; col++ )
+ for( row = 0; row <= p_board->rows + 1; row++ ) {
+ p_board->box[col][row].IsPressed = FALSE;
+ p_board->box[col][row].IsMine = FALSE;
+ p_board->box[col][row].FlagType = NORMAL;
+ p_board->box[col][row].NumMines = 0;
+ }
p_board->width = p_board->cols * MINE_WIDTH + BOARD_WMARGIN * 2;
@@ -531,30 +542,21 @@ void CheckLevel( BOARD *p_board )
if( p_board->mines < BEGINNER_MINES )
p_board->mines = BEGINNER_MINES;
- if( p_board->mines > p_board->cols * p_board->rows - 1 )
- p_board->mines = p_board->cols * p_board->rows - 1;
+ if( p_board->mines > p_board->cols * p_board->rows - 2 )
+ p_board->mines = p_board->cols * p_board->rows - 2;
}
-
-void CreateBoxes( BOARD *p_board )
+/* Randomly places mines everywhere except the selected box. */
+void PlaceMines ( BOARD *p_board, int selected_col, int selected_row )
{
int i, j;
unsigned col, row;
srand( (unsigned) time( NULL ) );
- /* Create the boxes...
- * We actually create them with an empty border,
- * so special care doesn't have to be taken on the edges
- */
-
- for( col = 0; col <= p_board->cols + 1; col++ )
- for( row = 0; row <= p_board->rows + 1; row++ ) {
- p_board->box[col][row].IsPressed = FALSE;
- p_board->box[col][row].IsMine = FALSE;
- p_board->box[col][row].FlagType = NORMAL;
- p_board->box[col][row].NumMines = 0;
- }
+ /* Temporarily place a mine at the selected box until all the other
+ * mines are placed, this avoids checking in the mine creation loop. */
+ p_board->box[selected_col][selected_row].IsMine = TRUE;
/* create mines */
i = 0;
@@ -568,11 +570,13 @@ void CreateBoxes( BOARD *p_board )
}
}
+ /* Remove temporarily placed mine for selected box */
+ p_board->box[selected_col][selected_row].IsMine = FALSE;
+
/*
* Now we label the remaining boxes with the
* number of mines surrounding them.
*/
-
for( col = 1; col < p_board->cols + 1; col++ )
for( row = 1; row < p_board->rows + 1; row++ ) {
for( i = -1; i <= 1; i++ )
@@ -838,8 +842,12 @@ void TestMines( BOARD *p_board, POINT pt, int msg )
p_board->press.x, p_board->press.y );
p_board->press.x = 0;
p_board->press.y = 0;
- if( p_board->box[col][row].FlagType != FLAG )
+ if( p_board->box[col][row].FlagType != FLAG
+ && p_board->status != PLAYING )
+ {
p_board->status = PLAYING;
+ PlaceMines( p_board, col, row );
+ }
CompleteBox( p_board, col, row );
break;
diff --git a/programs/winemine/main.h b/programs/winemine/main.h
index 37fa768..16fcb2e 100644
--- a/programs/winemine/main.h
+++ b/programs/winemine/main.h
@@ -134,7 +134,7 @@ void CheckLevel( BOARD *p_board );
void CreateBoard( BOARD *p_board );
-void CreateBoxes( BOARD *p_board );
+void PlaceMines ( BOARD *p_board, int selected_col, int selected_row );
void TestBoard( HWND hWnd, BOARD *p_board, int x, int y, int msg );