1 /**********************************************************
2  * Version $Id: Mine_Sweeper.h 1921 2014-01-09 10:24:11Z oconrad $
3  *********************************************************/
4 
5 ///////////////////////////////////////////////////////////
6 //                                                       //
7 //                         SAGA                          //
8 //                                                       //
9 //      System for Automated Geoscientific Analyses      //
10 //                                                       //
11 //                     Tool Library                      //
12 //                                                       //
13 //                     Mine_Sweeper                      //
14 //                                                       //
15 //-------------------------------------------------------//
16 //                                                       //
17 //                    Mine_Sweeper.h                     //
18 //                                                       //
19 //           Copyright (C) 2003 by Andre Ringeler        //
20 //                                                       //
21 //-------------------------------------------------------//
22 //                                                       //
23 // This file is part of 'SAGA - System for Automated     //
24 // Geoscientific Analyses'. SAGA is free software; you   //
25 // can redistribute it and/or modify it under the terms  //
26 // of the GNU General Public License as published by the //
27 // Free Software Foundation, either version 2 of the     //
28 // License, or (at your option) any later version.       //
29 //                                                       //
30 // SAGA is distributed in the hope that it will be       //
31 // useful, but WITHOUT ANY WARRANTY; without even the    //
32 // implied warranty of MERCHANTABILITY or FITNESS FOR A  //
33 // PARTICULAR PURPOSE. See the GNU General Public        //
34 // License for more details.                             //
35 //                                                       //
36 // You should have received a copy of the GNU General    //
37 // Public License along with this program; if not, see   //
38 // <http://www.gnu.org/licenses/>.                       //
39 //                                                       //
40 //-------------------------------------------------------//
41 //                                                       //
42 //    e-mail:     your@e-mail.abc                        //
43 //                                                       //
44 //    contact:    Your Name                              //
45 //                And Address                            //
46 //                                                       //
47 ///////////////////////////////////////////////////////////
48 
49 
50 ///////////////////////////////////////////////////////////
51 //														 //
52 //														 //
53 //														 //
54 ///////////////////////////////////////////////////////////
55 
56 //---------------------------------------------------------
57 #ifndef HEADER_INCLUDED__Mine_Sweeper_H
58 #define HEADER_INCLUDED__Mine_Sweeper_H
59 
60 //---------------------------------------------------------
61 #include "MLB_Interface.h"
62 
63 #include <time.h>
64 
65 
66 ///////////////////////////////////////////////////////////
67 //														 //
68 //														 //
69 //														 //
70 ///////////////////////////////////////////////////////////
71 
72 //---------------------------------------------------------
73 
74 class CTimer
75 {
76 public:
77 
78 	CTimer(void);
79 	~CTimer(void);
80 
81 	int Time(void);
82 
83 protected:
84 
85 	time_t starttime;
86 
87 };
88 
89 
90 class CMine_Sweeper : public CSG_Tool_Interactive
91 {
92 public:
93 	CMine_Sweeper(void);
94 	virtual ~CMine_Sweeper(void);
95 
96 
97 	CSG_Grid	*pInput;
98 
99 protected:
100 
101 	virtual bool			On_Execute(void);
102 	virtual bool			On_Execute_Finish	(void);
103 	virtual bool			On_Execute_Position	(CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode);
104 
105 	bool					Get_Grid_Pos(int &x, int &y);
106 
107 	void SetSprite(int xpos, int ypos, int nr);
108 
109 	bool	MakeBoard(int level);
110 
111 	void Make_GameBoard(int xpos,int ypos);
112 
113 	void Show_GameBoard(bool ShowMines);
114 
115 	int Get_Number_of_Bombs(int xpos, int ypos);
116 
117 	bool Play(int xpos, int ypos,bool computer_move);
118 
119 	void Mark(int xpos, int ypos);
120 
121 	void ResetBoard(int xpos, int ypos);
122 
123 	int Mine_NX,Mine_NY, N_Mines;
124 
125 	int OpenFields, MarkedMines;
126 
127 	CSG_Grid *GameBoard, *FlagBoard;
128 
129 	bool First_Click;
130 
131 	CTimer *Time;
132 
133 private:
134 
135 };
136 
137 
138 
139 #endif // #ifndef HEADER_INCLUDED__Mine_Sweeper_H
140