solo.h 2.44 KB
Newer Older
Vivien Kraus's avatar
Vivien Kraus committed
1
2
3
4
5
/* tarot implements the rules of the tarot game
 * Copyright (C) 2019  Vivien Kraus
 *
 * 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
6
 * the Free Software Foundation, version 3 of the License.
Vivien Kraus's avatar
Vivien Kraus committed
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
64
65
66
67
68
69
70
71
72
73
74
75
76
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef H_TAROT_SOLO_INCLUDED
#define H_TAROT_SOLO_INCLUDED

#include <stddef.h>
#include <tarot/game.h>
#include <tarot/player.h>
#include <tarot/cards.h>

#ifdef __cplusplus
extern "C"
{
#endif                          /* __cplusplus */

  struct TarotSolo;
  typedef struct TarotSolo TarotSolo;

  /**
   * tarot_solo_alloc: (constructor)
   */
  TarotSolo *tarot_solo_alloc (void);
  TarotSolo *tarot_solo_dup (const TarotSolo *source);
  void tarot_solo_free (TarotSolo *solo);

  /**
   * tarot_solo_construct:
   * @max_mem: available number of bytes in @mem
   * @mem_out: (array length=max_mem): available aligned memory
   * @alignment: (out): the game alignment
   */
  size_t tarot_solo_con(size_t max_mem, char *mem_out, size_t *alignment);

  void tarot_solo_copy (TarotSolo * dest, const TarotSolo * source);
  void tarot_solo_copy_as (TarotSolo *dest, const TarotSolo *source, TarotPlayer who);

  /**
   * tarot_solo_get:
   * @game: (out):
   */
  void tarot_solo_get (const TarotSolo *solo, TarotGame *game);
  TarotGame *tarot_solo_get_alloc (const TarotSolo *solo);

  /**
   * tarot_solo_setup:
   * @with_call: (type boolean):
   */
  TarotGameError tarot_solo_setup (TarotSolo *solo, size_t n_players, int with_call, TarotPlayer myself, size_t n_owners, const TarotPlayer *owners, TarotPlayer taker, TarotCard call);

  /**
   * tarot_solo_setup_random:
   * @seed: (array length=seed_size) (type char):
   * @with_call: (type boolean):
   */
  TarotGameError tarot_solo_setup_random (TarotSolo *solo, size_t n_players, int with_call, size_t seed_size, const void *seed);
  TarotGameError tarot_solo_add (TarotSolo *solo, const TarotGameEvent *event);

#ifdef __cplusplus
}
#endif                          /* __cplusplus */

#endif                          /* not H_TAROT_SOLO_INCLUDED */