1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
13 #ifndef FC__GLOBAL_WORKLIST_H
14 #define FC__GLOBAL_WORKLIST_H
18 #endif /* __cplusplus */
27 struct global_worklist
; /* Opaque type. */
28 struct global_worklist_list
; /* Opaque type. */
30 void global_worklists_init(void);
31 void global_worklists_free(void);
32 void global_worklists_build(void);
33 void global_worklists_unbuild(void);
35 void global_worklists_load(struct section_file
*file
);
36 void global_worklists_save(struct section_file
*file
);
37 int global_worklists_number(void);
39 struct global_worklist
*global_worklist_new(const char *name
);
40 void global_worklist_destroy(struct global_worklist
*pgwl
);
42 struct global_worklist
*global_worklist_by_id(int id
);
44 bool global_worklist_is_valid(const struct global_worklist
*pgwl
);
45 bool global_worklist_set(struct global_worklist
*pgwl
,
46 const struct worklist
*pwl
);
47 const struct worklist
*global_worklist_get(const struct global_worklist
*pgwl
);
48 int global_worklist_id(const struct global_worklist
*pgwl
);
49 void global_worklist_set_name(struct global_worklist
*pgwl
, const char *name
);
50 const char *global_worklist_name(const struct global_worklist
*pgwl
);
52 #define SPECLIST_TAG global_worklist
53 #define SPECLIST_TYPE struct global_worklist
56 /* Iterates all global worklists, include the ones which are not valid. */
57 #define global_worklists_iterate_all(pgwl) \
58 if (client.worklists) { \
59 TYPED_LIST_ITERATE(struct global_worklist, client.worklists, pgwl)
60 #define global_worklists_iterate_all_end \
64 /* Iterates all valid global worklists. */
65 #define global_worklists_iterate(pgwl) \
66 global_worklists_iterate_all(pgwl) { \
67 if (global_worklist_is_valid(pgwl)) {
68 #define global_worklists_iterate_end \
70 } global_worklists_iterate_all_end;
74 #endif /* __cplusplus */
76 #endif /* FC__GLOBAL_WORKLIST_H */