summaryrefslogtreecommitdiffstats
path: root/klines/field.h
blob: de9ee8ce30702319baf4b3fb2e58223e8b653ac9 (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
/***************************************************************************
    begin                : Fri May 19 2000
    copyright            : (C) 2000 by Roman Merzlyakov
    email                : [email protected]
    copyright            : (C) 2000 by Roman Razilov
    email                : [email protected]
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 <qobject.h>
#include <qwidget.h>
#include "cell.h"
// size of game field
#define NUMCELLSW 9
#define NUMCELLSH 9

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

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

protected:
  Field(QWidget* 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