1 /**********************************************************************
2  *
3  *   FreeDoko a Doppelkopf-Game
4  *
5  *   Copyright (C) 2001 – 2018 by Diether Knof and Borg Enders
6  *
7  *   This program is free software; you can redistribute it and/or
8  *   modify it under the terms of the GNU General Public License as
9  *   published by the Free Software Foundation; either version 2 of
10  *   the License, or (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *   You can find this license in the file 'gpl.txt'.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with this program; if not, write to the Free Software
20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  *   MA  02111-1307  USA
22  *
23  *  Contact:
24  *    Diether Knof dknof@posteo.de
25  *
26  **********************************************************************/
27 
28 #pragma once
29 
30 class FastPlay;
31 extern FastPlay fast_play;
32 
33 enum class FastPlayBit {
34     party_start          = 1,                         //   1 automatical start party
35     player               = party_start          << 1, //   2 change human players to ais
36     random_ai            = player               << 1, //   4 set the players to the random ai
37     pause                = random_ai            << 1, //   8 skip pauses
38     gameplay_information = pause                << 1, //  16 skip gameplay information dialogs
39     game_finished        = gameplay_information << 1, //  32 skip game finished dialog
40     party_finished        = game_finished       << 1, //  64 skip party finished dialog
41     show_all_hands      = party_finished        << 1, // 128 show all hands
42     hide_bug_report_window     = show_all_hands << 1, // 256 do not show the bug report replay window
43     quit_when_finished = hide_bug_report_window << 1, // 512 quit when finished
44     seed_info              = quit_when_finished << 1 // 1024 only write the seed on stdout
45 }; // enum class FastPlayBit
46 
47 class FastPlay {
48   friend FastPlay operator|(FastPlayBit lhs, FastPlayBit rhs) noexcept;
49   public:
50     static FastPlayBit const party_start;
51     static FastPlayBit const player;
52     static FastPlayBit const random_ai;
53     static FastPlayBit const pause;
54     static FastPlayBit const gameplay_information;
55     static FastPlayBit const game_finished;
56     static FastPlayBit const party_finished;
57     static FastPlayBit const show_all_hands;
58     static FastPlayBit const hide_bug_report_window;
59     static FastPlayBit const quit_when_finished;
60     static FastPlayBit const seed_info;
61 
62   public:
63     FastPlay() noexcept;
64     FastPlay(FastPlayBit v) noexcept;
65 
66     ~FastPlay() noexcept;
67 
68     operator bool() noexcept;
69 
70     FastPlay operator&(FastPlayBit rhs) const noexcept;
71 
72     FastPlay& operator|=(FastPlayBit rhs) noexcept;
73 
74     void add(FastPlayBit rhs) noexcept;
75     void remove(FastPlayBit rhs) noexcept;
76 
77   private:
78     int value = 0;
79 };
80 
81 FastPlay operator|(FastPlayBit lhs, FastPlayBit rhs) noexcept;
82