summaryrefslogtreecommitdiffstats
path: root/libksirtet/common/inter.h
blob: daffc3e9e0374815d50f9ae7b0fa11ba29fa1b82 (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
#ifndef COMMON_INTER_H
#define COMMON_INTER_H

#include <kexthighscore.h>
#include "lib/libksirtet_export.h"

#include "lib/mp_simple_interface.h"
#include "base/inter.h"
#include "types.h"
#include "board.h"


class Field;

class LIBKSIRTET_EXPORT Interface : public MPSimpleInterface, public BaseInterface
{
    Q_OBJECT
  TQ_OBJECT
public:
    Interface(const MPGameInfo &, TQWidget *parent);

signals:
    void settingsChanged();

public slots:
    void normalGame();
    void arcadeGame();
    void settingsChangedSlot() { emit settingsChanged(); }

protected:
    void _showHighscores(TQWidget *parent);

private:
    TQMemArray<ClientPlayData> _data;
    KExtHighscore::Score _score;
    KExtHighscore::MultiplayerScores _scores;
    Field *_firstField;

    enum Action { Nb_Actions = 8 };
    static const ActionData ACTION_DATA[Nb_Actions];
    static const int KEYCODE_ONE[Nb_Actions];
    static const int KEYCODE_TWO[Nb_Actions];

    MPBoard *newBoard(uint);
    void setInitData(uint player, ServerInitData &);
    uint prev(uint i) const;
    uint next(uint i) const;

    void _readGameOverData(TQDataStream &s);
    void _sendGameOverData(TQDataStream &s);
    void _firstInit() {}
    void _treatInit();
    void _init();
    void _showGameOverData();
    bool _readPlayData();
    void _sendPlayData();

    void _start() { MPSimpleInterface::start(); }
    void _pause() { MPSimpleInterface::pause(); }
    bool _isPaused() const { return MPSimpleInterface::isPaused(); }
};

#endif