blob: 25a1774ed234d318883f39a58eea3fb22357e535 (
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
|
#ifndef _EIGHTBALL_H
#define _EIGHTBALL_H
#include <tqobject.h>
#include <klibloader.h>
#include "vector.h"
#include "point.h"
#include "rules.h"
// Forward declarations of our helper classes
class TQString;
class KuePlayer;
class NineBallFactory : KLibFactory {
public:
TQObject* createObject(TQObject*, const char*, const char*, const TQStringList &);
};
class NineBall : public KueRulesEngine {
TQ_OBJECT
public:
NineBall(TQObject *parent, const char *name);
~NineBall();
void start();
protected slots:
// Called by physics engine when a billiard is sunk
void billiardSunk(unsigned int ball, unsigned int pocket);
// Called by physics engine when a billiard is struck (by the cue ball or another billiard)
void billiardHit(unsigned int ball1, unsigned int ball2);
// Called by the physics engine when all billiards have stopped moving
void motionStopped();
void cuePlaced();
void shotTaken();
private:
// Ask the interface to start the shot
TQString startShotMessage();
// Ask the interface to place the cue ball
TQString placeCueBallMessage();
// Is a ball the cue ball?
bool ballIsCue(unsigned int number);
// Is a ball the magic ball (8)?
bool ballIsLowest(unsigned int number);
// Handle a player's victory
void playerWins();
// Is this shot a scratch?
bool _foul;
// First ball sunk
int _first_sunk;
// First ball hit
int _first_hit;
// The current player
KuePlayer *_current_player;
// The current team
int _current_team;
// Have we had a successful break?
bool _broke;
};
#endif
|