Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
worklist.h File Reference
#include "registry.h"
#include "fc_types.h"

Go to the source code of this file.

Data Structures

struct  worklist
 

Macros

#define MAX_LEN_WORKLIST   64
 
#define MAX_NUM_WORKLISTS   16
 
#define worklist_iterate(_list, _p)
 
#define worklist_iterate_end
 

Functions

void worklist_init (struct worklist *pwl)
 
int worklist_length (const struct worklist *pwl)
 
bool worklist_is_empty (const struct worklist *pwl)
 
bool worklist_peek (const struct worklist *pwl, struct universal *prod)
 
bool worklist_peek_ith (const struct worklist *pwl, struct universal *prod, int idx)
 
void worklist_advance (struct worklist *pwl)
 
void worklist_copy (struct worklist *dst, const struct worklist *src)
 
void worklist_remove (struct worklist *pwl, int idx)
 
bool worklist_append (struct worklist *pwl, const struct universal *prod)
 
bool worklist_insert (struct worklist *pwl, const struct universal *prod, int idx)
 
bool are_worklists_equal (const struct worklist *wlist1, const struct worklist *wlist2)
 

Macro Definition Documentation

◆ MAX_LEN_WORKLIST

#define MAX_LEN_WORKLIST   64

Definition at line 24 of file worklist.h.

◆ MAX_NUM_WORKLISTS

#define MAX_NUM_WORKLISTS   16

Definition at line 25 of file worklist.h.

◆ worklist_iterate

#define worklist_iterate (   _list,
  _p 
)
Value:
{ \
struct universal _p; \
int _p##_index = 0; \
char * incite_cost
Definition comments.c:76
int worklist_length(const struct worklist *pwl)
Definition worklist.c:57

Definition at line 51 of file worklist.h.

◆ worklist_iterate_end

#define worklist_iterate_end
Value:
} \
}

Definition at line 59 of file worklist.h.

Function Documentation

◆ are_worklists_equal()

bool are_worklists_equal ( const struct worklist wlist1,
const struct worklist wlist2 
)

Return TRUE iff the two worklists are equal.

Definition at line 192 of file worklist.c.

Referenced by send_packet_city_info_100(), and send_packet_city_worklist_100().

◆ worklist_advance()

void worklist_advance ( struct worklist pwl)

Remove first element from worklist.

Definition at line 104 of file worklist.c.

Referenced by city_set_queue(), and remove_item_from_worklist().

◆ worklist_append()

bool worklist_append ( struct worklist pwl,
const struct universal prod 
)

Adds the id to the next available slot in the worklist. 'id' is the ID of the unit/building to be produced; is_unit specifies whether it's a unit or a building. Returns TRUE if successful.

Definition at line 147 of file worklist.c.

Referenced by add_global_worklist(), add_target_to_worklist(), base_city_queue_insert(), commit_worklist(), dio_get_worklist_raw(), and global_worklists_build().

◆ worklist_copy()

void worklist_copy ( struct worklist dst,
const struct worklist src 
)

◆ worklist_init()

void worklist_init ( struct worklist pwl)

Initialize a worklist to be empty. For elements, only really need to set [0], but initialize the rest to avoid junk values in savefile.

Definition at line 38 of file worklist.c.

Referenced by city_queue_clear(), city_dialog::clear_worklist(), clear_worklist_foreach_func(), city_widget::clear_worlist(), commit_worklist(), create_city_virtual(), dio_get_worklist_raw(), global_worklist_alloc(), global_worklists_build(), handle_city_info(), set_global_worklist(), worklist_load(), and worklist_load().

◆ worklist_insert()

bool worklist_insert ( struct worklist pwl,
const struct universal prod,
int  idx 
)

Inserts the production at the location idx in the worklist, thus moving all subsequent entries down. 'id' specifies the unit/building to be produced; is_unit tells whether it's a unit or building. Returns TRUE if successful.

Definition at line 167 of file worklist.c.

Referenced by base_city_queue_insert(), city_get_queue(), production_widget::prod_selected(), city_dialog::worklist_down(), and city_dialog::worklist_up().

◆ worklist_is_empty()

bool worklist_is_empty ( const struct worklist pwl)

◆ worklist_length()

int worklist_length ( const struct worklist pwl)

◆ worklist_peek()

bool worklist_peek ( const struct worklist pwl,
struct universal prod 
)

Fill in the id and is_unit values for the head of the worklist if the worklist is non-empty. Return 1 iff id and is_unit are valid.

Definition at line 76 of file worklist.c.

Referenced by city_set_queue().

◆ worklist_peek_ith()

bool worklist_peek_ith ( const struct worklist pwl,
struct universal prod,
int  idx 
)

Fill in the id and is_unit values for the ith element in the worklist. If the worklist has fewer than idx elements, return FALSE.

Definition at line 86 of file worklist.c.

Referenced by city_production_build_units(), city_worklist_commit(), set_global_worklist(), worklist_change_build_target(), city_dialog::worklist_down(), worklist_peek(), and city_dialog::worklist_up().

◆ worklist_remove()

void worklist_remove ( struct worklist pwl,
int  idx 
)