You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
/***************************************************************************
|
|
kbdestroyshipstratgey.h
|
|
----------
|
|
Developers: (c) 2001 Kevin Krammer <kevin.krammer@gmx.at>
|
|
(c) 2001 Nikolas Zimmermann <wildfox@kde.org>
|
|
|
|
***************************************************************************/
|
|
|
|
/***************************************************************************
|
|
* *
|
|
* 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 KBDESTROYSHIPSTRATEGY_H
|
|
#define KBDESTROYSHIPSTRATEGY_H
|
|
|
|
#include "kbstrategy.h"
|
|
|
|
class KBDestroyShipStrategy : public KBStrategy
|
|
{
|
|
public:
|
|
KBDestroyShipStrategy(KBStrategy *parent = 0);
|
|
|
|
virtual void init(KBattleField *field, const TQRect &field_rect);
|
|
virtual const TQPoint nextShot();
|
|
virtual bool hasMoreShots();
|
|
virtual void shotAt(const TQPoint &pos);
|
|
|
|
virtual void destroyShipAt(const TQPoint pos);
|
|
|
|
private:
|
|
enum {NODIR, VERTICAL, HORIZONTAL};
|
|
|
|
bool m_working;
|
|
TQPoint m_start;
|
|
|
|
int m_column;
|
|
int m_row;
|
|
|
|
int m_direction;
|
|
|
|
virtual bool searchUp();
|
|
virtual bool searchDown();
|
|
virtual bool searchLeft();
|
|
virtual bool searchRight();
|
|
|
|
virtual bool shipDestroyed();
|
|
virtual void markBorderingFields();
|
|
};
|
|
|
|
#endif
|