summaryrefslogtreecommitdiffstats
path: root/kbattleship/kbattleship/kbdiagonalshotstrategy.h
blob: 47af12408d20aef3af08b67a5748ed8e5f91c8e6 (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
/***************************************************************************
                            kbdiagonalshotstrategy.h
                                  ----------
    Developers: (c) 2001 Kevin Krammer <kevin.krammer@gmx.at>

 ***************************************************************************/

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

#include "kbstrategy.h"

class KBDiagonalShotStrategy : public KBStrategy
{
public:
	enum Direction {LEFTUP, LEFTDOWN, RIGHTUP, RIGHTDOWN};
	KBDiagonalShotStrategy(KBStrategy *tqparent = 0);

	virtual const TQPoint nextShot();
	virtual bool hasMoreShots();
	virtual void shotAt(const TQPoint &pos);
	virtual void startAt(int col, int row, Direction dir);
	virtual TQPoint endPoint();

private:
	bool advance();

	int m_row;
	int m_column;
	int m_vertical;
	int m_horizontal;
};

#endif