67 const
char *path, ...)
107 for (i = 0; i < pgwl->unbuilt.length; i++) {
110 puni_name = pgwl->unbuilt.entries + i;
112 if (source.
kind == universals_n_invalid()) {
128 for (i = 0; i < pgwl->unbuilt.length; i++) {
129 puni_name = pgwl->unbuilt.entries + i;
130 delete[] puni_name->
kind;
131 delete[] puni_name->
name;
158 puni_name = pgwl->unbuilt.entries + i;
175 static int last_id = 0;
178 pgwl->
id = ++last_id;
211 for (i = 0; i < pgwl->
unbuilt.length; i++) {
212 puni_name = pgwl->
unbuilt.entries + i;
215 delete[] puni_name->
kind;
216 delete[] puni_name->
name;
288 if (pgwl->id ==
id) {
347 for (i = 0; i <
length; i++) {
354 file,
false,
"%s.wl_is_unit%d", path_str, i);
355 kind = universals_n_name(is_unit ? VUT_UTYPE : VUT_IMPROVEMENT);
360 if (
nullptr == kind ||
'\0' == kind[0] ||
nullptr ==
name
361 ||
'\0' ==
name[0]) {
399 const char *path, ...)
416 for (i = 0; i < pgwl->
unbuilt.length; i++) {
420 "%s.wl_value%d", path_str, i);
425 "%s.wl_length", path_str);
426 for (i = 0; i < pgwl->
unbuilt.length; i++) {
429 "%s.wl_kind%d", path_str, i);
432 "%s.wl_value%d", path_str, i);
439 while (i < fill_until) {
458 switch (pgwl->status) {
460 max_length =
MAX(max_length, pgwl->unbuilt.length);
enum client_states client_state()
Return current client state.
struct global_worklist * global_worklist_by_id(int id)
Returns the global worklist corresponding to this id.
static bool static void global_worklist_save(const struct global_worklist *pgwl, struct section_file *file, int fill_until, const char *path,...) fc__attribute((__format__(__printf__
Save one global worklist into a section file.
static bool global_worklist_load(struct section_file *file, const char *path,...) fc__attribute((__format__(__printf__
Load a global worklist form a section file.
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.
static struct global_worklist * global_worklist_alloc(enum global_worklist_status type)
Returns a new created global worklist structure.
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.
static bool static void void global_worklists_init()
Initialize the client global worklists.
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.
#define global_worklists_iterate_all_end
#define global_worklists_iterate_all(pgwl)
#define fc_assert_ret(condition)
#define fc_assert_ret_val(condition, val)
bool secfile_lookup_bool_default(const struct section_file *secfile, bool def, const char *path,...)
Lookup a boolean value in the secfile.
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
Lookup a string value in the secfile.
int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...)
Lookup a integer value in the secfile.
#define secfile_insert_int(secfile, value, path,...)
#define secfile_insert_str(secfile, string, path,...)
const char * universal_type_rule_name(const struct universal *psource)
Return untranslated name of the universal source name.
const char * universal_rule_name(const struct universal *psource)
Return the (untranslated) rule name of the universal.
struct universal universal_by_rule_name(const char *kind, const char *value)
Parse requirement type (kind) and value strings into a universal structure.
struct global_worklist_list * worklists
struct global_worklist::@119::@121 unbuilt
uni_name entries[MAX_LEN_WORKLIST]
enum global_worklist_status status
struct universal entries[MAX_LEN_WORKLIST]
int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap)
#define sz_strlcpy(dest, src)
int fc__attribute((nonnull(1, 3)))
void worklist_copy(struct worklist *dst, const struct worklist *src)
Copy contents from worklist src to worklist dst.
void worklist_init(struct worklist *pwl)
Initialize a worklist to be empty.
bool worklist_append(struct worklist *pwl, const struct universal *prod)
Adds the id to the next available slot in the worklist.
int worklist_length(const struct worklist *pwl)
Returns the number of entries in the worklist.