summaryrefslogtreecommitdiffstats
path: root/kgoldrunner/src/kgrobject.h
blob: 2ac41b3aa4dcbf60a5d3fa1a6f7f0cba9ba5ada5 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/***************************************************************************
                         kgrobject.h  -  description
                             -------------------
    begin                : Wed Jan 23 2002
    copyright            : (C) 2002 by Marco Krüger and Ian Wadham
    email                : See menu "Help, About KGoldrunner"
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 KGROBJECT_H
#define KGROBJECT_H

// Obsolete - #include <iostream.h>
#include <iostream>

#include <tqtimer.h>
#include <stdlib.h> // for random

class KGrCanvas;

class KGrObject : public TQObject
{
  TQ_OBJECT
  
public:
  KGrObject (char objType);
  virtual ~KGrObject();

  // STATIC GLOBAL FLAGS.
  static bool frozen;		// Game play halted (use ESCAPE key).
  static bool bugFixed;		// Dynamic bug fix turned on (key B, if halted).
  static bool logging;		// Log printing turned on.

  char whatIam();
  int searchValue;
  bool blocker; // Beton or Brick -> TRUE
  void showState (int, int);

protected:
  KGrCanvas * objectView;
  int xpos;
  int ypos;
  char iamA;
};

class KGrEditable : public KGrObject
{
  TQ_OBJECT
  
public:
  KGrEditable (char editType);
  virtual ~KGrEditable ();
  void setType (char);
};

class KGrFree : public KGrObject
{ TQ_OBJECT
  
public:
  KGrFree (char objType, int i, int j, KGrCanvas * view);
  virtual ~KGrFree();
  void setNugget(bool);

protected:
  char theRealMe;	// Set to FREE or HLADDER, even when "iamA == NUGGET".
};

class KGrBrick : public KGrObject
{
  TQ_OBJECT
  
public:
  KGrBrick (char objType, int i, int j, KGrCanvas * view);
  virtual ~KGrBrick();
  void dig(void);
  void useHole();
  void unUseHole();
  static int speed;	// Digging & repair speed (copy of KGrFigure::speed).
  static int HOLETIME;	// Number of timing cycles for a hole to remain open.
  void doStep();
  void showState (int, int);

protected slots:
  void timeDone(void);

private:
  int dig_counter;
  int hole_counter;
  bool holeFrozen;
  TQTimer *timer;
};

class KGrHladder : public KGrFree
{
  TQ_OBJECT
  
public:
  // BUG FIX - Ian W., 21/6/01 - must inherit "setNugget()" from "KGrFree".
  KGrHladder (char objType, int i, int j, KGrCanvas * view);
  virtual ~KGrHladder();
  void showLadder();
};

#endif // KGROBJECT_H