File indexing completed on 2024-04-14 04:00:51

0001 /*
0002     SPDX-FileCopyrightText: 2003 Russell Steffen <rsteffen@bayarea.net>
0003     SPDX-FileCopyrightText: 2003 Stephan Zehetner <s.zehetner@nevox.org>
0004     SPDX-FileCopyrightText: 2006 Dmitry Suzdalev <dimsuz@gmail.com>
0005     SPDX-FileCopyrightText: 2006 Inge Wallin <inge@lysator.liu.se>
0006     SPDX-FileCopyrightText: 2006 Pierre Ducroquet <pinaraf@gmail.com>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef KONQUEST_FLEET_H
0012 #define KONQUEST_FLEET_H
0013 
0014 #include <QObject>
0015 
0016 class Player;
0017 class Planet;
0018 
0019 //**********************************************************
0020 // class Fleet
0021 // +--- class AttackFleet
0022 // +--- class DefenseFleet
0023 //**********************************************************
0024 
0025 class Fleet : public QObject
0026 {
0027 public:
0028 
0029     explicit Fleet( long long initialShipCount );
0030     ~Fleet() override {}
0031 
0032     long long   shipCount()   const { return m_shipCount; }
0033     void  removeShips( long long lostShips );
0034 
0035 protected:
0036     long long m_shipCount;
0037 };
0038 
0039 
0040 class AttackFleet : public Fleet
0041 {
0042 public:
0043     AttackFleet( Planet *src, Planet *dest, long long initialCount, int arrivalTurn );
0044 
0045     Player  *owner;
0046     Planet  *source;
0047     Planet  *destination;
0048     int      arrivalTurn;
0049 };
0050 
0051 
0052 class DefenseFleet : public Fleet
0053 {
0054     Q_OBJECT
0055 
0056 public:
0057     DefenseFleet( Planet *newHome, long long initialCount  );
0058 
0059     void absorb( AttackFleet *fleet );
0060     void become( AttackFleet *fleet );
0061 
0062     void addShips( long long newShips );
0063     
0064     AttackFleet *spawnAttackFleet( Planet *destination, long long shipCount, int arrivalTurn );
0065 
0066     Planet *home;
0067 Q_SIGNALS:
0068     void update();
0069 };
0070 
0071 typedef QList<AttackFleet *> AttackFleetList;
0072 
0073 #endif // KONQUEST_FLEET_H