Freeciv21
Develop your civilization from humble roots to a global empire
attribute.h File Reference
#include <cstddef>
+ Include dependency graph for attribute.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  attr_object_type_start_keys { ATTR_CITY_START = 1 * 100 * 1000 * 1000 }
 
enum  attr_city { ATTR_CITY_CMA_PARAMETER = ATTR_CITY_START , ATTR_CITY_CMAFE_PARAMETER }
 

Functions

void attribute_init ()
 Initializes the attribute module. More...
 
void attribute_free ()
 Frees the attribute module. More...
 
void attribute_flush ()
 Send current state to the server. More...
 
void attribute_restore ()
 Recreate the attribute set from the player's attribute_block. More...
 
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. More...
 
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. More...
 
void attr_city_set (enum attr_city what, int city_id, size_t data_length, const void *const data)
 Set city related attribute. More...
 
size_t attr_city_get (enum attr_city what, int city_id, size_t max_data_length, void *data)
 Get city related attribute. More...
 

Enumeration Type Documentation

◆ attr_city

enum attr_city
Enumerator
ATTR_CITY_CMA_PARAMETER 
ATTR_CITY_CMAFE_PARAMETER 

Definition at line 21 of file attribute.h.

◆ attr_object_type_start_keys

Enumerator
ATTR_CITY_START 

Definition at line 19 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 410 of file attribute.cpp.

Referenced by cma_yoloswag::get_parameter().

◆ 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 401 of file attribute.cpp.

Referenced by cma_yoloswag::release_city(), governor::run(), and cma_yoloswag::set_parameter().

◆ attribute_flush()

void attribute_flush ( )

Send current state to the server.

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

Definition at line 284 of file attribute.cpp.

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

◆ attribute_free()

void attribute_free ( )

Frees the attribute module.

Definition at line 71 of file attribute.cpp.

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, nullptr)

Definition at line 367 of file attribute.cpp.

Referenced by attr_city_get().

◆ attribute_init()

void attribute_init ( )

Initializes the attribute module.

Definition at line 66 of file attribute.cpp.

Referenced by client_game_init(), and client_game_reset().

◆ attribute_restore()

void attribute_restore ( )

Recreate the attribute set from the player's attribute_block.

Shouldn't be used by normal code.

Definition at line 305 of file attribute.cpp.

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 332 of file attribute.cpp.

Referenced by attr_city_set().