/////////////////////////////////////////////////////////////////////////////// // Name: bombs1.cpp // Purpose: Implementation of the class BombsGame // Author: P. Foggia 1996 // Modified by: // Created: 1996 // RCS-ID: $Id$ // Copyright: (c) 1996 P. Foggia // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ #pragma implementation #endif #include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif //precompiled headers #include "game.h" #include #include #define PROB 0.2 #ifndef RAND_MAX #define RAND_MAX INT_MAX #endif /*-------------------- BombsGame::~BombsGame() ---------------------*/ /*--------------------------------------------------------------------*/ BombsGame::~BombsGame() { if (field) free(field); } /*------------------ int BombsGame::Init(width,height) -------------------*/ /* Initialize the play field. Returns 0 on failure */ /*--------------------------------------------------------------------------*/ int BombsGame::Init(int aWidth, int aHeight) { int x, y; int xx, yy; if (field) free(field); field=(short *)malloc(aWidth*aHeight*sizeof(short)); if (!field) { width=height=0; return 0; } width=aWidth; height=aHeight; for(x=0; x=0 && xx=0 && yy