Freeciv-3.3
Loading...
Searching...
No Matches
Enumerations | Functions
attribute.h File Reference
#include <stddef.h>

Go to the source code of this file.

Enumerations

enum  attr_object_type_start_keys { ATTR_UNIT_START = 0 * 100 * 1000 * 1000 , ATTR_CITY_START = 1 * 100 * 1000 * 1000 , ATTR_PLAYER_START = 2 * 100 * 1000 * 1000 , ATTR_TILE_START = 3 * 100 * 1000 * 1000 }
 
enum  attr_unit { ATTR_UNIT_DUMMY = ATTR_UNIT_START }
 
enum  attr_city { ATTR_CITY_CMA_PARAMETER = ATTR_CITY_START , ATTR_CITY_CMAFE_PARAMETER }
 
enum  attr_player { ATTR_PLAYER_DUMMY = ATTR_PLAYER_START }
 
enum  attr_tile { ATTR_TILE_DUMMY = ATTR_TILE_START }
 

Functions

void attribute_init (void)
 
void attribute_free (void)
 
void attribute_flush (void)
 
void attribute_restore (void)
 
void attribute_set (int key, int id, int x, int y, size_t data_length, const void *const data)
 
size_t attribute_get (int key, int id, int x, int y, size_t max_data_length, void *data)
 
void attr_unit_set (enum attr_unit what, int unit_id, size_t data_length, const void *const data)
 
size_t attr_unit_get (enum attr_unit what, int unit_id, size_t max_data_length, void *data)
 
void attr_unit_set_int (enum attr_unit what, int unit_id, int data)
 
size_t attr_unit_get_int (enum attr_unit what, int unit_id, int *data)
 
void attr_city_set (enum attr_city what, int city_id, size_t data_length, const void *const data)
 
size_t attr_city_get (enum attr_city what, int city_id, size_t max_data_length, void *data)
 
void attr_city_set_int (enum attr_city what, int city_id, int data)
 
size_t attr_city_get_int (enum attr_city what, int city_id, int *data)
 
void attr_player_set (enum attr_player what, int player_id, size_t data_length, const void *const data)
 
size_t attr_player_get (enum attr_player what, int player_id, size_t max_data_length, void *data)
 
void attr_tile_set (enum attr_tile what, int x, int y, size_t data_length, const void *const data)
 
size_t attr_tile_get (enum attr_tile what, int x, int y, size_t max_data_length, void *data)
 

Enumeration Type Documentation

◆ attr_city

Enumerator
ATTR_CITY_CMA_PARAMETER 
ATTR_CITY_CMAFE_PARAMETER 

Definition at line 37 of file attribute.h.

◆ attr_object_type_start_keys

Enumerator
ATTR_UNIT_START 
ATTR_CITY_START 
ATTR_PLAYER_START 
ATTR_TILE_START 

Definition at line 26 of file attribute.h.

◆ attr_player

Enumerator
ATTR_PLAYER_DUMMY 

Definition at line 42 of file attribute.h.

◆ attr_tile

Enumerator
ATTR_TILE_DUMMY 

Definition at line 46 of file attribute.h.

◆ attr_unit

Enumerator
ATTR_UNIT_DUMMY 

Definition at line 33 of file attribute.h.

Function Documentation

◆ attr_city_get()

size_t attr_city_get ( enum attr_city  what,
int  city_id,
size_t  max_data_length,
void data 
)

Get city related attribute

Definition at line 498 of file attribute.c.

Referenced by attr_city_get_int(), and cma_get_parameter().

◆ attr_city_get_int()

size_t attr_city_get_int ( enum attr_city  what,
int  city_id,
int data 
)

Get city related integer attribute

Definition at line 515 of file attribute.c.

◆ attr_city_set()

void attr_city_set ( enum attr_city  what,
int  city_id,
size_t  data_length,
const void *const  data 
)

Set city related attribute

Definition at line 489 of file attribute.c.

Referenced by attr_city_set_int(), city_remove(), cma_set_parameter(), and release_city().

◆ attr_city_set_int()

void attr_city_set_int ( enum attr_city  what,
int  city_id,
int  data 
)

Set city related integer attribute

Definition at line 507 of file attribute.c.

◆ attr_player_get()

size_t attr_player_get ( enum attr_player  what,
int  player_id,
size_t  max_data_length,
void data 
)

Get player related attribute

Definition at line 532 of file attribute.c.

◆ attr_player_set()

void attr_player_set ( enum attr_player  what,
int  player_id,
size_t  data_length,
const void *const  data 
)

Set player related attribute

Definition at line 523 of file attribute.c.

◆ attr_tile_get()

size_t attr_tile_get ( enum attr_tile  what,
int  x,
int  y,
size_t  max_data_length,
void data 
)

Get tile related attribute

Definition at line 550 of file attribute.c.

◆ attr_tile_set()

void attr_tile_set ( enum attr_tile  what,
int  x,
int  y,
size_t  data_length,
const void *const  data 
)

Set tile related attribute

Definition at line 541 of file attribute.c.

◆ attr_unit_get()

size_t attr_unit_get ( enum attr_unit  what,
int  unit_id,
size_t  max_data_length,
void data 
)

Get unit related attribute

Definition at line 464 of file attribute.c.

Referenced by attr_unit_get_int().

◆ attr_unit_get_int()

size_t attr_unit_get_int ( enum attr_unit  what,
int  unit_id,
int data 
)

Get unit related integer attribute

Definition at line 481 of file attribute.c.

◆ attr_unit_set()

void attr_unit_set ( enum attr_unit  what,
int  unit_id,
size_t  data_length,
const void *const  data 
)

Set unit related attribute

Definition at line 455 of file attribute.c.

Referenced by attr_unit_set_int().

◆ attr_unit_set_int()

void attr_unit_set_int ( enum attr_unit  what,
int  unit_id,
int  data 
)

Set unit related integer attribute

Definition at line 473 of file attribute.c.

◆ attribute_flush()

void attribute_flush ( void  )

Send current state to the server. Note that the current implementation will send all attributes to the server.

Definition at line 333 of file attribute.c.

Referenced by client_exit(), disconnect_from_server(), send_save_game(), and send_turn_done().

◆ attribute_free()

void attribute_free ( void  )

Frees the attribute module.

Definition at line 123 of file attribute.c.

Referenced by client_game_free(), and client_game_reset().

◆ attribute_get()

size_t attribute_get ( int  key,
int  id,
int  x,
int  y,
size_t  max_data_length,
void data 
)

Low-level function to get an attribute. If data hasn't enough space to hold the attribute data isn't set to the attribute. Returns the actual size of the attribute. Can be zero if the attribute is unset. To get the size of an attribute use size = attribute_get(key, id, x, y, 0, NULL)

Definition at line 422 of file attribute.c.

Referenced by attr_city_get(), attr_player_get(), attr_tile_get(), and attr_unit_get().

◆ attribute_init()

void attribute_init ( void  )

Initializes the attribute module.

Definition at line 114 of file attribute.c.

Referenced by client_game_init(), and client_game_reset().

◆ attribute_restore()

void attribute_restore ( void  )

Recreate the attribute set from the player's attribute_block. Shouldn't be used by normal code.

Definition at line 361 of file attribute.c.

Referenced by handle_player_attribute_chunk().

◆ attribute_set()

void attribute_set ( int  key,
int  id,
int  x,
int  y,
size_t  data_length,
const void *const  data 
)

Low-level function to set an attribute. If data_length is zero the attribute is removed.

Definition at line 390 of file attribute.c.

Referenced by attr_city_set(), attr_player_set(), attr_tile_set(), and attr_unit_set().