File indexing completed on 2024-09-15 06:37:36
0001 /* 0002 SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef PLAYERENTITY_H 0008 #define PLAYERENTITY_H 0009 0010 #include <QList> 0011 0012 #include "sea.h" 0013 #include "uientity.h" 0014 #include "delegate.h" 0015 #include "stats.h" 0016 0017 class ChatWidget; 0018 0019 class PlayerEntity : public UIEntity, private Delegate 0020 { 0021 Q_OBJECT 0022 QList<Ship*> m_ships; 0023 0024 Ship* canAddShip(const Coord& c); 0025 0026 ChatWidget* m_chat; 0027 public: 0028 PlayerEntity(Sea::Player player, Sea* sea, SeaView* view, ChatWidget* chat); 0029 0030 // entity interface 0031 void start() override; 0032 void startPlacing() override; 0033 void startPlaying() override; 0034 void hit(Shot* shot) override; 0035 void notify(Sea::Player player, const Coord& c, const HitInfo& info) override; 0036 void notifyChat(const Entity* entity, const QString& text) override; 0037 void notifyNick(Sea::Player player, const QString& text) override; 0038 void notifyGameOptions() override { }; 0039 // delegate interface 0040 void action(Sea::Player player, const Coord& c) override; 0041 void changeDirection(Sea::Player player) override; 0042 bool canAddShip(Sea::Player player, const Coord& c) override; 0043 Ship * nextShip() override; 0044 0045 void setNick(const QString& nick) override; 0046 protected: 0047 // parent interface 0048 void registerHit(Sea::Player player, const Coord& c) override; 0049 void registerMiss(Sea::Player player, const Coord& c) override; 0050 public Q_SLOTS: 0051 void notifyAbort() override; 0052 void notifyRestartPlacing(Sea::Player player) override; 0053 }; 0054 0055 #endif // PLAYERENTITY_H