1 /* Pioneers - Implementation of the excellent Settlers of Catan board game.
2 * Go buy a copy.
3 *
4 * Copyright (C) 1999 Dave Cole
5 * Copyright (C) 2003 Bas Wijnen <shevek@fmf.nl>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (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 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "config.h"
23 #include <ctype.h>
24
25 #include "log.h"
26 #include "client.h"
27 #include "callback.h"
28
29 static gboolean rolled_dice; /* have we rolled the dice? */
30 static gint current_turn;
31
turn_rolled_dice(gint player_num,gint die1,gint die2)32 void turn_rolled_dice(gint player_num, gint die1, gint die2)
33 {
34 int roll;
35
36 roll = die1 + die2;
37 log_message(MSG_DICE, _("%s rolled %d.\n"),
38 player_name(player_num, TRUE), roll);
39
40 if (player_num == my_player_num()) {
41 rolled_dice = TRUE;
42 callbacks.get_map()->has_moved_ship = FALSE;
43 }
44 callbacks.rolled_dice(die1, die2, player_num);
45 }
46
turn_begin(gint player_num,gint num)47 void turn_begin(gint player_num, gint num)
48 {
49 current_turn = num;
50 log_message(MSG_DICE, _("Begin turn %d for %s.\n"),
51 num, player_name(player_num, FALSE));
52 rolled_dice = FALSE;
53 player_set_current(player_num);
54 develop_begin_turn();
55 build_clear();
56 callbacks.player_turn(player_num);
57 }
58
turn_num(void)59 gint turn_num(void)
60 {
61 return current_turn;
62 }
63
have_rolled_dice(void)64 gboolean have_rolled_dice(void)
65 {
66 return rolled_dice;
67 }
68