Freeciv21
Develop your civilization from humble roots to a global empire
global_worklist.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3  __ __ part of Freeciv21. Freeciv21 is free software: you can
4 / \\..// \ redistribute it and/or modify it under the terms of the GNU
5  ( oo ) General Public License as published by the Free Software
6  \__/ Foundation, either version 3 of the License, or (at your
7  option) any later version. You should have received
8  a copy of the GNU General Public License along with Freeciv21. If not,
9  see https://www.gnu.org/licenses/.
10 **************************************************************************/
11 #pragma once
12 
13 struct global_worklist; // Opaque type.
14 struct global_worklist_list; // Opaque type.
15 
20 
21 void global_worklists_load(struct section_file *file);
22 void global_worklists_save(struct section_file *file);
23 
24 struct global_worklist *global_worklist_new(const char *name);
25 void global_worklist_destroy(struct global_worklist *pgwl);
26 
28 
29 bool global_worklist_is_valid(const struct global_worklist *pgwl);
30 bool global_worklist_set(struct global_worklist *pgwl,
31  const struct worklist *pwl);
32 const struct worklist *
33 global_worklist_get(const struct global_worklist *pgwl);
34 int global_worklist_id(const struct global_worklist *pgwl);
36  const char *name);
37 const char *global_worklist_name(const struct global_worklist *pgwl);
38 
39 #define SPECLIST_TAG global_worklist
40 #define SPECLIST_TYPE struct global_worklist
41 #include "speclist.h"
42 
43 // Iterates all global worklists, include the ones which are not valid.
44 #define global_worklists_iterate_all(pgwl) \
45  if (client.worklists) { \
46  TYPED_LIST_ITERATE(struct global_worklist, client.worklists, pgwl)
47 #define global_worklists_iterate_all_end \
48  LIST_ITERATE_END \
49  }
50 
51 // Iterates all valid global worklists.
52 #define global_worklists_iterate(pgwl) \
53  global_worklists_iterate_all(pgwl) \
54  { \
55  if (global_worklist_is_valid(pgwl)) {
56 #define global_worklists_iterate_end \
57  } \
58  } \
59  global_worklists_iterate_all_end;
struct global_worklist * global_worklist_by_id(int id)
Returns the global worklist corresponding to this id.
void global_worklists_init()
Initialize the client global worklists.
bool global_worklist_set(struct global_worklist *pgwl, const struct worklist *pwl)
Sets the worklist.
void global_worklists_build()
Check if the global worklists are valid or not for the ruleset.
int global_worklist_id(const struct global_worklist *pgwl)
Returns the id of the global worklist.
void global_worklists_unbuild()
Convert the universal pointers to strings to work out-ruleset.
void global_worklists_free()
Free the client global worklists.
bool global_worklist_is_valid(const struct global_worklist *pgwl)
Returns TRUE if this global worklist is valid.
void global_worklist_destroy(struct global_worklist *pgwl)
Destroys a glocal worklist.
void global_worklists_load(struct section_file *file)
Load all global worklist from a section file.
struct global_worklist * global_worklist_new(const char *name)
Creates a new global worklist form a normal worklist.
const char * global_worklist_name(const struct global_worklist *pgwl)
Return the name of the global worklist.
const struct worklist * global_worklist_get(const struct global_worklist *pgwl)
Returns the worklist of this global worklist or nullptr if it's not valid.
void global_worklists_save(struct section_file *file)
Save all global worklist into a section file.
void global_worklist_set_name(struct global_worklist *pgwl, const char *name)
Sets the name of this global worklist.
const char * name
Definition: inputfile.cpp:118