summaryrefslogtreecommitdiffstats
path: root/klines/field.h
blob: 6fd8c67ec520d50662989e038b2c6255722640dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/***************************************************************************
    begin                : Fri May 19 2000
    copyright            : (C) 2000 by Roman Merzlyakov
    email                : roman@sbrf.barrt.ru
    copyright            : (C) 2000 by Roman Razilov
    email                : Roman.Razilov@gmx.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef FIELD_H
#define FIELD_H

#include <tqobject.h>
#include <tqwidget.h>
#include "cell.h"
// size of game field
#define NUMCELLSW 9
#define NUMCELLSH 9

class Field: public TQWidget
{
  Q_OBJECT
  
public:
  void clearField();

  int calcPosScore(int x, int y, int whatIf);
  void saveUndo();

protected:
  Field(TQWidget* parent, const char* name);
  ~Field();

  void putBall(int x, int y, int color);
  void putBallRun(int x, int y, int color);
  void removeBall(int x, int y );
  int getBall(int x, int y);
  int getAnim(int x, int y);
  void setAnim(int x, int y, int anim );
  void clearAnim();
  int deleteAnimatedBalls();
  void moveBall(int xa, int ya, int xb, int yb);
  int calcRun(int sx, int sy, int dx, int dy);
  

  bool checkBounds( int x, int y );
//  virtual int erase5Balls(){ return 0;}
  int freeSpace();
  void restoreUndo();

private:
  Cell field[NUMCELLSH][NUMCELLSW];
  Cell field_undo[NUMCELLSH][NUMCELLSW];
//  void search5Balls();

};

#endif