1 /* Pioneers - Implementation of the excellent Settlers of Catan board game. 2 * Go buy a copy. 3 * 4 * Copyright (C) 1999 Dave Cole 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef __quoteinfo_h 22 #define __quoteinfo_h 23 24 typedef struct { 25 GList *list; /* list entry which owns the quote */ 26 gboolean is_domestic; /* is this a maritime trade? */ 27 union { 28 struct { 29 gint player_num; /* player who make the quote */ 30 gint quote_num; /* quote identifier */ 31 gint supply[NO_RESOURCE]; /* resources supplied in the quote */ 32 gint receive[NO_RESOURCE]; /* resources received in the quote */ 33 } d; 34 struct { 35 gint ratio; 36 Resource supply; 37 Resource receive; 38 } m; 39 } var; 40 } QuoteInfo; 41 42 typedef struct { 43 GList *quotes; 44 } QuoteList; 45 46 /** Create a new quote list, and remove the old list if needed */ 47 void quotelist_new(QuoteList ** list); 48 /** Free the QuoteList (if needed), and set it to NULL */ 49 void quotelist_free(QuoteList ** list); 50 QuoteInfo *quotelist_add_domestic(QuoteList * list, gint player_num, 51 gint quote_num, const gint * supply, 52 const gint * receive); 53 QuoteInfo *quotelist_add_maritime(QuoteList * list, gint ratio, 54 Resource supply, Resource receive); 55 QuoteInfo *quotelist_first(QuoteList * list); 56 QuoteInfo *quotelist_prev(const QuoteInfo * quote); 57 QuoteInfo *quotelist_next(const QuoteInfo * quote); 58 gboolean quotelist_is_player_first(const QuoteInfo * quote); 59 QuoteInfo *quotelist_find_domestic(QuoteList * list, gint player_num, 60 gint quote_num); 61 void quotelist_delete(QuoteList * list, QuoteInfo * quote); 62 63 #endif 64